mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
dbms: Server: queries with several replicas: fixes [#METR-14410]
This commit is contained in:
parent
8c0a540350
commit
e8902aa644
@ -103,8 +103,6 @@ public:
|
|||||||
/// Добавить кусок в очередь кусков, чьи данные нужно проверить в фоновом потоке.
|
/// Добавить кусок в очередь кусков, чьи данные нужно проверить в фоновом потоке.
|
||||||
void enqueuePartForCheck(const String & name);
|
void enqueuePartForCheck(const String & name);
|
||||||
|
|
||||||
void skipUnreplicated() { process_unreplicated = false; }
|
|
||||||
|
|
||||||
MergeTreeData & getData() { return data; }
|
MergeTreeData & getData() { return data; }
|
||||||
MergeTreeData * getUnreplicatedData() { return unreplicated_data.get(); }
|
MergeTreeData * getUnreplicatedData() { return unreplicated_data.get(); }
|
||||||
|
|
||||||
@ -166,8 +164,6 @@ private:
|
|||||||
current_zookeeper = zookeeper;
|
current_zookeeper = zookeeper;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool process_unreplicated = true;
|
|
||||||
|
|
||||||
/// Если true, таблица в офлайновом режиме, и в нее нельзя писать.
|
/// Если true, таблица в офлайновом режиме, и в нее нельзя писать.
|
||||||
bool is_readonly = false;
|
bool is_readonly = false;
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#include <DB/Interpreters/InterpreterSelectQuery.h>
|
#include <DB/Interpreters/InterpreterSelectQuery.h>
|
||||||
#include <DB/Storages/StorageView.h>
|
#include <DB/Storages/StorageView.h>
|
||||||
#include <DB/Storages/StorageReplicatedMergeTree.h>
|
|
||||||
#include <DB/TableFunctions/ITableFunction.h>
|
#include <DB/TableFunctions/ITableFunction.h>
|
||||||
#include <DB/TableFunctions/TableFunctionFactory.h>
|
#include <DB/TableFunctions/TableFunctionFactory.h>
|
||||||
|
|
||||||
@ -105,12 +104,6 @@ void InterpreterSelectQuery::basicInit(BlockInputStreamPtr input_, const NamesAn
|
|||||||
+ " does not support parallel execution on several replicas",
|
+ " does not support parallel execution on several replicas",
|
||||||
ErrorCodes::STORAGE_DOESNT_SUPPORT_PARALLEL_REPLICAS);
|
ErrorCodes::STORAGE_DOESNT_SUPPORT_PARALLEL_REPLICAS);
|
||||||
|
|
||||||
if (StorageReplicatedMergeTree * storage_replicated_merge_tree = typeid_cast<StorageReplicatedMergeTree *>(&*storage))
|
|
||||||
{
|
|
||||||
if (settings.parallel_replica_offset > 0)
|
|
||||||
storage_replicated_merge_tree->skipUnreplicated();
|
|
||||||
}
|
|
||||||
|
|
||||||
table_lock = storage->lockStructure(false);
|
table_lock = storage->lockStructure(false);
|
||||||
if (table_column_names.empty())
|
if (table_column_names.empty())
|
||||||
context.setColumns(storage->getColumnsListNonMaterialized());
|
context.setColumns(storage->getColumnsListNonMaterialized());
|
||||||
|
@ -2027,7 +2027,7 @@ BlockInputStreams StorageReplicatedMergeTree::read(
|
|||||||
|
|
||||||
size_t part_index = 0;
|
size_t part_index = 0;
|
||||||
|
|
||||||
if (process_unreplicated && unreplicated_reader && values.count(0))
|
if ((settings.parallel_replica_offset == 0) && unreplicated_reader && values.count(0))
|
||||||
{
|
{
|
||||||
res = unreplicated_reader->read(real_column_names, query,
|
res = unreplicated_reader->read(real_column_names, query,
|
||||||
context, settings, processed_stage,
|
context, settings, processed_stage,
|
||||||
|
@ -3,48 +3,3 @@
|
|||||||
3 2015-03-01 3 foo
|
3 2015-03-01 3 foo
|
||||||
4 2015-04-01 4 bar
|
4 2015-04-01 4 bar
|
||||||
5 2015-05-01 5 foo
|
5 2015-05-01 5 foo
|
||||||
6 2015-06-01 6 bar
|
|
||||||
7 2015-07-01 7 foo
|
|
||||||
8 2015-08-01 8 bar
|
|
||||||
9 2015-09-01 9 foo
|
|
||||||
10 2015-10-01 10 bar
|
|
||||||
11 2015-11-01 1 foo
|
|
||||||
12 2015-12-01 2 bar
|
|
||||||
13 2015-01-01 3 foo
|
|
||||||
14 2015-02-01 4 bar
|
|
||||||
15 2015-03-01 5 foo
|
|
||||||
16 2015-04-01 6 bar
|
|
||||||
17 2015-05-01 7 foo
|
|
||||||
18 2015-06-01 8 bar
|
|
||||||
19 2015-07-01 9 foo
|
|
||||||
20 2015-08-01 10 bar
|
|
||||||
21 2015-09-01 1 foo
|
|
||||||
22 2015-10-01 2 bar
|
|
||||||
23 2015-11-01 3 foo
|
|
||||||
24 2015-12-01 4 bar
|
|
||||||
25 2015-01-01 5 foo
|
|
||||||
26 2015-02-01 6 bar
|
|
||||||
27 2015-03-01 7 foo
|
|
||||||
28 2015-04-01 8 bar
|
|
||||||
29 2015-05-01 9 foo
|
|
||||||
30 2015-06-01 10 bar
|
|
||||||
31 2015-07-01 1 foo
|
|
||||||
32 2015-08-01 2 bar
|
|
||||||
33 2015-09-01 3 foo
|
|
||||||
34 2015-10-01 4 bar
|
|
||||||
35 2015-11-01 5 foo
|
|
||||||
36 2015-12-01 6 bar
|
|
||||||
37 2015-01-01 7 foo
|
|
||||||
38 2015-02-01 8 bar
|
|
||||||
39 2015-03-01 9 foo
|
|
||||||
40 2015-04-01 10 bar
|
|
||||||
41 2015-05-01 1 foo
|
|
||||||
42 2015-06-01 2 bar
|
|
||||||
43 2015-07-01 3 foo
|
|
||||||
44 2015-08-01 4 bar
|
|
||||||
45 2015-09-01 5 foo
|
|
||||||
46 2015-10-01 6 bar
|
|
||||||
47 2015-11-01 7 foo
|
|
||||||
48 2015-12-01 8 bar
|
|
||||||
49 2015-01-01 9 foo
|
|
||||||
50 2015-02-01 10 bar
|
|
||||||
|
@ -4,57 +4,7 @@ DROP TABLE IF EXISTS test.report;
|
|||||||
|
|
||||||
CREATE TABLE test.report(id UInt32, event_date Date, priority UInt32, description String) ENGINE = MergeTree(event_date, intHash32(id), (id, event_date, intHash32(id)), 8192);
|
CREATE TABLE test.report(id UInt32, event_date Date, priority UInt32, description String) ENGINE = MergeTree(event_date, intHash32(id), (id, event_date, intHash32(id)), 8192);
|
||||||
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(1, '2015-01-01', 1, 'foo');
|
INSERT INTO test.report(id,event_date,priority,description) VALUES (1, '2015-01-01', 1, 'foo')(2, '2015-02-01', 2, 'bar')(3, '2015-03-01', 3, 'foo')(4, '2015-04-01', 4, 'bar')(5, '2015-05-01', 5, 'foo');
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(2, '2015-02-01', 2, 'bar');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(3, '2015-03-01', 3, 'foo');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(4, '2015-04-01', 4, 'bar');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(5, '2015-05-01', 5, 'foo');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(6, '2015-06-01', 6, 'bar');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(7, '2015-07-01', 7, 'foo');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(8, '2015-08-01', 8, 'bar');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(9, '2015-09-01', 9, 'foo');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(10, '2015-10-01', 10, 'bar');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(11, '2015-11-01', 1, 'foo');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(12, '2015-12-01', 2, 'bar');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(13, '2015-01-01', 3, 'foo');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(14, '2015-02-01', 4, 'bar');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(15, '2015-03-01', 5, 'foo');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(16, '2015-04-01', 6, 'bar');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(17, '2015-05-01', 7, 'foo');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(18, '2015-06-01', 8, 'bar');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(19, '2015-07-01', 9, 'foo');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(20, '2015-08-01', 10, 'bar');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(21, '2015-09-01', 1, 'foo');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(22, '2015-10-01', 2, 'bar');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(23, '2015-11-01', 3, 'foo');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(24, '2015-12-01', 4, 'bar');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(25, '2015-01-01', 5, 'foo');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(26, '2015-02-01', 6, 'bar');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(27, '2015-03-01', 7, 'foo');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(28, '2015-04-01', 8, 'bar');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(29, '2015-05-01', 9, 'foo');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(30, '2015-06-01', 10, 'bar');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(31, '2015-07-01', 1, 'foo');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(32, '2015-08-01', 2, 'bar');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(33, '2015-09-01', 3, 'foo');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(34, '2015-10-01', 4, 'bar');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(35, '2015-11-01', 5, 'foo');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(36, '2015-12-01', 6, 'bar');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(37, '2015-01-01', 7, 'foo');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(38, '2015-02-01', 8, 'bar');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(39, '2015-03-01', 9, 'foo');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(40, '2015-04-01', 10, 'bar');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(41, '2015-05-01', 1, 'foo');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(42, '2015-06-01', 2, 'bar');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(43, '2015-07-01', 3, 'foo');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(44, '2015-08-01', 4, 'bar');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(45, '2015-09-01', 5, 'foo');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(46, '2015-10-01', 6, 'bar');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(47, '2015-11-01', 7, 'foo');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(48, '2015-12-01', 8, 'bar');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(49, '2015-01-01', 9, 'foo');
|
|
||||||
INSERT INTO test.report(id,event_date,priority,description) VALUES(50, '2015-02-01', 10, 'bar');
|
|
||||||
|
|
||||||
SELECT * FROM (SELECT id, event_date, priority, description FROM remote('127.0.0.{1|2}', test, report)) ORDER BY id ASC;
|
SELECT * FROM (SELECT id, event_date, priority, description FROM remote('127.0.0.{1|2}', test, report)) ORDER BY id ASC;
|
||||||
|
|
||||||
DROP TABLE test.report;
|
DROP TABLE test.report;
|
||||||
|
Loading…
Reference in New Issue
Block a user