ON CLUSTER support for SYSTEM {FLUSH DISTRIBUTED,STOP/START DISTRIBUTED SEND}

It is pretty logical to have ON CLUSTER for managing Distributed tables.
This commit is contained in:
Azat Khuzhin 2020-06-03 21:51:49 +03:00
parent 9028a25f3c
commit 71d0e60dcb
3 changed files with 34 additions and 3 deletions

View File

@ -59,11 +59,26 @@ bool ParserSystemQuery::parseImpl(IParser::Pos & pos, ASTPtr & node, Expected &
case Type::RESTART_REPLICA:
case Type::SYNC_REPLICA:
case Type::FLUSH_DISTRIBUTED:
if (!parseDatabaseAndTableName(pos, expected, res->database, res->table))
return false;
break;
case Type::STOP_DISTRIBUTED_SENDS:
case Type::START_DISTRIBUTED_SENDS:
case Type::FLUSH_DISTRIBUTED:
{
String cluster_str;
if (ParserKeyword{"ON"}.ignore(pos, expected))
{
if (!ASTQueryWithOnCluster::parse(pos, cluster_str, expected))
return false;
}
res->cluster = cluster_str;
if (!parseDatabaseAndTableName(pos, expected, res->database, res->table))
return false;
break;
}
case Type::STOP_MERGES:
case Type::START_MERGES:
case Type::STOP_TTL_MERGES:
@ -76,8 +91,6 @@ bool ParserSystemQuery::parseImpl(IParser::Pos & pos, ASTPtr & node, Expected &
case Type::START_REPLICATED_SENDS:
case Type::STOP_REPLICATION_QUEUES:
case Type::START_REPLICATION_QUEUES:
case Type::STOP_DISTRIBUTED_SENDS:
case Type::START_DISTRIBUTED_SENDS:
parseDatabaseAndTableName(pos, expected, res->database, res->table);
break;

View File

@ -0,0 +1,3 @@
localhost 9000 0 0 0
localhost 9000 0 0 0
localhost 9000 0 0 0

View File

@ -0,0 +1,15 @@
-- just a smoke test
drop table if exists dist_01294;
create table dist_01294 as system.one engine=Distributed(test_shard_localhost, system, one);
-- flush
system flush distributed dist_01294;
system flush distributed on cluster test_shard_localhost dist_01294;
-- stop
system stop distributed sends dist_01294;
system stop distributed sends on cluster test_shard_localhost dist_01294;
-- start
system start distributed sends dist_01294;
system start distributed sends on cluster test_shard_localhost dist_01294;
drop table dist_01294;