update existing tests

improve-drop-trigger2
Onur Tirtir 2020-02-15 00:35:13 +03:00
parent 4042d21714
commit 4b36938f28
6 changed files with 53 additions and 12 deletions

View File

@ -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;

View File

@ -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)

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;