From 8d2cf2dbd1cedd90eab1a170702ea04875adc124 Mon Sep 17 00:00:00 2001 From: Alexey Zatelepin Date: Fri, 30 Nov 2018 20:55:24 +0300 Subject: [PATCH] add failing test #3597 --- ...00652_mutations_default_database.reference | 3 ++ .../00652_mutations_default_database.sh | 29 +++++++++++++++++++ ...tions_default_database_zookeeper.reference | 3 ++ ...ed_mutations_default_database_zookeeper.sh | 29 +++++++++++++++++++ 4 files changed, 64 insertions(+) create mode 100644 dbms/tests/queries/0_stateless/00652_mutations_default_database.reference create mode 100755 dbms/tests/queries/0_stateless/00652_mutations_default_database.sh create mode 100644 dbms/tests/queries/0_stateless/00652_replicated_mutations_default_database_zookeeper.reference create mode 100755 dbms/tests/queries/0_stateless/00652_replicated_mutations_default_database_zookeeper.sh diff --git a/dbms/tests/queries/0_stateless/00652_mutations_default_database.reference b/dbms/tests/queries/0_stateless/00652_mutations_default_database.reference new file mode 100644 index 00000000000..fd844f751f1 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00652_mutations_default_database.reference @@ -0,0 +1,3 @@ +123 1 +234 4 +345 5 diff --git a/dbms/tests/queries/0_stateless/00652_mutations_default_database.sh b/dbms/tests/queries/0_stateless/00652_mutations_default_database.sh new file mode 100755 index 00000000000..bb142201e7c --- /dev/null +++ b/dbms/tests/queries/0_stateless/00652_mutations_default_database.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) +. $CURDIR/../shell_config.sh + +. $CURDIR/mergetree_mutations.lib + +${CLICKHOUSE_CLIENT} --multiquery << EOF +DROP TABLE IF EXISTS test.mutations; +DROP TABLE IF EXISTS test.for_subquery; + +USE test; + +CREATE TABLE mutations(x UInt32, y UInt32) ENGINE MergeTree ORDER BY x; +INSERT INTO mutations VALUES (123, 1), (234, 2), (345, 3); + +CREATE TABLE for_subquery(x UInt32) ENGINE TinyLog; +INSERT INTO for_subquery VALUES (234), (345); + +ALTER TABLE mutations UPDATE y = y + 1 WHERE x IN for_subquery; +ALTER TABLE mutations UPDATE y = y + 1 WHERE x IN (SELECT x FROM for_subquery); +EOF + +wait_for_mutation "mutations" "mutation_3.txt" + +${CLICKHOUSE_CLIENT} --query="SELECT * FROM test.mutations" + +${CLICKHOUSE_CLIENT} --query="DROP TABLE test.mutations" +${CLICKHOUSE_CLIENT} --query="DROP TABLE test.for_subquery" diff --git a/dbms/tests/queries/0_stateless/00652_replicated_mutations_default_database_zookeeper.reference b/dbms/tests/queries/0_stateless/00652_replicated_mutations_default_database_zookeeper.reference new file mode 100644 index 00000000000..fd844f751f1 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00652_replicated_mutations_default_database_zookeeper.reference @@ -0,0 +1,3 @@ +123 1 +234 4 +345 5 diff --git a/dbms/tests/queries/0_stateless/00652_replicated_mutations_default_database_zookeeper.sh b/dbms/tests/queries/0_stateless/00652_replicated_mutations_default_database_zookeeper.sh new file mode 100755 index 00000000000..6d425e35d33 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00652_replicated_mutations_default_database_zookeeper.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) +. $CURDIR/../shell_config.sh + +. $CURDIR/mergetree_mutations.lib + +${CLICKHOUSE_CLIENT} --multiquery << EOF +DROP TABLE IF EXISTS test.mutations_r1; +DROP TABLE IF EXISTS test.for_subquery; + +USE test; + +CREATE TABLE mutations_r1(x UInt32, y UInt32) ENGINE ReplicatedMergeTree('/clickhouse/tables/test/mutations', 'r1') ORDER BY x; +INSERT INTO mutations_r1 VALUES (123, 1), (234, 2), (345, 3); + +CREATE TABLE for_subquery(x UInt32) ENGINE TinyLog; +INSERT INTO for_subquery VALUES (234), (345); + +ALTER TABLE mutations_r1 UPDATE y = y + 1 WHERE x IN for_subquery; +ALTER TABLE mutations_r1 UPDATE y = y + 1 WHERE x IN (SELECT x FROM for_subquery); +EOF + +wait_for_mutation "mutations_r1" "0000000001" + +${CLICKHOUSE_CLIENT} --query="SELECT * FROM test.mutations_r1" + +${CLICKHOUSE_CLIENT} --query="DROP TABLE test.mutations_r1" +${CLICKHOUSE_CLIENT} --query="DROP TABLE test.for_subquery"