aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Files/ObjectStore
diff options
context:
space:
mode:
authorChristoph Fiehe <c.fiehe@eurodata.de>2024-09-14 23:05:12 +0200
committercfiehe <cfiehe@users.noreply.github.com>2024-09-16 15:11:09 +0200
commit9597072ada7c0b9b7ee0d6e790a8422eab73572a (patch)
treecfff68776a5ebb726d9bfc2beddbb50f9b6535a7 /tests/lib/Files/ObjectStore
parentcfed24cb0254caf570b2a520979a83435a677cc8 (diff)
downloadnextcloud-server-9597072ada7c0b9b7ee0d6e790a8422eab73572a.tar.gz
nextcloud-server-9597072ada7c0b9b7ee0d6e790a8422eab73572a.zip
perf(ObjectStoreStorage): Improve (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 https://github.com/nextcloud/server/pull/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: Christoph Fiehe <c.fiehe@eurodata.de>
Diffstat (limited to 'tests/lib/Files/ObjectStore')
-rw-r--r--tests/lib/Files/ObjectStore/ObjectStoreStoragesDifferentBucketTest.php39
-rw-r--r--tests/lib/Files/ObjectStore/ObjectStoreStoragesSameBucketTest.php31
2 files changed, 70 insertions, 0 deletions
diff --git a/tests/lib/Files/ObjectStore/ObjectStoreStoragesDifferentBucketTest.php b/tests/lib/Files/ObjectStore/ObjectStoreStoragesDifferentBucketTest.php
new file mode 100644
index 00000000000..1915460777c
--- /dev/null
+++ b/tests/lib/Files/ObjectStore/ObjectStoreStoragesDifferentBucketTest.php
@@ -0,0 +1,39 @@
+<?php
+/**
+ * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace Test\Files\ObjectStore;
+
+use Test\Files\Storage\StoragesTest;
+
+/**
+ * @group DB
+ */
+class ObjectStoreStoragesDifferentBucketTest extends StoragesTest {
+ /**
+ * @var \OCP\Files\ObjectStore\IObjectStore
+ */
+ private $objectStore1;
+
+ /**
+ * @var \OCP\Files\ObjectStore\IObjectStore
+ */
+ private $objectStore2;
+
+ protected function setUp(): void {
+ parent::setUp();
+
+ $baseStorage1 = new Temporary();
+ $this->objectStore1 = new StorageObjectStore($baseStorage1);
+ $config['objectstore'] = $this->objectStore1;
+ $this->storage1 = new ObjectStoreStorageOverwrite($config);
+
+ $baseStorage2 = new Temporary();
+ $this->objectStore2 = new StorageObjectStore($baseStorage2);
+ $config['objectstore'] = $this->objectStore2;
+ $this->storage2 = new ObjectStoreStorageOverwrite($config);
+ }
+}
diff --git a/tests/lib/Files/ObjectStore/ObjectStoreStoragesSameBucketTest.php b/tests/lib/Files/ObjectStore/ObjectStoreStoragesSameBucketTest.php
new file mode 100644
index 00000000000..71011451a53
--- /dev/null
+++ b/tests/lib/Files/ObjectStore/ObjectStoreStoragesSameBucketTest.php
@@ -0,0 +1,31 @@
+<?php
+/**
+ * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace Test\Files\ObjectStore;
+
+use Test\Files\Storage\StoragesTest;
+
+/**
+ * @group DB
+ */
+class ObjectStoreStoragesSameBucketTest extends StoragesTest {
+ /**
+ * @var \OCP\Files\ObjectStore\IObjectStore
+ */
+ private $objectStore;
+
+ protected function setUp(): void {
+ parent::setUp();
+
+ $baseStorage = new Temporary();
+ $this->objectStore = new StorageObjectStore($baseStorage);
+ $config['objectstore'] = $this->objectStore;
+ // storage1 and storage2 share the same object store.
+ $this->storage1 = new ObjectStoreStorageOverwrite($config);
+ $this->storage2 = new ObjectStoreStorageOverwrite($config);
+ }
+}