Skip to content

Commit

Permalink
fix: hint storage id in more places
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <robin@icewind.nl>
  • Loading branch information
icewind1991 committed Jul 19, 2024
1 parent 097dd20 commit f930b86
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/private/Files/Cache/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ public function update($id, array $data) {
$query = $this->getQueryBuilder();
$query->update('filecache_extended')
->whereFileId($id)
->hintShardKey('storage', $this->getNumericStorageId())
->andWhere($query->expr()->orX(...array_map(function ($key, $value) use ($query) {
return $query->expr()->orX(
$query->expr()->neq($key, $query->createNamedParameter($value)),
Expand Down Expand Up @@ -524,7 +525,8 @@ public function remove($file) {

$query = $this->getQueryBuilder();
$query->delete('filecache_extended')
->whereFileId($entry->getId());
->whereFileId($entry->getId())
->hintShardKey('storage', $this->getNumericStorageId());
$query->execute();

if ($entry->getMimeType() == FileInfo::MIMETYPE_FOLDER) {
Expand Down Expand Up @@ -568,7 +570,8 @@ private function removeChildren(ICacheEntry $entry) {

$query = $this->getQueryBuilder();
$query->delete('filecache_extended')
->where($query->expr()->in('fileid', $query->createParameter('childIds')));
->where($query->expr()->in('fileid', $query->createParameter('childIds')))
->hintShardKey('storage', $this->getNumericStorageId());

foreach (array_chunk($childIds, 1000) as $childIdChunk) {
$query->setParameter('childIds', $childIdChunk, IQueryBuilder::PARAM_INT_ARRAY);
Expand Down

0 comments on commit f930b86

Please sign in to comment.