Details
-
Bug
-
Resolution: Fixed
-
Medium
-
4.0.1
-
None
Description
Due to the ezdbfile_data schema defining the offset column as an unsigned mediumint the largest offset that can be stored is 16777215. This means only files up to 16MB can be stored before the offset gets too big.
Patch against trunk (will allow files up to 4GB to be stored):
Index: kernel/classes/clusterfilehandlers/dbbackends/mysql.php =================================================================== --- kernel/classes/clusterfilehandlers/dbbackends/mysql.php (revision 22301) +++ kernel/classes/clusterfilehandlers/dbbackends/mysql.php (working copy) @@ -52,7 +52,7 @@ CREATE TABLE ezdbfile_data ( name_hash VARCHAR(34) NOT NULL DEFAULT '', - offset MEDIUMINT(11) UNSIGNED NOT NULL, + offset INT(11) UNSIGNED NOT NULL, filedata BLOB NOT NULL, PRIMARY KEY (name_hash, offset), CONSTRAINT ezdbfile_fk1 FOREIGN KEY (name_hash) REFERENCES ezdbfile (name_hash) ON DELETE CASCADE
To update an existing installation run:
ALTER TABLE ezdbfile_data MODIFY offset INT(11) UNSIGNED NOT NULL;
Steps to reproduce
Steps:
- Clean installation 4.0.1
- Update PHP to allow uploads larger than 16M (post_max_size and upload_max_filesize)
- Create new file object with file larger than 16M
- Follow clusterize proccess
Now the new file is not imported corerctly.
You can check the result with this SQL.
SELECT ezdbfile_data.name_hash, sum( OCTET_LENGTH( ezdbfile_data.filedata ) ) FROM ezdbfile_data WHERE ezdbfile_data.name_hash IN ( SELECT ezdbfile.name_hash FROM ezdbfile WHERE ezdbfile.size > 16842495 ) GROUP BY ezdbfile_data.name_hash;
All files will be displayed with a size of 16842495, which is wrong, because only files with a size larger than 16842495 should be displayed.