diff options
author | Robin Appelman <robin@icewind.nl> | 2024-08-21 17:18:08 +0200 |
---|---|---|
committer | Louis Chemineau <louis@chmn.me> | 2024-08-28 10:27:14 +0200 |
commit | 1363e142d8ed6008388f52b7bf422f238df4e50b (patch) | |
tree | 6baee2d781027b98ce4fddebb6ba09d86837b7b6 | |
parent | b21a399d1a7fab83ff80bc637c176915d3460f2b (diff) | |
download | nextcloud-server-1363e142d8ed6008388f52b7bf422f238df4e50b.tar.gz nextcloud-server-1363e142d8ed6008388f52b7bf422f238df4e50b.zip |
fix: make preload custom proterties sharding compatible
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r-- | apps/dav/lib/DAV/CustomPropertiesBackend.php | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/apps/dav/lib/DAV/CustomPropertiesBackend.php b/apps/dav/lib/DAV/CustomPropertiesBackend.php index c3a547ab07d..dde97cabf37 100644 --- a/apps/dav/lib/DAV/CustomPropertiesBackend.php +++ b/apps/dav/lib/DAV/CustomPropertiesBackend.php @@ -364,16 +364,16 @@ class CustomPropertiesBackend implements BackendInterface { private function cacheDirectory(string $path, Directory $node): void { $prefix = ltrim($path . '/', '/'); $query = $this->connection->getQueryBuilder(); - $query->select('name', 'propertypath', 'propertyname', 'propertyvalue', 'valuetype') + $query->select('name', 'p.propertypath', 'p.propertyname', 'p.propertyvalue', 'p.valuetype') ->from('filecache', 'f') - ->leftJoin('f', 'properties', 'p', $query->expr()->andX( - $query->expr()->eq('propertypath', $query->func()->concat( - $query->createNamedParameter($prefix), - 'name' - )), - $query->expr()->eq('userid', $query->createNamedParameter($this->user->getUID())) - )) - ->where($query->expr()->eq('parent', $query->createNamedParameter($node->getInternalFileId(), IQueryBuilder::PARAM_INT))); + ->hintShardKey('storage', $node->getNode()->getMountPoint()->getNumericStorageId()) + ->leftJoin('f', 'properties', 'p', $query->expr()->eq('p.propertypath', $query->func()->concat( + $query->createNamedParameter($prefix), + 'f.name' + )), + ) + ->where($query->expr()->eq('parent', $query->createNamedParameter($node->getInternalFileId(), IQueryBuilder::PARAM_INT))) + ->andWhere($query->expr()->eq('p.userid', $query->createNamedParameter($this->user->getUID()))); $result = $query->executeQuery(); $propsByPath = []; |