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;
}
EnsureSequentialModeMetadataOperations();
EnsureNoModificationsHaveBeenDone();
Assert(ShouldPropagate());
List *commandList = SyncDistributedObjectsCommandList(workerNode);

View File

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

View File

@ -468,9 +468,7 @@ BEGIN;
(1 row)
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
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';"
ERROR: cannot open new connections after the first modification command within a transaction
ROLLBACK;
-- this is safe because start_metadata_sync_to_node already switches to
-- sequential execution
@ -507,9 +505,7 @@ BEGIN;
(1 row)
ROLLBACK;
-- multi-shard commands are allowed with start_metadata_sync
-- as long as the start_metadata_sync_to_node executed
-- when it is OK to switch to sequential execution
-- multi-shard commands are not allowed with start_metadata_sync
BEGIN;
-- sync at the start of the tx
SELECT start_metadata_sync_to_node('localhost', :worker_1_port);
@ -543,15 +539,9 @@ BEGIN;
-- sync at the end of the tx
SELECT start_metadata_sync_to_node('localhost', :worker_1_port);
start_metadata_sync_to_node
---------------------------------------------------------------------
(1 row)
ERROR: cannot open new connections after the first modification command within a transaction
ROLLBACK;
-- multi-shard commands are allowed with start_metadata_sync
-- as long as the start_metadata_sync_to_node executed
-- when it is OK to switch to sequential execution
-- multi-shard commands are not allowed with start_metadata_sync
BEGIN;
-- sync at the start of the tx
SELECT start_metadata_sync_to_node('localhost', :worker_1_port);
@ -586,11 +576,7 @@ BEGIN;
-- sync at the end of the tx
SELECT start_metadata_sync_to_node('localhost', :worker_1_port);
start_metadata_sync_to_node
---------------------------------------------------------------------
(1 row)
ERROR: cannot open new connections after the first modification command within a transaction
ROLLBACK;
-- cleanup
\c - - - :master_port

View File

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