Closed (fixed)
Project:
S3 File System
Version:
8.x-3.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
11 May 2018 at 11:40 UTC
Updated:
27 Jul 2018 at 03:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
jansete commentedComment #3
jansete commentedComment #4
jansete commentedComment #5
jansete commentedComment #6
mikeryanWell, it does have an index on the timestamp column - but yeah, why is uri not a primary key?
Comment #7
mikeryanLooking at the code, in s3fs_schema() we have:
and in s3fs_install() we have:
It's attempting to make uri work as a primary key, but for some reason it's not taking...
Comment #8
mikeryanAh-ha! When looking at #2900237: PDOException: SQLSTATE[22001]: String data, right truncated, I noticed that my local system (which did not have that problem) had this problem - no PK, and collection not set to utf8_bin. But, the remote server, which did have that problem and thus never successfully populated the s3fs_file_temp table and swapped it for s3fs_file, has a PK on s3f3_file. What happens is when you refresh the cache, an s3fs_file_temp table is created by copying the schema of s3fs_file - but, that schema lacks the collation and key settings, so s3fs_file_temp does not receive them. Assuming the cache is successfully refreshed, the temp table replaces s3fs_file, which thus ends up with no PK.
Man, it'd be nice if #2193059: DatabaseSchema_mysql::createTableSql() can't set table collation got fixed...
Comment #9
mikeryanThis should do the trick.
Comment #10
jansete commentedHi @mikeryan!
It looks very well!
It's an important problem that we have to solved. I hope review and test tomorrow, if everything is fine, I'll create new release.
Thanks a lot!
Comment #12
jansete commentedNice work @mikeryan, now is in dev branch!
Comment #13
jansete commentedI've added a new function to fix indexes and now is used in hook_install, refresh-cache command and in a new hook_update to fix primary index for existing tables.
Comment #15
jansete commentedComment #16
mikeryanThanks!
Comment #17
arunverma commentedIt's been really required. Thanks for it.
Comment #19
Anitha Ravi commentedHi,
s3fs-2972251-9.patch does not working as expected. It gives the error as follows,
1.if i use patch -p1 < s3fs-2972251-9.patch
Hunk #1 FAILED at 229.
1 out of 1 hunk FAILED -- saving rejects to file /path/to/directory/modules/s3fs/src/S3fsService.php.rej
2. IF i use git apply -v s3fs-2972251-9.patch
Checking patch src/S3fsService.php...
error: while searching for:
try {
\Drupal::database()->schema()->dropTable('s3fs_file_temp');
\Drupal::database()->schema()->createTable('s3fs_file_temp', $schema['s3fs_file']);
}
catch (SchemaObjectExistsException $e) {
// The table already exists, so we can simply truncate it to start fresh.
error: patch failed: src/S3fsService.php:229
error: src/S3fsService.php: patch does not apply