From 4b36938f2823b1b360cbae87ee55a29e64109349 Mon Sep 17 00:00:00 2001 From: Onur Tirtir Date: Sat, 15 Feb 2020 00:35:13 +0300 Subject: [PATCH] update existing tests --- .../expected/coordinator_shouldhaveshards.out | 5 +- .../expected/local_shard_execution.out | 47 ++++++++++++++++--- .../expected/multi_mx_add_coordinator.out | 1 + .../multi_mx_truncate_from_worker.out | 6 +++ ...licate_reference_tables_to_coordinator.out | 1 + .../regress/sql/local_shard_execution.sql | 5 +- 6 files changed, 53 insertions(+), 12 deletions(-) diff --git a/src/test/regress/expected/coordinator_shouldhaveshards.out b/src/test/regress/expected/coordinator_shouldhaveshards.out index 54571f077..0af6f175a 100644 --- a/src/test/regress/expected/coordinator_shouldhaveshards.out +++ b/src/test/regress/expected/coordinator_shouldhaveshards.out @@ -107,9 +107,8 @@ NOTICE: executing the command locally: SELECT y FROM coordinator_shouldhaveshar (1 row) ALTER TABLE test DROP COLUMN z; -ERROR: cannot execute command because a local execution has accessed a placement in the transaction -DETAIL: Some parallel commands cannot be executed if a previous command has already been executed locally -HINT: Try re-running the transaction with "SET LOCAL citus.enable_local_execution TO OFF;" +NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (1503000, 'coordinator_shouldhaveshards', 'ALTER TABLE test DROP COLUMN z;') +NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (1503003, 'coordinator_shouldhaveshards', 'ALTER TABLE test DROP COLUMN z;') ROLLBACK; BEGIN; ALTER TABLE test DROP COLUMN z; diff --git a/src/test/regress/expected/local_shard_execution.out b/src/test/regress/expected/local_shard_execution.out index c604a3c76..8537820c6 100644 --- a/src/test/regress/expected/local_shard_execution.out +++ b/src/test/regress/expected/local_shard_execution.out @@ -362,8 +362,7 @@ COPY second_distributed_table FROM STDIN WITH CSV; -- (a) Unless the first query is a local query, always use distributed execution. -- (b) If the executor has used local execution, it has to use local execution -- for the remaining of the transaction block. If that's not possible, the - -- executor has to error out (e.g., TRUNCATE is a utility command and we - -- currently do not support local execution of utility commands) + -- executor has to error out -- rollback should be able to rollback local execution BEGIN; INSERT INTO distributed_table VALUES (1, '11',21) ON CONFLICT(key) DO UPDATE SET value = '29' RETURNING *; @@ -592,7 +591,7 @@ NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shar (1 row) ROLLBACK; --- a local query is followed by a command that cannot be executed locally +-- a local query followed by TRUNCATE command can be executed locally BEGIN; SELECT count(*) FROM distributed_table WHERE key = 1; NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shard_execution.distributed_table_1470001 distributed_table WHERE (key OPERATOR(pg_catalog.=) 1) @@ -603,9 +602,12 @@ NOTICE: executing the command locally: SELECT count(*) AS count FROM local_shar TRUNCATE distributed_table CASCADE; NOTICE: truncate cascades to table "second_distributed_table" -ERROR: cannot execute command because a local execution has accessed a placement in the transaction -DETAIL: Some parallel commands cannot be executed if a previous command has already been executed locally -HINT: Try re-running the transaction with "SET LOCAL citus.enable_local_execution TO OFF;" +NOTICE: executing the command locally: TRUNCATE TABLE local_shard_execution.distributed_table_1470001 CASCADE +NOTICE: truncate cascades to table "second_distributed_table_1470005" +NOTICE: executing the command locally: TRUNCATE TABLE local_shard_execution.distributed_table_1470003 CASCADE +NOTICE: truncate cascades to table "second_distributed_table_1470007" +NOTICE: executing the command locally: TRUNCATE TABLE local_shard_execution.second_distributed_table_1470005 CASCADE +NOTICE: executing the command locally: TRUNCATE TABLE local_shard_execution.second_distributed_table_1470007 CASCADE ROLLBACK; -- a local query is followed by a command that cannot be executed locally BEGIN; @@ -899,6 +901,17 @@ WHERE -- get ready for the next commands TRUNCATE reference_table, distributed_table, second_distributed_table; +NOTICE: executing the command locally: TRUNCATE TABLE local_shard_execution.reference_table_1470000 CASCADE +NOTICE: truncate cascades to table "distributed_table_1470001" +NOTICE: truncate cascades to table "distributed_table_1470003" +NOTICE: truncate cascades to table "second_distributed_table_1470005" +NOTICE: truncate cascades to table "second_distributed_table_1470007" +NOTICE: executing the command locally: TRUNCATE TABLE local_shard_execution.distributed_table_1470001 CASCADE +NOTICE: truncate cascades to table "second_distributed_table_1470005" +NOTICE: executing the command locally: TRUNCATE TABLE local_shard_execution.distributed_table_1470003 CASCADE +NOTICE: truncate cascades to table "second_distributed_table_1470007" +NOTICE: executing the command locally: TRUNCATE TABLE local_shard_execution.second_distributed_table_1470005 CASCADE +NOTICE: executing the command locally: TRUNCATE TABLE local_shard_execution.second_distributed_table_1470007 CASCADE -- local execution of returning of reference tables INSERT INTO reference_table VALUES (1),(2),(3),(4),(5),(6) RETURNING *; NOTICE: executing the command locally: INSERT INTO local_shard_execution.reference_table_1470000 AS citus_table_alias (key) VALUES (1), (2), (3), (4), (5), (6) RETURNING citus_table_alias.key @@ -1324,6 +1337,17 @@ ROLLBACK; TRUNCATE reference_table CASCADE; NOTICE: truncate cascades to table "distributed_table" NOTICE: truncate cascades to table "second_distributed_table" +NOTICE: executing the command locally: TRUNCATE TABLE local_shard_execution.reference_table_1470000 CASCADE +NOTICE: truncate cascades to table "distributed_table_1470001" +NOTICE: truncate cascades to table "distributed_table_1470003" +NOTICE: truncate cascades to table "second_distributed_table_1470005" +NOTICE: truncate cascades to table "second_distributed_table_1470007" +NOTICE: executing the command locally: TRUNCATE TABLE local_shard_execution.distributed_table_1470001 CASCADE +NOTICE: truncate cascades to table "second_distributed_table_1470005" +NOTICE: executing the command locally: TRUNCATE TABLE local_shard_execution.distributed_table_1470003 CASCADE +NOTICE: truncate cascades to table "second_distributed_table_1470007" +NOTICE: executing the command locally: TRUNCATE TABLE local_shard_execution.second_distributed_table_1470005 CASCADE +NOTICE: executing the command locally: TRUNCATE TABLE local_shard_execution.second_distributed_table_1470007 CASCADE INSERT INTO reference_table SELECT i FROM generate_series(500, 600) i; INSERT INTO distributed_table SELECT i, i::text, i % 10 + 25 FROM generate_series(500, 600) i; -- show that both local, and mixed local-distributed executions @@ -1593,6 +1617,17 @@ COMMIT; TRUNCATE reference_table CASCADE; NOTICE: truncate cascades to table "distributed_table" NOTICE: truncate cascades to table "second_distributed_table" +NOTICE: executing the command locally: TRUNCATE TABLE local_shard_execution.reference_table_1470000 CASCADE +NOTICE: truncate cascades to table "distributed_table_1470001" +NOTICE: truncate cascades to table "distributed_table_1470003" +NOTICE: truncate cascades to table "second_distributed_table_1470005" +NOTICE: truncate cascades to table "second_distributed_table_1470007" +NOTICE: executing the command locally: TRUNCATE TABLE local_shard_execution.distributed_table_1470001 CASCADE +NOTICE: truncate cascades to table "second_distributed_table_1470005" +NOTICE: executing the command locally: TRUNCATE TABLE local_shard_execution.distributed_table_1470003 CASCADE +NOTICE: truncate cascades to table "second_distributed_table_1470007" +NOTICE: executing the command locally: TRUNCATE TABLE local_shard_execution.second_distributed_table_1470005 CASCADE +NOTICE: executing the command locally: TRUNCATE TABLE local_shard_execution.second_distributed_table_1470007 CASCADE -- load some data on a remote shard INSERT INTO reference_table (key) VALUES (2); NOTICE: executing the command locally: INSERT INTO local_shard_execution.reference_table_1470000 (key) VALUES (2) diff --git a/src/test/regress/expected/multi_mx_add_coordinator.out b/src/test/regress/expected/multi_mx_add_coordinator.out index 8f2d99482..28d47c84d 100644 --- a/src/test/regress/expected/multi_mx_add_coordinator.out +++ b/src/test/regress/expected/multi_mx_add_coordinator.out @@ -129,6 +129,7 @@ DEBUG: Plan is router executable NOTICE: executing the command locally: INSERT INTO mx_add_coordinator.ref_7000000 (a) VALUES (1) -- get it ready for the next executions TRUNCATE ref; +NOTICE: executing the command locally: TRUNCATE TABLE mx_add_coordinator.ref_7000000 CASCADE -- test that changes from a metadata node is reflected in the coordinator placement \c - - - :worker_1_port SET search_path TO mx_add_coordinator,public; diff --git a/src/test/regress/expected/multi_mx_truncate_from_worker.out b/src/test/regress/expected/multi_mx_truncate_from_worker.out index dc255f01c..abb59b761 100644 --- a/src/test/regress/expected/multi_mx_truncate_from_worker.out +++ b/src/test/regress/expected/multi_mx_truncate_from_worker.out @@ -76,6 +76,9 @@ INSERT INTO on_update_fkey_table SELECT i, i % 100 FROM generate_series(0, 1000 -- now, show that TRUNCATE CASCADE works expected from the worker TRUNCATE "refer'ence_table" CASCADE; NOTICE: truncate cascades to table "on_update_fkey_table" +NOTICE: truncate cascades to table "on_update_fkey_table_xxxxxxx" +NOTICE: truncate cascades to table "on_update_fkey_table_xxxxxxx" +NOTICE: truncate cascades to table "on_update_fkey_table_xxxxxxx" SELECT count(*) FROM on_update_fkey_table; count --------------------------------------------------------------------- @@ -96,6 +99,9 @@ ROLLBACK; BEGIN; TRUNCATE "refer'ence_table" CASCADE; NOTICE: truncate cascades to table "on_update_fkey_table" +NOTICE: truncate cascades to table "on_update_fkey_table_xxxxxxx" +NOTICE: truncate cascades to table "on_update_fkey_table_xxxxxxx" +NOTICE: truncate cascades to table "on_update_fkey_table_xxxxxxx" ROLLBACK; -- test with sequential mode and CASCADE BEGIN; diff --git a/src/test/regress/expected/replicate_reference_tables_to_coordinator.out b/src/test/regress/expected/replicate_reference_tables_to_coordinator.out index aae9ad9cc..c0292606c 100644 --- a/src/test/regress/expected/replicate_reference_tables_to_coordinator.out +++ b/src/test/regress/expected/replicate_reference_tables_to_coordinator.out @@ -344,6 +344,7 @@ $Q$); -- verify that we can drop columns from reference tables replicated to the coordinator -- see https://github.com/citusdata/citus/issues/3279 ALTER TABLE squares DROP COLUMN b; +NOTICE: executing the command locally: SELECT worker_apply_shard_ddl_command (8000000, 'replicate_ref_to_coordinator', 'ALTER TABLE squares DROP COLUMN b;') -- clean-up SET client_min_messages TO ERROR; DROP SCHEMA replicate_ref_to_coordinator CASCADE; diff --git a/src/test/regress/sql/local_shard_execution.sql b/src/test/regress/sql/local_shard_execution.sql index 78505463c..b5ba49caa 100644 --- a/src/test/regress/sql/local_shard_execution.sql +++ b/src/test/regress/sql/local_shard_execution.sql @@ -234,8 +234,7 @@ COPY second_distributed_table FROM STDIN WITH CSV; -- (a) Unless the first query is a local query, always use distributed execution. -- (b) If the executor has used local execution, it has to use local execution -- for the remaining of the transaction block. If that's not possible, the - -- executor has to error out (e.g., TRUNCATE is a utility command and we - -- currently do not support local execution of utility commands) + -- executor has to error out -- rollback should be able to rollback local execution BEGIN; @@ -347,7 +346,7 @@ BEGIN; SELECT count(*) FROM distributed_table WHERE key = 500; ROLLBACK; --- a local query is followed by a command that cannot be executed locally +-- a local query followed by TRUNCATE command can be executed locally BEGIN; SELECT count(*) FROM distributed_table WHERE key = 1; TRUNCATE distributed_table CASCADE;