I'm working on #1277152: Integration with Filefield Sources and discovered an issue when trying to insert our 4GB .iso file (DVD image) metadata into the table. This error:

PDOException, sqlstate Numeric value out of range: 1264 for filesize column in row 1

and found the solution in this comment: http://drupal.org/node/1003692#comment-6097068

The filesize field for this column is an INT which has a lower ceiling than BIGINT. I think the only drawback would be memory usage, but since Amazon S3 can handle files up to 5TB large, the filesize column should be a BIGINT(14).

After adjusting my schema to use these settings for the filesize field, my metadata insertion works normally.

Comments

torgospizza’s picture

Issue summary: View changes

Forgot the issue #

torgospizza’s picture

Status: Active » Needs review
justafish’s picture

Status: Needs review » Needs work
torgospizza’s picture

Status: Needs work » Needs review
StatusFileSize
new962 bytes

Here's a patch for the .install, which adds an update hook to alter the table schema and updates the original hook_schema where appropriate.

torgospizza’s picture

StatusFileSize
new962 bytes

Sorry, here's a better patch that uses a size of 14. In my tests (on mysql) the size of a BIGINT defaults to 20, though, so it may be unnecessary to include a size parameter.

justafish’s picture

Status: Needs review » Postponed

Is this going to work? The filesize column in file_managed is still an int(10), so I think we'd need to wait for http://drupal.org/node/1003692 to be back ported to D7.

torgospizza’s picture

Yeah, I noticed that in my testing as well, that {file_managed} still will fail. Thanks for posting the reference to #1003692: PDOException: SQLSTATE[22003] after entering large value in integer and decimal field - this will have to go in after that backport.

EDIT: On second thought, that issue appears to be specifically for fields, not for files that are managed by code. I wonder if there needs to be a new issue opened for that?

torgospizza’s picture

torgospizza’s picture

I created a new Issue for Drupal core: #1815886: Drupal core cannot manage files larger than 4 GB

torgospizza’s picture

Issue summary: View changes

Edit

justafish’s picture

Issue summary: View changes
Status: Postponed » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.