fix: Transfer ownership with S3 as primary #51020
Open
+7
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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