dbms: Server: queries with several replicas: development [#METR-14410]

This commit is contained in:
Alexey Arno 2015-01-19 16:13:37 +03:00
parent a2f93f6326
commit 60d4b1209c
3 changed files with 12 additions and 1 deletions

View File

@ -103,6 +103,8 @@ 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(); }
@ -164,6 +166,8 @@ private:
current_zookeeper = zookeeper; current_zookeeper = zookeeper;
} }
bool process_unreplicated = true;
/// Если true, таблица в офлайновом режиме, и в нее нельзя писать. /// Если true, таблица в офлайновом режиме, и в нее нельзя писать.
bool is_readonly = false; bool is_readonly = false;

View File

@ -24,6 +24,7 @@
#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>
@ -103,6 +104,12 @@ 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());

View File

@ -2025,7 +2025,7 @@ BlockInputStreams StorageReplicatedMergeTree::read(
size_t part_index = 0; size_t part_index = 0;
if (unreplicated_reader && values.count(0)) if (process_unreplicated && 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,