Merge pull request #1746 from citusdata/drop_sequence_fix

Only drop sequences on workers with metadata
pull/1796/head^2
Marco Slot 2017-11-14 16:33:50 +01:00 committed by GitHub
commit ee9d24f77e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 13 deletions

View File

@ -297,8 +297,8 @@ master_drop_sequences(PG_FUNCTION_ARGS)
{
appendStringInfoString(dropSeqCommand, " CASCADE");
SendCommandToWorkers(ALL_WORKERS, DISABLE_DDL_PROPAGATION);
SendCommandToWorkers(ALL_WORKERS, dropSeqCommand->data);
SendCommandToWorkers(WORKERS_WITH_METADATA, DISABLE_DDL_PROPAGATION);
SendCommandToWorkers(WORKERS_WITH_METADATA, dropSeqCommand->data);
}
PG_RETURN_VOID();

View File

@ -1079,15 +1079,8 @@ SELECT nextval('mx_table_with_sequence_c_seq');
562949953421313
(1 row)
-- Check that dropping the mx table with sequences works as expected, even the metadata
-- syncing is stopped to one of the workers
-- Check that dropping the mx table with sequences works as expected
\c - - - :master_port
SELECT stop_metadata_sync_to_node('localhost', :worker_2_port);
stop_metadata_sync_to_node
----------------------------
(1 row)
DROP TABLE mx_table_with_sequence;
\d mx_table_with_sequence
\ds mx_table_with_sequence_b_seq

View File

@ -653,6 +653,29 @@ ORDER BY
(0 rows)
\c - - - :master_port
-- try using the coordinator as a worker and then dropping the table
SELECT master_add_node('localhost', :master_port);
NOTICE: Replicating reference table "transactional_drop_reference" to the node localhost:57636
master_add_node
---------------------------------------------------------------
(1380010,1380008,localhost,57636,default,f,t,primary,default)
(1 row)
CREATE TABLE citus_local (id serial, k int);
SELECT create_distributed_table('citus_local', 'id');
create_distributed_table
--------------------------
(1 row)
INSERT INTO citus_local (k) VALUES (2);
DROP TABLE citus_local;
SELECT master_remove_node('localhost', :master_port);
master_remove_node
--------------------
(1 row)
-- clean the workspace
DROP TABLE transactional_drop_shards, transactional_drop_reference;
SELECT stop_metadata_sync_to_node('localhost', :worker_1_port);

View File

@ -464,10 +464,8 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_table_with_
SELECT nextval('mx_table_with_sequence_b_seq');
SELECT nextval('mx_table_with_sequence_c_seq');
-- Check that dropping the mx table with sequences works as expected, even the metadata
-- syncing is stopped to one of the workers
-- Check that dropping the mx table with sequences works as expected
\c - - - :master_port
SELECT stop_metadata_sync_to_node('localhost', :worker_2_port);
DROP TABLE mx_table_with_sequence;
\d mx_table_with_sequence
\ds mx_table_with_sequence_b_seq

View File

@ -363,6 +363,14 @@ ORDER BY
\c - - - :master_port
-- try using the coordinator as a worker and then dropping the table
SELECT master_add_node('localhost', :master_port);
CREATE TABLE citus_local (id serial, k int);
SELECT create_distributed_table('citus_local', 'id');
INSERT INTO citus_local (k) VALUES (2);
DROP TABLE citus_local;
SELECT master_remove_node('localhost', :master_port);
-- clean the workspace
DROP TABLE transactional_drop_shards, transactional_drop_reference;
SELECT stop_metadata_sync_to_node('localhost', :worker_1_port);