mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 16:50:48 +00:00
Use local shard if there are no remote connections
This commit is contained in:
parent
b5cbbce314
commit
d88e0b1b44
@ -160,7 +160,7 @@ void SelectStreamFactory::createForShard(
|
||||
|
||||
const auto & settings = context->getSettingsRef();
|
||||
|
||||
if (settings.prefer_localhost_replica && shard_info.isLocal())
|
||||
if ((settings.prefer_localhost_replica && shard_info.isLocal()) || !shard_info.hasRemoteConnections())
|
||||
{
|
||||
StoragePtr main_table_storage;
|
||||
|
||||
|
@ -0,0 +1,2 @@
|
||||
0
|
||||
0
|
@ -0,0 +1,19 @@
|
||||
DROP DATABASE IF EXISTS 01813_db;
|
||||
CREATE DATABASE 01813_db;
|
||||
|
||||
DROP TABLE IF EXISTS 01813_db.data;
|
||||
CREATE TABLE 01813_db.data (a Int64, b Int64) ENGINE = TinyLog();
|
||||
|
||||
DROP TABLE IF EXISTS 01813_db.data_distributed;
|
||||
CREATE TABLE 01813_db.data_distributed (a Int64, b Int64) ENGINE = Distributed(test_shard_localhost, '01813_db', data);
|
||||
|
||||
INSERT INTO 01813_db.data VALUES (0, 0);
|
||||
|
||||
SET prefer_localhost_replica = 1;
|
||||
SELECT a / (SELECT sum(number) FROM numbers(10)) FROM 01813_db.data_distributed;
|
||||
|
||||
SET prefer_localhost_replica = 0;
|
||||
SELECT a / (SELECT sum(number) FROM numbers(10)) FROM 01813_db.data_distributed;
|
||||
|
||||
DROP TABLE 01813_db.data_distributed;
|
||||
DROP TABLE 01813_db.data;
|
Loading…
Reference in New Issue
Block a user