Skip to content

Commit 21172bf

Browse files
Christoph Fieheprovokateurin
andcommitted
Fix (slow) move on same object bucket.
This commit fixes the issue #47856. When you upload a file into a group folder and when you use a single S3 bucket as primary storage, the final move operation hangs for a long time. In the background, Nextcloud initiates a copy-delete sequence from the bucket into the bucket, with causes a lot unnecessary overhead. Nextcloud thinks that the file must be imported to another storage and does not recognize that everything is done on the same object bucket. In that case, the import step can be completely skipped, which saves time, network bandwidth and reduces the load on the object storage. The behavior improves a lot with #46013. However, there are still some put messages that are being sent to the object storage when you use an object storage as primary storage and upload files into a group folder. Co-authored-by: Kate <26026535+provokateurin@users.noreply.github.com> Signed-off-by: cfiehe <cfiehe@users.noreply.github.com>
1 parent 6a6910f commit 21172bf

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

lib/private/Files/ObjectStore/ObjectStoreStorage.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,11 @@ public function copyFromStorage(
596596

597597
public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath, ?ICacheEntry $sourceCacheEntry = null): bool {
598598
$sourceCache = $sourceStorage->getCache();
599+
if ($sourceStorage->instanceOfStorage(ObjectStoreStorage::class) && $sourceStorage->getObjectStore()->getStorageId() === $this->getObjectStore()->getStorageId()) {
600+
$this->getCache()->moveFromCache($sourceCache, $sourceInternalPath, $targetInternalPath);
601+
// Do not import any data when source and target bucket are identical.
602+
return true;
603+
}
599604
if (!$sourceCacheEntry) {
600605
$sourceCacheEntry = $sourceCache->get($sourceInternalPath);
601606
}

0 commit comments

Comments
 (0)