-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Transfer ownership with S3 as primary #51020
base: master
Are you sure you want to change the base?
Conversation
8858cbe
to
50696c5
Compare
0c73e73
to
cc9966d
Compare
/backport to stable31 |
/backport to stable30 |
/backport to stable29 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The existing objects will have to be deleted to, not just the cache entries
Indeed, that's a concern. Not sure how to best proceed, because in case of a folder, we'll need to get all its children, no? |
84b07b6
to
b50e03a
Compare
I added |
When using S3 as primary storage, transferring ownership with the `--move` option fail with the following error: `SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '8-45b963397aa40d4a0063e0d85e4fe7a1' for key 'fs_storage_path_hash'` The `--move` option moves the entire home folder from one account to another. The error means that the move failed because the destination folder already exist in `oc_filecache`. - With S3 as primary storage, folders only exists as entries in `oc_filecache`. - With S3 as primary storage, `moveFromStorage(...)` only moves the cache entry, as nothing needs to be moved on disk. This cache move does not delete potentially pre-existing destination folder. - With Local storage, `moveFromStorage(...)` calls `rename(...)` which delete pre-existing folder. - `transfer(...)`: https://github.com/nextcloud/server/blob/687a4d9ac7fcdbd935f81a0def567a1092306f7a/apps/files/lib/Service/OwnershipTransferService.php#L112 - `oneTimeUserSetup(...)`: https://github.com/nextcloud/server/blob/687a4d9ac7fcdbd935f81a0def567a1092306f7a/lib/private/Files/SetupManager.php#L261-L262 - `mkdir(...)`: https://github.com/nextcloud/server/blob/687a4d9ac7fcdbd935f81a0def567a1092306f7a/lib/private/Files/ObjectStore/ObjectStoreStorage.php#L91-L135 - `moveFromStorage(...)`: https://github.com/nextcloud/server/blob/687a4d9ac7fcdbd935f81a0def567a1092306f7a/lib/private/Files/ObjectStore/ObjectStoreStorage.php#L635-L636 Delete pre-existing folder in `moveFromStorage(...)` Signed-off-by: Louis Chemineau <louis@chmn.me>
b50e03a
to
8fdf2a7
Compare
Issue
When using S3 as primary storage, transferring ownership with the
--move
option fail with the following error:SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '8-45b963397aa40d4a0063e0d85e4fe7a1' for key 'fs_storage_path_hash'
The
--move
option moves the entire home folder from one account to another.The error means that the move failed because the destination folder already exist in
oc_filecache
.Might have been introduced by: #26149
Investigation
oc_filecache
.moveFromStorage(...)
only moves the cache entry, as nothing needs to be moved on disk. This cache move does not delete potentially pre-existing destination folder.moveFromStorage(...)
callsrename(...)
which delete pre-existing folder.S3's
moveFromStorage
server/lib/private/Files/ObjectStore/ObjectStoreStorage.php
Lines 593 to 599 in 373107b
Local's
rename
, called bymoveFromStorage
server/lib/private/Files/Storage/Local.php
Lines 346 to 352 in 373107b
Solution
Delete pre-existing folder in
moveFromStorage(...)
Does it make sense to have that here? It feels off.
Todo
tests/lib/Files/Storage/StoragesTest.php