mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 01:51:59 +00:00
refactor target_table to table for better hemogny
This commit is contained in:
parent
1f5a11b384
commit
d5d8fd7004
@ -101,14 +101,14 @@ void startStopAction(Context & context, ASTSystemQuery & query, StorageActionBlo
|
||||
auto manager = context.getActionLocksManager();
|
||||
manager->cleanExpired();
|
||||
|
||||
if (!query.target_table.empty())
|
||||
if (!query.table.empty())
|
||||
{
|
||||
String database = !query.database.empty() ? query.database : context.getCurrentDatabase();
|
||||
|
||||
if (start)
|
||||
manager->remove(database, query.target_table, action_type);
|
||||
manager->remove(database, query.table, action_type);
|
||||
else
|
||||
manager->add(database, query.target_table, action_type);
|
||||
manager->add(database, query.table, action_type);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -141,7 +141,7 @@ BlockIO InterpreterSystemQuery::execute()
|
||||
system_context.setSetting("profile", context.getSystemProfileName());
|
||||
|
||||
/// Make canonical query for simpler processing
|
||||
if (!query.target_table.empty() && query.database.empty())
|
||||
if (!query.table.empty() && query.database.empty())
|
||||
query.database = context.getCurrentDatabase();
|
||||
|
||||
switch (query.type)
|
||||
@ -237,8 +237,8 @@ BlockIO InterpreterSystemQuery::execute()
|
||||
restartReplicas(system_context);
|
||||
break;
|
||||
case Type::RESTART_REPLICA:
|
||||
if (!tryRestartReplica(query.database, query.target_table, system_context))
|
||||
throw Exception("There is no " + query.database + "." + query.target_table + " replicated table",
|
||||
if (!tryRestartReplica(query.database, query.table, system_context))
|
||||
throw Exception("There is no " + query.database + "." + query.table + " replicated table",
|
||||
ErrorCodes::BAD_ARGUMENTS);
|
||||
break;
|
||||
case Type::FLUSH_LOGS:
|
||||
@ -340,7 +340,7 @@ void InterpreterSystemQuery::restartReplicas(Context & system_context)
|
||||
void InterpreterSystemQuery::syncReplica(ASTSystemQuery & query)
|
||||
{
|
||||
String database_name = !query.database.empty() ? query.database : context.getCurrentDatabase();
|
||||
const String & table_name = query.target_table;
|
||||
const String & table_name = query.table;
|
||||
|
||||
StoragePtr table = context.getTable(database_name, table_name);
|
||||
|
||||
@ -363,7 +363,7 @@ void InterpreterSystemQuery::syncReplica(ASTSystemQuery & query)
|
||||
void InterpreterSystemQuery::flushDistributed(ASTSystemQuery & query)
|
||||
{
|
||||
String database_name = !query.database.empty() ? query.database : context.getCurrentDatabase();
|
||||
String & table_name = query.target_table;
|
||||
String & table_name = query.table;
|
||||
|
||||
if (auto storage_distributed = dynamic_cast<StorageDistributed *>(context.getTable(database_name, table_name).get()))
|
||||
storage_distributed->flushClusterNodesAllData();
|
||||
|
@ -103,7 +103,7 @@ void ASTSystemQuery::formatImpl(const FormatSettings & settings, FormatState &,
|
||||
<< (settings.hilite ? hilite_none : "") << ".";
|
||||
}
|
||||
|
||||
settings.ostr << (settings.hilite ? hilite_identifier : "") << backQuoteIfNeed(target_table)
|
||||
settings.ostr << (settings.hilite ? hilite_identifier : "") << backQuoteIfNeed(table)
|
||||
<< (settings.hilite ? hilite_none : "");
|
||||
};
|
||||
|
||||
@ -124,7 +124,7 @@ void ASTSystemQuery::formatImpl(const FormatSettings & settings, FormatState &,
|
||||
|| type == Type::STOP_DISTRIBUTED_SENDS
|
||||
|| type == Type::START_DISTRIBUTED_SENDS)
|
||||
{
|
||||
if (!target_table.empty())
|
||||
if (!table.empty())
|
||||
print_database_table();
|
||||
}
|
||||
else if (type == Type::RESTART_REPLICA || type == Type::SYNC_REPLICA || type == Type::FLUSH_DISTRIBUTED)
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
|
||||
String target_dictionary;
|
||||
String database;
|
||||
String target_table;
|
||||
String table;
|
||||
|
||||
String getID(char) const override { return "SYSTEM query"; }
|
||||
|
||||
|
@ -56,7 +56,7 @@ 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->target_table))
|
||||
if (!parseDatabaseAndTableName(pos, expected, res->database, res->table))
|
||||
return false;
|
||||
break;
|
||||
|
||||
@ -74,7 +74,7 @@ bool ParserSystemQuery::parseImpl(IParser::Pos & pos, ASTPtr & node, Expected &
|
||||
case Type::START_REPLICATION_QUEUES:
|
||||
case Type::STOP_DISTRIBUTED_SENDS:
|
||||
case Type::START_DISTRIBUTED_SENDS:
|
||||
parseDatabaseAndTableName(pos, expected, res->database, res->target_table);
|
||||
parseDatabaseAndTableName(pos, expected, res->database, res->table);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user