summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2024-09-09 16:59:59 +0200
committerRobin Appelman <robin@icewind.nl>2024-09-16 12:19:20 +0200
commit914e8f9ce231c2d6604468beee75a816b3c24d56 (patch)
tree585ee791b3b5828a3aa1208957322b9b8cb8ccc4
parent32866bc7eefbc33722cbbee7a2550f2ac868da7b (diff)
downloadnextcloud-server-914e8f9ce231c2d6604468beee75a816b3c24d56.tar.gz
nextcloud-server-914e8f9ce231c2d6604468beee75a816b3c24d56.zip
fix: misc code fixes around db shardingbackport/47852/stable30
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r--lib/private/DB/QueryBuilder/ExtendedQueryBuilder.php4
-rw-r--r--lib/private/DB/QueryBuilder/QueryBuilder.php6
-rw-r--r--lib/private/DB/QueryBuilder/Sharded/ShardedQueryBuilder.php4
-rw-r--r--lib/private/Files/Cache/Cache.php2
-rw-r--r--lib/private/Memcache/Factory.php5
-rw-r--r--lib/private/Preview/BackgroundCleanupJob.php1
-rw-r--r--lib/public/DB/QueryBuilder/IQueryBuilder.php4
-rw-r--r--tests/lib/DB/QueryBuilder/Partitioned/PartitionedQueryBuilderTest.php14
-rw-r--r--tests/lib/DB/QueryBuilder/Sharded/SharedQueryBuilderTest.php14
9 files changed, 27 insertions, 27 deletions
diff --git a/lib/private/DB/QueryBuilder/ExtendedQueryBuilder.php b/lib/private/DB/QueryBuilder/ExtendedQueryBuilder.php
index c40cadfbdb5..f928132a123 100644
--- a/lib/private/DB/QueryBuilder/ExtendedQueryBuilder.php
+++ b/lib/private/DB/QueryBuilder/ExtendedQueryBuilder.php
@@ -289,12 +289,12 @@ abstract class ExtendedQueryBuilder implements IQueryBuilder {
return $this->builder->executeStatement($connection);
}
- public function hintShardKey(string $column, mixed $value, bool $overwrite = false) {
+ public function hintShardKey(string $column, mixed $value, bool $overwrite = false): self {
$this->builder->hintShardKey($column, $value, $overwrite);
return $this;
}
- public function runAcrossAllShards() {
+ public function runAcrossAllShards(): self {
$this->builder->runAcrossAllShards();
return $this;
}
diff --git a/lib/private/DB/QueryBuilder/QueryBuilder.php b/lib/private/DB/QueryBuilder/QueryBuilder.php
index d1207ebdb97..d008f02b56e 100644
--- a/lib/private/DB/QueryBuilder/QueryBuilder.php
+++ b/lib/private/DB/QueryBuilder/QueryBuilder.php
@@ -560,7 +560,7 @@ class QueryBuilder implements IQueryBuilder {
return $this;
}
- private function addOutputColumns(array $columns) {
+ private function addOutputColumns(array $columns): void {
foreach ($columns as $column) {
if (is_array($column)) {
$this->addOutputColumns($column);
@@ -1366,11 +1366,11 @@ class QueryBuilder implements IQueryBuilder {
return $this->helper->quoteColumnName($alias);
}
- public function hintShardKey(string $column, mixed $value, bool $overwrite = false) {
+ public function hintShardKey(string $column, mixed $value, bool $overwrite = false): self {
return $this;
}
- public function runAcrossAllShards() {
+ public function runAcrossAllShards(): self {
// noop
return $this;
}
diff --git a/lib/private/DB/QueryBuilder/Sharded/ShardedQueryBuilder.php b/lib/private/DB/QueryBuilder/Sharded/ShardedQueryBuilder.php
index e7bc70ce440..e5b66470de0 100644
--- a/lib/private/DB/QueryBuilder/Sharded/ShardedQueryBuilder.php
+++ b/lib/private/DB/QueryBuilder/Sharded/ShardedQueryBuilder.php
@@ -296,7 +296,7 @@ class ShardedQueryBuilder extends ExtendedQueryBuilder {
];
}
- public function hintShardKey(string $column, mixed $value, bool $overwrite = false) {
+ public function hintShardKey(string $column, mixed $value, bool $overwrite = false): self {
if ($overwrite) {
$this->primaryKeys = [];
$this->shardKeys = [];
@@ -310,7 +310,7 @@ class ShardedQueryBuilder extends ExtendedQueryBuilder {
return $this;
}
- public function runAcrossAllShards() {
+ public function runAcrossAllShards(): self {
$this->allShards = true;
return $this;
}
diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php
index 876f17ff740..8ab07981694 100644
--- a/lib/private/Files/Cache/Cache.php
+++ b/lib/private/Files/Cache/Cache.php
@@ -1207,7 +1207,7 @@ class Cache implements ICache {
}
}
- private function moveFromStorageSharded(ShardDefinition $shardDefinition, ICache $sourceCache, ICacheEntry $sourceEntry, $targetPath) {
+ private function moveFromStorageSharded(ShardDefinition $shardDefinition, ICache $sourceCache, ICacheEntry $sourceEntry, $targetPath): void {
if ($sourceEntry->getMimeType() === ICacheEntry::DIRECTORY_MIMETYPE) {
$fileIds = $this->getChildIds($sourceCache->getNumericStorageId(), $sourceEntry->getPath());
} else {
diff --git a/lib/private/Memcache/Factory.php b/lib/private/Memcache/Factory.php
index 931c871d0f1..370130912d6 100644
--- a/lib/private/Memcache/Factory.php
+++ b/lib/private/Memcache/Factory.php
@@ -6,6 +6,7 @@
*/
namespace OC\Memcache;
+use Closure;
use OCP\Cache\CappedMemoryCache;
use OCP\ICache;
use OCP\ICacheFactory;
@@ -40,7 +41,7 @@ class Factory implements ICacheFactory {
private IProfiler $profiler;
/**
- * @param callable $globalPrefixClosure
+ * @param Closure $globalPrefixClosure
* @param LoggerInterface $logger
* @param ?class-string<ICache> $localCacheClass
* @param ?class-string<ICache> $distributedCacheClass
@@ -48,7 +49,7 @@ class Factory implements ICacheFactory {
* @param string $logFile
*/
public function __construct(
- private $globalPrefixClosure,
+ private Closure $globalPrefixClosure,
LoggerInterface $logger,
IProfiler $profiler,
?string $localCacheClass = null,
diff --git a/lib/private/Preview/BackgroundCleanupJob.php b/lib/private/Preview/BackgroundCleanupJob.php
index acf7bf22f52..44832a78eb9 100644
--- a/lib/private/Preview/BackgroundCleanupJob.php
+++ b/lib/private/Preview/BackgroundCleanupJob.php
@@ -16,7 +16,6 @@ use OCP\Files\IMimeTypeLoader;
use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
use OCP\IDBConnection;
-use function Symfony\Component\Translation\t;
class BackgroundCleanupJob extends TimedJob {
/** @var IDBConnection */
diff --git a/lib/public/DB/QueryBuilder/IQueryBuilder.php b/lib/public/DB/QueryBuilder/IQueryBuilder.php
index 0c2aa4669c1..c630427ebfc 100644
--- a/lib/public/DB/QueryBuilder/IQueryBuilder.php
+++ b/lib/public/DB/QueryBuilder/IQueryBuilder.php
@@ -1040,7 +1040,7 @@ interface IQueryBuilder {
* @return $this
* @since 30.0.0
*/
- public function hintShardKey(string $column, mixed $value, bool $overwrite = false);
+ public function hintShardKey(string $column, mixed $value, bool $overwrite = false): self;
/**
* Set the query to run across all shards if sharding is enabled.
@@ -1048,7 +1048,7 @@ interface IQueryBuilder {
* @return $this
* @since 30.0.0
*/
- public function runAcrossAllShards();
+ public function runAcrossAllShards(): self;
/**
* Get a list of column names that are expected in the query output
diff --git a/tests/lib/DB/QueryBuilder/Partitioned/PartitionedQueryBuilderTest.php b/tests/lib/DB/QueryBuilder/Partitioned/PartitionedQueryBuilderTest.php
index 12ba74fe89f..697b3ab92c9 100644
--- a/tests/lib/DB/QueryBuilder/Partitioned/PartitionedQueryBuilderTest.php
+++ b/tests/lib/DB/QueryBuilder/Partitioned/PartitionedQueryBuilderTest.php
@@ -51,7 +51,7 @@ class PartitionedQueryBuilderTest extends TestCase {
}
}
- private function setupFileCache() {
+ private function setupFileCache(): void {
$this->cleanupDb();
$query = $this->getQueryBuilder();
$query->insert('storages')
@@ -92,7 +92,7 @@ class PartitionedQueryBuilderTest extends TestCase {
$query->executeStatement();
}
- private function cleanupDb() {
+ private function cleanupDb(): void {
$query = $this->getQueryBuilder();
$query->delete('storages')
->where($query->expr()->gt('numeric_id', $query->createNamedParameter(1000000, IQueryBuilder::PARAM_INT)));
@@ -115,7 +115,7 @@ class PartitionedQueryBuilderTest extends TestCase {
$query->executeStatement();
}
- public function testSimpleOnlyPartitionQuery() {
+ public function testSimpleOnlyPartitionQuery(): void {
$builder = $this->getQueryBuilder();
$builder->addPartition(new PartitionSplit('filecache', ['filecache']));
@@ -129,7 +129,7 @@ class PartitionedQueryBuilderTest extends TestCase {
$this->assertEquals($results[0]['path'], 'file1');
}
- public function testSimplePartitionedQuery() {
+ public function testSimplePartitionedQuery(): void {
$builder = $this->getQueryBuilder();
$builder->addPartition(new PartitionSplit('filecache', ['filecache']));
@@ -151,7 +151,7 @@ class PartitionedQueryBuilderTest extends TestCase {
$this->assertEquals($results[0]['path'], 'file1');
}
- public function testMultiTablePartitionedQuery() {
+ public function testMultiTablePartitionedQuery(): void {
$builder = $this->getQueryBuilder();
$builder->addPartition(new PartitionSplit('filecache', ['filecache', 'filecache_extended']));
@@ -174,7 +174,7 @@ class PartitionedQueryBuilderTest extends TestCase {
$this->assertEquals($results[0]['upload_time'], 1234);
}
- public function testPartitionedQueryFromSplit() {
+ public function testPartitionedQueryFromSplit(): void {
$builder = $this->getQueryBuilder();
$builder->addPartition(new PartitionSplit('filecache', ['filecache']));
@@ -195,7 +195,7 @@ class PartitionedQueryBuilderTest extends TestCase {
$this->assertEquals($results[0]['path'], 'file1');
}
- public function testMultiJoinPartitionedQuery() {
+ public function testMultiJoinPartitionedQuery(): void {
$builder = $this->getQueryBuilder();
$builder->addPartition(new PartitionSplit('filecache', ['filecache']));
diff --git a/tests/lib/DB/QueryBuilder/Sharded/SharedQueryBuilderTest.php b/tests/lib/DB/QueryBuilder/Sharded/SharedQueryBuilderTest.php
index 8f95c1b6263..a135b9159dd 100644
--- a/tests/lib/DB/QueryBuilder/Sharded/SharedQueryBuilderTest.php
+++ b/tests/lib/DB/QueryBuilder/Sharded/SharedQueryBuilderTest.php
@@ -46,7 +46,7 @@ class SharedQueryBuilderTest extends TestCase {
);
}
- public function testGetShardKeySingleParam() {
+ public function testGetShardKeySingleParam(): void {
$query = $this->getQueryBuilder('filecache', 'storage', 'fileid');
$query->select('fileid', 'path')
->from('filecache')
@@ -56,7 +56,7 @@ class SharedQueryBuilderTest extends TestCase {
$this->assertEquals([10], $query->getShardKeys());
}
- public function testGetPrimaryKeyParam() {
+ public function testGetPrimaryKeyParam(): void {
$query = $this->getQueryBuilder('filecache', 'storage', 'fileid');
$query->select('fileid', 'path')
->from('filecache')
@@ -66,7 +66,7 @@ class SharedQueryBuilderTest extends TestCase {
$this->assertEquals([], $query->getShardKeys());
}
- public function testValidateWithShardKey() {
+ public function testValidateWithShardKey(): void {
$query = $this->getQueryBuilder('filecache', 'storage', 'fileid');
$query->select('fileid', 'path')
->from('filecache')
@@ -76,7 +76,7 @@ class SharedQueryBuilderTest extends TestCase {
$this->assertTrue(true);
}
- public function testValidateWithPrimaryKey() {
+ public function testValidateWithPrimaryKey(): void {
$query = $this->getQueryBuilder('filecache', 'storage', 'fileid');
$query->select('fileid', 'path')
->from('filecache')
@@ -86,7 +86,7 @@ class SharedQueryBuilderTest extends TestCase {
$this->assertTrue(true);
}
- public function testValidateWithNoKey() {
+ public function testValidateWithNoKey(): void {
$query = $this->getQueryBuilder('filecache', 'storage', 'fileid');
$query->select('fileid', 'path')
->from('filecache')
@@ -97,7 +97,7 @@ class SharedQueryBuilderTest extends TestCase {
$this->fail('exception expected');
}
- public function testValidateNonSharedTable() {
+ public function testValidateNonSharedTable(): void {
$query = $this->getQueryBuilder('filecache', 'storage', 'fileid');
$query->select('configvalue')
->from('appconfig')
@@ -107,7 +107,7 @@ class SharedQueryBuilderTest extends TestCase {
$this->assertTrue(true);
}
- public function testGetShardKeyMultipleSingleParam() {
+ public function testGetShardKeyMultipleSingleParam(): void {
$query = $this->getQueryBuilder('filecache', 'storage', 'fileid');
$query->select('fileid', 'path')
->from('filecache')