From 381e922085d6460ff45c2d76cb82de1393afb379 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Thu, 29 Aug 2024 19:12:44 +0200 Subject: fix(DB): set sharding parameters only when intended Signed-off-by: Arthur Schiwon --- lib/private/DB/ConnectionFactory.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'lib/private/DB') diff --git a/lib/private/DB/ConnectionFactory.php b/lib/private/DB/ConnectionFactory.php index 8f161b68ecb..8d662b0508c 100644 --- a/lib/private/DB/ConnectionFactory.php +++ b/lib/private/DB/ConnectionFactory.php @@ -225,11 +225,16 @@ class ConnectionFactory { } $connectionParams['sharding'] = $this->config->getValue('dbsharding', []); - $connectionParams['shard_connection_manager'] = $this->shardConnectionManager; - $connectionParams['auto_increment_handler'] = new AutoIncrementHandler( - $this->cacheFactory, - $this->shardConnectionManager, - ); + if (!empty($connectionParams['sharding'])) { + $connectionParams['shard_connection_manager'] = $this->shardConnectionManager; + $connectionParams['auto_increment_handler'] = new AutoIncrementHandler( + $this->cacheFactory, + $this->shardConnectionManager, + ); + } else { + // just in case only the presence could lead to funny behaviour + unset($connectionParams['sharding']); + } $connectionParams = array_merge($connectionParams, $additionalConnectionParams); -- cgit v1.2.3