Skip to content

Commit ff0cab5

Browse files
authored
Merge pull request #47852 from nextcloud/sharding-code-fixes
2 parents 52f4b88 + da59fd4 commit ff0cab5

8 files changed

Lines changed: 15 additions & 15 deletions

File tree

lib/private/DB/QueryBuilder/ExtendedQueryBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,12 +289,12 @@ public function executeStatement(?IDBConnection $connection = null): int {
289289
return $this->builder->executeStatement($connection);
290290
}
291291

292-
public function hintShardKey(string $column, mixed $value, bool $overwrite = false) {
292+
public function hintShardKey(string $column, mixed $value, bool $overwrite = false): self {
293293
$this->builder->hintShardKey($column, $value, $overwrite);
294294
return $this;
295295
}
296296

297-
public function runAcrossAllShards() {
297+
public function runAcrossAllShards(): self {
298298
$this->builder->runAcrossAllShards();
299299
return $this;
300300
}

lib/private/DB/QueryBuilder/QueryBuilder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ public function addSelect(...$selects) {
560560
return $this;
561561
}
562562

563-
private function addOutputColumns(array $columns) {
563+
private function addOutputColumns(array $columns): void {
564564
foreach ($columns as $column) {
565565
if (is_array($column)) {
566566
$this->addOutputColumns($column);
@@ -1370,11 +1370,11 @@ public function escapeLikeParameter(string $parameter): string {
13701370
return $this->connection->escapeLikeParameter($parameter);
13711371
}
13721372

1373-
public function hintShardKey(string $column, mixed $value, bool $overwrite = false) {
1373+
public function hintShardKey(string $column, mixed $value, bool $overwrite = false): self {
13741374
return $this;
13751375
}
13761376

1377-
public function runAcrossAllShards() {
1377+
public function runAcrossAllShards(): self {
13781378
// noop
13791379
return $this;
13801380
}

lib/private/DB/QueryBuilder/Sharded/ShardedQueryBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ private function registerOrder(string $column, string $order): void {
296296
];
297297
}
298298

299-
public function hintShardKey(string $column, mixed $value, bool $overwrite = false) {
299+
public function hintShardKey(string $column, mixed $value, bool $overwrite = false): self {
300300
if ($overwrite) {
301301
$this->primaryKeys = [];
302302
$this->shardKeys = [];
@@ -310,7 +310,7 @@ public function hintShardKey(string $column, mixed $value, bool $overwrite = fal
310310
return $this;
311311
}
312312

313-
public function runAcrossAllShards() {
313+
public function runAcrossAllShards(): self {
314314
$this->allShards = true;
315315
return $this;
316316
}

lib/private/Files/Cache/Cache.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1207,7 +1207,7 @@ public function getCacheEntryFromSearchResult(ICacheEntry $rawEntry): ?ICacheEnt
12071207
}
12081208
}
12091209

1210-
private function moveFromStorageSharded(ShardDefinition $shardDefinition, ICache $sourceCache, ICacheEntry $sourceEntry, $targetPath) {
1210+
private function moveFromStorageSharded(ShardDefinition $shardDefinition, ICache $sourceCache, ICacheEntry $sourceEntry, $targetPath): void {
12111211
if ($sourceEntry->getMimeType() === ICacheEntry::DIRECTORY_MIMETYPE) {
12121212
$fileIds = $this->getChildIds($sourceCache->getNumericStorageId(), $sourceEntry->getPath());
12131213
} else {

lib/private/Memcache/Factory.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77
namespace OC\Memcache;
88

9+
use Closure;
910
use OCP\Cache\CappedMemoryCache;
1011
use OCP\ICache;
1112
use OCP\ICacheFactory;
@@ -40,15 +41,15 @@ class Factory implements ICacheFactory {
4041
private IProfiler $profiler;
4142

4243
/**
43-
* @param callable $globalPrefixClosure
44+
* @param Closure $globalPrefixClosure
4445
* @param LoggerInterface $logger
4546
* @param ?class-string<ICache> $localCacheClass
4647
* @param ?class-string<ICache> $distributedCacheClass
4748
* @param ?class-string<IMemcache> $lockingCacheClass
4849
* @param string $logFile
4950
*/
5051
public function __construct(
51-
private $globalPrefixClosure,
52+
private Closure $globalPrefixClosure,
5253
LoggerInterface $logger,
5354
IProfiler $profiler,
5455
?string $localCacheClass = null,

lib/private/Preview/BackgroundCleanupJob.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use OCP\Files\NotFoundException;
1717
use OCP\Files\NotPermittedException;
1818
use OCP\IDBConnection;
19-
use function Symfony\Component\Translation\t;
2019

2120
class BackgroundCleanupJob extends TimedJob {
2221
/** @var IDBConnection */

lib/public/DB/QueryBuilder/IQueryBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,15 +1040,15 @@ public function getColumnName($column, $tableAlias = '');
10401040
* @return $this
10411041
* @since 30.0.0
10421042
*/
1043-
public function hintShardKey(string $column, mixed $value, bool $overwrite = false);
1043+
public function hintShardKey(string $column, mixed $value, bool $overwrite = false): self;
10441044

10451045
/**
10461046
* Set the query to run across all shards if sharding is enabled.
10471047
*
10481048
* @return $this
10491049
* @since 30.0.0
10501050
*/
1051-
public function runAcrossAllShards();
1051+
public function runAcrossAllShards(): self;
10521052

10531053
/**
10541054
* Get a list of column names that are expected in the query output

tests/lib/DB/QueryBuilder/Partitioned/PartitionedQueryBuilderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ private function getQueryBuilder(): PartitionedQueryBuilder {
5151
}
5252
}
5353

54-
private function setupFileCache() {
54+
private function setupFileCache(): void {
5555
$this->cleanupDb();
5656
$query = $this->getQueryBuilder();
5757
$query->insert('storages')
@@ -92,7 +92,7 @@ private function setupFileCache() {
9292
$query->executeStatement();
9393
}
9494

95-
private function cleanupDb() {
95+
private function cleanupDb(): void {
9696
$query = $this->getQueryBuilder();
9797
$query->delete('storages')
9898
->where($query->expr()->gt('numeric_id', $query->createNamedParameter(1000000, IQueryBuilder::PARAM_INT)));

0 commit comments

Comments
 (0)