This commit is contained in:
Christoph Wurm 2024-11-01 11:06:49 +00:00
parent 9015454b37
commit 7691b7dd44
2 changed files with 14 additions and 20 deletions

View File

@ -27,6 +27,9 @@ REPLICATED_POSTPONE_MUTATION_LOG = (
POSTPONE_MUTATION_LOG = (
"According to exponential backoff policy, do not perform mutations for the part"
)
FAILING_MUTATION_QUERY = (
"ALTER TABLE test_mutations DELETE WHERE x IN (SELECT throwIf(1))"
)
all_nodes = [node_with_backoff, node_no_backoff]
@ -83,17 +86,13 @@ def test_exponential_backoff_with_merge_tree(started_cluster, node, found_in_log
assert not node.contains_in_log(POSTPONE_MUTATION_LOG)
# Executing incorrect mutation.
node.query(
"ALTER TABLE test_mutations DELETE WHERE x IN (SELECT x FROM notexist_table) SETTINGS allow_nondeterministic_mutations=1"
)
node.query(FAILING_MUTATION_QUERY)
check_logs()
node.query("KILL MUTATION WHERE table='test_mutations'")
# Check that after kill new parts mutations are postponing.
node.query(
"ALTER TABLE test_mutations DELETE WHERE x IN (SELECT x FROM notexist_table) SETTINGS allow_nondeterministic_mutations=1"
)
node.query(FAILING_MUTATION_QUERY)
check_logs()
@ -101,9 +100,7 @@ def test_exponential_backoff_with_merge_tree(started_cluster, node, found_in_log
def test_exponential_backoff_with_replicated_tree(started_cluster):
prepare_cluster(True)
node_with_backoff.query(
"ALTER TABLE test_mutations DELETE WHERE x IN (SELECT x FROM notexist_table) SETTINGS allow_nondeterministic_mutations=1"
)
node_with_backoff.query(FAILING_MUTATION_QUERY)
assert node_with_backoff.wait_for_log_line(REPLICATED_POSTPONE_MUTATION_LOG)
assert not node_no_backoff.contains_in_log(REPLICATED_POSTPONE_MUTATION_LOG)
@ -114,7 +111,7 @@ def test_exponential_backoff_create_dependent_table(started_cluster):
# Executing incorrect mutation.
node_with_backoff.query(
"ALTER TABLE test_mutations DELETE WHERE x IN (SELECT x FROM dep_table) SETTINGS allow_nondeterministic_mutations=1"
"ALTER TABLE test_mutations DELETE WHERE x IN (SELECT x FROM dep_table) SETTINGS validate_mutation_query = 0"
)
# Creating dependent table for mutation.
@ -148,9 +145,7 @@ def test_exponential_backoff_setting_override(started_cluster):
node.query("INSERT INTO test_mutations SELECT * FROM system.numbers LIMIT 10")
# Executing incorrect mutation.
node.query(
"ALTER TABLE test_mutations DELETE WHERE x IN (SELECT x FROM dep_table) SETTINGS allow_nondeterministic_mutations=1"
)
node.query(FAILING_MUTATION_QUERY)
assert not node.contains_in_log(POSTPONE_MUTATION_LOG)
@ -166,9 +161,7 @@ def test_backoff_clickhouse_restart(started_cluster, replicated_table):
node = node_with_backoff
# Executing incorrect mutation.
node.query(
"ALTER TABLE test_mutations DELETE WHERE x IN (SELECT x FROM dep_table) SETTINGS allow_nondeterministic_mutations=1"
)
node.query(FAILING_MUTATION_QUERY)
assert node.wait_for_log_line(
REPLICATED_POSTPONE_MUTATION_LOG if replicated_table else POSTPONE_MUTATION_LOG
)
@ -193,11 +186,10 @@ def test_no_backoff_after_killing_mutation(started_cluster, replicated_table):
node = node_with_backoff
# Executing incorrect mutation.
node.query(
"ALTER TABLE test_mutations DELETE WHERE x IN (SELECT x FROM dep_table) SETTINGS allow_nondeterministic_mutations=1"
)
node.query(FAILING_MUTATION_QUERY)
# Executing correct mutation.
node.query("ALTER TABLE test_mutations DELETE WHERE x=1")
node.query("ALTER TABLE test_mutations DELETE WHERE x=1")
assert node.wait_for_log_line(
REPLICATED_POSTPONE_MUTATION_LOG if replicated_table else POSTPONE_MUTATION_LOG
)

View File

@ -9,6 +9,8 @@ DELETE FROM t WHERE x IN (SELECT * FROM t2); -- { serverError 60 }
ALTER TABLE t DELETE WHERE x in (SELECT y FROM t); -- { serverError 47 }
ALTER TABLE t UPDATE x = 1 WHERE x IN (SELECT y FROM t); -- { serverError 47 }
DELETE FROM t WHERE x IN (SELECT foo FROM bar) SETTINGS validate_mutation_query = 0;
ALTER TABLE t ADD COLUMN y int;
DELETE FROM t WHERE y in (SELECT y FROM t);