Make sure no modification done instead seq one

velioglu/temp_two_pro
Burak Velioglu 2022-01-28 18:13:07 +03:00
parent 0df3292211
commit f9ff59c6ba
No known key found for this signature in database
GPG Key ID: F6827E620F6549C6
4 changed files with 11 additions and 41 deletions

View File

@ -787,7 +787,7 @@ SyncDistributedObjectsToNode(WorkerNode *workerNode)
return; return;
} }
EnsureSequentialModeMetadataOperations(); EnsureNoModificationsHaveBeenDone();
Assert(ShouldPropagate()); Assert(ShouldPropagate());
List *commandList = SyncDistributedObjectsCommandList(workerNode); List *commandList = SyncDistributedObjectsCommandList(workerNode);

View File

@ -464,11 +464,7 @@ SELECT create_reference_table('replicate_reference_table_insert');
BEGIN; BEGIN;
INSERT INTO replicate_reference_table_insert VALUES(1); INSERT INTO replicate_reference_table_insert VALUES(1);
SELECT 1 FROM master_add_node('localhost', :worker_2_port); SELECT 1 FROM master_add_node('localhost', :worker_2_port);
?column? ERROR: cannot open new connections after the first modification command within a transaction
---------------------------------------------------------------------
1
(1 row)
ROLLBACK; ROLLBACK;
DROP TABLE replicate_reference_table_insert; DROP TABLE replicate_reference_table_insert;
-- test COPY then adding a new node in a transaction -- test COPY then adding a new node in a transaction
@ -483,11 +479,7 @@ SET citus.enable_local_execution = 'off';
BEGIN; BEGIN;
COPY replicate_reference_table_copy FROM STDIN; COPY replicate_reference_table_copy FROM STDIN;
SELECT 1 FROM master_add_node('localhost', :worker_2_port); SELECT 1 FROM master_add_node('localhost', :worker_2_port);
?column? ERROR: cannot open new connections after the first modification command within a transaction
---------------------------------------------------------------------
1
(1 row)
ROLLBACK; ROLLBACK;
RESET citus.enable_local_execution; RESET citus.enable_local_execution;
DROP TABLE replicate_reference_table_copy; DROP TABLE replicate_reference_table_copy;
@ -502,11 +494,7 @@ SELECT create_reference_table('replicate_reference_table_ddl');
BEGIN; BEGIN;
ALTER TABLE replicate_reference_table_ddl ADD column2 int; ALTER TABLE replicate_reference_table_ddl ADD column2 int;
SELECT 1 FROM master_add_node('localhost', :worker_2_port); SELECT 1 FROM master_add_node('localhost', :worker_2_port);
?column? ERROR: cannot open new connections after the first modification command within a transaction
---------------------------------------------------------------------
1
(1 row)
ROLLBACK; ROLLBACK;
DROP TABLE replicate_reference_table_ddl; DROP TABLE replicate_reference_table_ddl;
-- test DROP table after adding new node in a transaction -- test DROP table after adding new node in a transaction

View File

@ -468,9 +468,7 @@ BEGIN;
(1 row) (1 row)
SELECT start_metadata_sync_to_node('localhost', :worker_1_port); SELECT start_metadata_sync_to_node('localhost', :worker_1_port);
ERROR: cannot execute metadata syncing operation because there was a parallel operation on a distributed table in the transaction ERROR: cannot open new connections after the first modification command within a transaction
DETAIL: When modifying metadata, Citus needs to perform all operations over a single connection per node to ensure consistency.
HINT: Try re-running the transaction with "SET LOCAL citus.multi_shard_modify_mode TO 'sequential';"
ROLLBACK; ROLLBACK;
-- this is safe because start_metadata_sync_to_node already switches to -- this is safe because start_metadata_sync_to_node already switches to
-- sequential execution -- sequential execution
@ -507,9 +505,7 @@ BEGIN;
(1 row) (1 row)
ROLLBACK; ROLLBACK;
-- multi-shard commands are allowed with start_metadata_sync -- multi-shard commands are not allowed with start_metadata_sync
-- as long as the start_metadata_sync_to_node executed
-- when it is OK to switch to sequential execution
BEGIN; BEGIN;
-- sync at the start of the tx -- sync at the start of the tx
SELECT start_metadata_sync_to_node('localhost', :worker_1_port); SELECT start_metadata_sync_to_node('localhost', :worker_1_port);
@ -543,15 +539,9 @@ BEGIN;
-- sync at the end of the tx -- sync at the end of the tx
SELECT start_metadata_sync_to_node('localhost', :worker_1_port); SELECT start_metadata_sync_to_node('localhost', :worker_1_port);
start_metadata_sync_to_node ERROR: cannot open new connections after the first modification command within a transaction
---------------------------------------------------------------------
(1 row)
ROLLBACK; ROLLBACK;
-- multi-shard commands are allowed with start_metadata_sync -- multi-shard commands are not allowed with start_metadata_sync
-- as long as the start_metadata_sync_to_node executed
-- when it is OK to switch to sequential execution
BEGIN; BEGIN;
-- sync at the start of the tx -- sync at the start of the tx
SELECT start_metadata_sync_to_node('localhost', :worker_1_port); SELECT start_metadata_sync_to_node('localhost', :worker_1_port);
@ -586,11 +576,7 @@ BEGIN;
-- sync at the end of the tx -- sync at the end of the tx
SELECT start_metadata_sync_to_node('localhost', :worker_1_port); SELECT start_metadata_sync_to_node('localhost', :worker_1_port);
start_metadata_sync_to_node ERROR: cannot open new connections after the first modification command within a transaction
---------------------------------------------------------------------
(1 row)
ROLLBACK; ROLLBACK;
-- cleanup -- cleanup
\c - - - :master_port \c - - - :master_port

View File

@ -244,9 +244,7 @@ BEGIN;
SELECT create_distributed_table('test_table_rep', 'a'); SELECT create_distributed_table('test_table_rep', 'a');
ROLLBACK; ROLLBACK;
-- multi-shard commands are allowed with start_metadata_sync -- multi-shard commands are not allowed with start_metadata_sync
-- as long as the start_metadata_sync_to_node executed
-- when it is OK to switch to sequential execution
BEGIN; BEGIN;
-- sync at the start of the tx -- sync at the start of the tx
SELECT start_metadata_sync_to_node('localhost', :worker_1_port); SELECT start_metadata_sync_to_node('localhost', :worker_1_port);
@ -262,9 +260,7 @@ BEGIN;
SELECT start_metadata_sync_to_node('localhost', :worker_1_port); SELECT start_metadata_sync_to_node('localhost', :worker_1_port);
ROLLBACK; ROLLBACK;
-- multi-shard commands are allowed with start_metadata_sync -- multi-shard commands are not allowed with start_metadata_sync
-- as long as the start_metadata_sync_to_node executed
-- when it is OK to switch to sequential execution
BEGIN; BEGIN;
-- sync at the start of the tx -- sync at the start of the tx
SELECT start_metadata_sync_to_node('localhost', :worker_1_port); SELECT start_metadata_sync_to_node('localhost', :worker_1_port);