mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
Merge pull request #34860 from zhangjmruc/master
Support non-table DDLs on cross replicated cluster
This commit is contained in:
commit
e49521163f
@ -259,13 +259,17 @@ bool DDLTask::tryFindHostInCluster()
|
||||
* */
|
||||
is_circular_replicated = true;
|
||||
auto * query_with_table = dynamic_cast<ASTQueryWithTableAndOutput *>(query.get());
|
||||
if (!query_with_table || !query_with_table->database)
|
||||
|
||||
/// For other DDLs like CREATE USER, there is no database name and should be executed successfully.
|
||||
if (query_with_table)
|
||||
{
|
||||
throw Exception(ErrorCodes::INCONSISTENT_CLUSTER_DEFINITION,
|
||||
"For a distributed DDL on circular replicated cluster its table name must be qualified by database name.");
|
||||
if (!query_with_table->database)
|
||||
throw Exception(ErrorCodes::INCONSISTENT_CLUSTER_DEFINITION,
|
||||
"For a distributed DDL on circular replicated cluster its table name must be qualified by database name.");
|
||||
|
||||
if (default_database == query_with_table->getDatabase())
|
||||
return true;
|
||||
}
|
||||
if (default_database == query_with_table->getDatabase())
|
||||
return true;
|
||||
}
|
||||
}
|
||||
found_exact_match = true;
|
||||
|
@ -104,3 +104,11 @@ def test_atomic_database(started_cluster):
|
||||
node1.query("INSERT INTO replica_1.rmt VALUES (1, 'test')")
|
||||
node2.query("SYSTEM SYNC REPLICA replica_2.rmt", timeout=5)
|
||||
assert_eq_with_retry(node2, "SELECT * FROM replica_2.rmt", '1\ttest')
|
||||
|
||||
def test_non_query_with_table_ddl(started_cluster):
|
||||
node1.query("CREATE USER A ON CLUSTER cross_3shards_2replicas")
|
||||
|
||||
assert node1.query("SELECT 1", user='A') == "1\n"
|
||||
assert node2.query("SELECT 1", user='A') == "1\n"
|
||||
|
||||
node2.query("DROP USER A ON CLUSTER cross_3shards_2replicas")
|
||||
|
Loading…
Reference in New Issue
Block a user