diff options
author | Robin Appelman <robin@icewind.nl> | 2022-04-07 21:53:36 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-07 21:53:36 +0300 |
commit | 9834350ac385e4dd90c7ee17b78cc491bebb3274 (patch) | |
tree | 7940be72a43fae0252d02977961cdfb58457c6b0 /lib/private/Files | |
parent | 60f946aba5862102a81100b09e26b37b6d59a3fa (diff) | |
parent | f9a5fb99fd4c586ac756afe53aa5c241c20657f2 (diff) |
Merge pull request #31713 from nextcloud/fed-performance
Federated share performance improvements
Diffstat (limited to 'lib/private/Files')
-rw-r--r-- | lib/private/Files/Cache/Propagator.php | 8 | ||||
-rw-r--r-- | lib/private/Files/Cache/Scanner.php | 3 | ||||
-rw-r--r-- | lib/private/Files/Storage/DAV.php | 4 |
3 files changed, 10 insertions, 5 deletions
diff --git a/lib/private/Files/Cache/Propagator.php b/lib/private/Files/Cache/Propagator.php index f8b2548a747..270b2b013f5 100644 --- a/lib/private/Files/Cache/Propagator.php +++ b/lib/private/Files/Cache/Propagator.php @@ -21,10 +21,12 @@ * along with this program. If not, see <http://www.gnu.org/licenses/> * */ + namespace OC\Files\Cache; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\Files\Cache\IPropagator; +use OCP\Files\Storage\IReliableEtagStorage; use OCP\IDBConnection; /** @@ -91,9 +93,11 @@ class Propagator implements IPropagator { $builder->update('filecache') ->set('mtime', $builder->func()->greatest('mtime', $builder->createNamedParameter((int)$time, IQueryBuilder::PARAM_INT))) - ->set('etag', $builder->createNamedParameter($etag, IQueryBuilder::PARAM_STR)) ->where($builder->expr()->eq('storage', $builder->createNamedParameter($storageId, IQueryBuilder::PARAM_INT))) ->andWhere($builder->expr()->in('path_hash', $hashParams)); + if (!$this->storage->instanceOfStorage(IReliableEtagStorage::class)) { + $builder->set('etag', $builder->createNamedParameter($etag, IQueryBuilder::PARAM_STR)); + } $builder->execute(); @@ -141,7 +145,7 @@ class Propagator implements IPropagator { $this->batch[$internalPath] = [ 'hash' => md5($internalPath), 'time' => $time, - 'size' => $sizeDifference + 'size' => $sizeDifference, ]; } else { $this->batch[$internalPath]['size'] += $sizeDifference; diff --git a/lib/private/Files/Cache/Scanner.php b/lib/private/Files/Cache/Scanner.php index af412dd129b..dc36ad5b8ca 100644 --- a/lib/private/Files/Cache/Scanner.php +++ b/lib/private/Files/Cache/Scanner.php @@ -41,6 +41,7 @@ use OC\Files\Storage\Wrapper\Encoding; use OC\Hooks\BasicEmitter; use OCP\Files\Cache\IScanner; use OCP\Files\ForbiddenException; +use OCP\Files\Storage\IReliableEtagStorage; use OCP\ILogger; use OCP\Lock\ILockingProvider; @@ -208,7 +209,7 @@ class Scanner extends BasicEmitter implements IScanner { if (($reuseExisting & self::REUSE_SIZE) && ($data['size'] === -1)) { $data['size'] = $cacheData['size']; } - if ($reuseExisting & self::REUSE_ETAG) { + if ($reuseExisting & self::REUSE_ETAG && !$this->storage->instanceOfStorage(IReliableEtagStorage::class)) { $data['etag'] = $etag; } } diff --git a/lib/private/Files/Storage/DAV.php b/lib/private/Files/Storage/DAV.php index ee874d97b55..b7d1c4bbc10 100644 --- a/lib/private/Files/Storage/DAV.php +++ b/lib/private/Files/Storage/DAV.php @@ -275,6 +275,7 @@ class DAV extends Common { '{http://open-collaboration-services.org/ns}share-permissions', '{DAV:}resourcetype', '{DAV:}getetag', + '{DAV:}quota-available-bytes', ] ); $this->statCache->set($path, $response); @@ -428,8 +429,7 @@ class DAV extends Common { $this->init(); $path = $this->cleanPath($path); try { - // TODO: cacheable ? - $response = $this->client->propfind($this->encodePath($path), ['{DAV:}quota-available-bytes']); + $response = $this->propfind($path); if ($response === false) { return FileInfo::SPACE_UNKNOWN; } |