mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
Merge pull request #68326 from canhld94/fix_sync_replica_format
Fix missing sync replica mode in query `SYSTEM SYNC REPLICA`
This commit is contained in:
commit
014c1650f8
@ -198,6 +198,29 @@ void ASTSystemQuery::formatImpl(const FormatSettings & settings, FormatState & s
|
||||
print_database_table();
|
||||
}
|
||||
|
||||
if (sync_replica_mode != SyncReplicaMode::DEFAULT)
|
||||
{
|
||||
settings.ostr << ' ';
|
||||
print_keyword(magic_enum::enum_name(sync_replica_mode));
|
||||
|
||||
// If the mode is LIGHTWEIGHT and specific source replicas are specified
|
||||
if (sync_replica_mode == SyncReplicaMode::LIGHTWEIGHT && !src_replicas.empty())
|
||||
{
|
||||
settings.ostr << ' ';
|
||||
print_keyword("FROM");
|
||||
settings.ostr << ' ';
|
||||
|
||||
bool first = true;
|
||||
for (const auto & src : src_replicas)
|
||||
{
|
||||
if (!first)
|
||||
settings.ostr << ", ";
|
||||
first = false;
|
||||
settings.ostr << quoteString(src);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (query_settings)
|
||||
{
|
||||
settings.ostr << (settings.hilite ? hilite_keyword : "") << settings.nl_or_ws << "SETTINGS " << (settings.hilite ? hilite_none : "");
|
||||
@ -233,28 +256,6 @@ void ASTSystemQuery::formatImpl(const FormatSettings & settings, FormatState & s
|
||||
print_identifier(disk);
|
||||
}
|
||||
|
||||
if (sync_replica_mode != SyncReplicaMode::DEFAULT)
|
||||
{
|
||||
settings.ostr << ' ';
|
||||
print_keyword(magic_enum::enum_name(sync_replica_mode));
|
||||
|
||||
// If the mode is LIGHTWEIGHT and specific source replicas are specified
|
||||
if (sync_replica_mode == SyncReplicaMode::LIGHTWEIGHT && !src_replicas.empty())
|
||||
{
|
||||
settings.ostr << ' ';
|
||||
print_keyword("FROM");
|
||||
settings.ostr << ' ';
|
||||
|
||||
bool first = true;
|
||||
for (const auto & src : src_replicas)
|
||||
{
|
||||
if (!first)
|
||||
settings.ostr << ", ";
|
||||
first = false;
|
||||
settings.ostr << quoteString(src);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Type::SYNC_DATABASE_REPLICA:
|
||||
|
@ -0,0 +1 @@
|
||||
SYSTEM SYNC REPLICA db.`table` LIGHTWEIGHT
|
@ -0,0 +1 @@
|
||||
SELECT formatQuery('SYSTEM SYNC REPLICA db.table LIGHTWEIGHT');
|
Loading…
Reference in New Issue
Block a user