mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
fix flaky test
This commit is contained in:
parent
11f40376ae
commit
6797e7dc76
@ -47,6 +47,7 @@ namespace ErrorCodes
|
||||
extern const int TIMEOUT_EXCEEDED;
|
||||
extern const int UNFINISHED;
|
||||
extern const int NOT_A_LEADER;
|
||||
extern const int TABLE_IS_READ_ONLY;
|
||||
extern const int KEEPER_EXCEPTION;
|
||||
extern const int CANNOT_ASSIGN_ALTER;
|
||||
extern const int CANNOT_ALLOCATE_MEMORY;
|
||||
@ -459,6 +460,7 @@ bool DDLWorker::tryExecuteQuery(const String & query, DDLTaskBase & task, const
|
||||
/// and consider query as executed with status "failed" and return true in other cases.
|
||||
bool no_sense_to_retry = e.code() != ErrorCodes::KEEPER_EXCEPTION &&
|
||||
e.code() != ErrorCodes::NOT_A_LEADER &&
|
||||
e.code() != ErrorCodes::TABLE_IS_READ_ONLY &&
|
||||
e.code() != ErrorCodes::CANNOT_ASSIGN_ALTER &&
|
||||
e.code() != ErrorCodes::CANNOT_ALLOCATE_MEMORY &&
|
||||
e.code() != ErrorCodes::MEMORY_LIMIT_EXCEEDED;
|
||||
|
@ -24,13 +24,17 @@ def started_cluster():
|
||||
|
||||
|
||||
def test_non_leader_replica(started_cluster):
|
||||
node1.query("DROP TABLE IF EXISTS sometable SYNC")
|
||||
node2.query("DROP TABLE IF EXISTS sometable SYNC")
|
||||
node1.query("DROP TABLE IF EXISTS new_table_with_ddl")
|
||||
node2.query("DROP TABLE IF EXISTS new_table_with_ddl")
|
||||
|
||||
node1.query_with_retry(
|
||||
node1.query(
|
||||
"""CREATE TABLE IF NOT EXISTS sometable(id UInt32, value String)
|
||||
ENGINE = ReplicatedMergeTree('/clickhouse/tables/0/sometable', '1') ORDER BY tuple()"""
|
||||
)
|
||||
|
||||
node2.query_with_retry(
|
||||
node2.query(
|
||||
"""CREATE TABLE IF NOT EXISTS sometable(id UInt32, value String)
|
||||
ENGINE = ReplicatedMergeTree('/clickhouse/tables/0/sometable', '2') ORDER BY tuple() SETTINGS replicated_can_become_leader = 0"""
|
||||
)
|
||||
@ -38,7 +42,7 @@ def test_non_leader_replica(started_cluster):
|
||||
node1.query(
|
||||
"INSERT INTO sometable SELECT number, toString(number) FROM numbers(100)"
|
||||
)
|
||||
node2.query_with_retry("SYSTEM SYNC REPLICA sometable", timeout=10)
|
||||
node2.query("SYSTEM SYNC REPLICA sometable")
|
||||
|
||||
assert node1.query("SELECT COUNT() FROM sometable") == "100\n"
|
||||
assert node2.query("SELECT COUNT() FROM sometable") == "100\n"
|
||||
|
Loading…
Reference in New Issue
Block a user