diff --git a/lib/private/DB/QueryBuilder/Sharded/ShardQueryRunner.php b/lib/private/DB/QueryBuilder/Sharded/ShardQueryRunner.php index d43cc1b06fb0a..5d2c13907a65d 100644 --- a/lib/private/DB/QueryBuilder/Sharded/ShardQueryRunner.php +++ b/lib/private/DB/QueryBuilder/Sharded/ShardQueryRunner.php @@ -48,14 +48,20 @@ public function getShards(bool $allShards, array $shardKeys): ?array { } /** - * Try to get the shards that the keys are likely to be in, based on the shard the row was created on and caching + * Try to get the shards that the keys are likely to be in, based on the shard the row was created * * @param int[] $primaryKeys * @return int[] */ private function getLikelyShards(array $primaryKeys): array { - // todo - return []; + $shards = []; + foreach ($primaryKeys as $primaryKey) { + $encodedShard = $primaryKey & ShardDefinition::PRIMARY_KEY_SHARD_MASK; + if (!in_array($encodedShard, $shards)) { + $shards[] = $encodedShard; + } + } + return $shards; } /**