You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
File cache update() cannot set empty string on Oracle #31692
add unit test for OC\File\Cache::update() to reproduce the issue and prove it's broken on Oracle
Modify OC\File\Cache to detect Oracle. If Oracle and the parameter to update is an empty string, convert it to NULL and adjust the query if necessary.
check if other parts of file cache might be affected
raise separate ticket for NULL issue
Please note that the update query contains a WHERE statement to avoid updating values that are already set to the same value in the DB. This needs special handling for nulls, etc.
At this point to avoid potential regressions for other DBs, I suggest ignoring the "setting NULL" issue and focus on Oracle only.
This could potentially be critical because some code paths will clear values like the checksum, mostly in external storage update detection cases. If the value cannot be cleared, invalid checksums could still stay in the DB for Oracle.
Note aside: We should probably set the default value the checksum column to null (unless reasons) and hunt down all places where it is set to empty string.
It looks like the update only works if the mtime changes
The resulting query is "UPDATE `*PREFIX*filecache` SET `mtime` = ?, `checksum`=? WHERE (`mtime` <> ? OR `checksum` <> ? OR `mtime` IS NULL OR `checksum` IS NULL) AND `fileid` = ?
@IljaN when restting the checksum manually from a specific command, we don't touch the mtime.
What you observed is likely the normal behavior of the scanner: whenever the mtime of a file on disk is different than the one in the file cache, it is interpreted as "the file on disk was modified" so the scanner will update the file's metadata and clear the checksum. As a side effect of course the mtime would also be adjusted to whatever is now on disk.
Activity
PVince81 commentedon Jun 8, 2018
This could potentially be critical because some code paths will clear values like the checksum, mostly in external storage update detection cases. If the value cannot be cleared, invalid checksums could still stay in the DB for Oracle.
PVince81 commentedon Jun 8, 2018
cc @cdamken
ownclouders commentedon Jun 8, 2018
GitMate.io thinks possibly related issues are #17027 (Cannot create empty file on SFTP), #21366 (Update), #20661 (Update), #10078 (cache updater updates etag too often), and #23284 (GoogleDrive folder appears empty after file update).
PVince81 commentedon Jun 8, 2018
@tomneedham @butonic do we agree on the proposed approach ? only fix for Oracle and only for when setting empty strings ?
IljaN commentedon Jun 19, 2018
Note aside: We should probably set the default value the checksum column to null (unless reasons) and hunt down all places where it is set to empty string.
IljaN commentedon Jun 22, 2018
It looks like the update only works if the mtime changes
The resulting query is
"UPDATE `*PREFIX*filecache` SET `mtime` = ?, `checksum`=? WHERE (`mtime` <> ? OR `checksum` <> ? OR `mtime` IS NULL OR `checksum` IS NULL) AND `fileid` = ?PVince81 commentedon Jun 25, 2018
yes, this is because of detection of changes on external storages.
IljaN commentedon Jun 26, 2018
But we shouldn`t mess with the mtime when resetting the checksum right?
PVince81 commentedon Jun 26, 2018
@IljaN when restting the checksum manually from a specific command, we don't touch the mtime.
What you observed is likely the normal behavior of the scanner: whenever the mtime of a file on disk is different than the one in the file cache, it is interpreted as "the file on disk was modified" so the scanner will update the file's metadata and clear the checksum. As a side effect of course the mtime would also be adjusted to whatever is now on disk.
PVince81 commentedon Jun 28, 2018
@IljaN link to PR ? I thought you had something already based on our discussions
fix update to reset column on oracle #31692
fix update to reset column on oracle #31692
fix update to reset column on oracle #31692
fix update to reset column on oracle #31692
fix update to reset column on oracle #31692
IljaN commentedon Jul 5, 2018
Backport: #31996