Fix bug while DROPping partitioned table from worker

We recently added partitionin support to Citus MX. We should not execute
DROP table commands from MX workers but at the moment we try to execute
such commands for partitioned tables. This PR fixes that problem by
adding check.
pull/2088/head
Burak Yucesoy 2018-04-09 09:56:46 +03:00
parent 0699fbe281
commit b33b282030
4 changed files with 12 additions and 0 deletions

View File

@ -3813,6 +3813,8 @@ ProcessDropTableStmt(DropStmt *dropTableStatement)
continue;
}
EnsureCoordinator();
partitionList = PartitionList(relationId);
if (list_length(partitionList) == 0)
{

View File

@ -241,6 +241,10 @@ SELECT inhrelid::regclass FROM pg_inherits WHERE inhparent = 'partitioning_test'
partitioning_test_2013
(4 rows)
-- make sure DROPping from worker node is not allowed
DROP TABLE partitioning_test;
ERROR: operation is not allowed on this node
HINT: Connect to the coordinator and run it again.
\c - - - :master_port
-- make sure we can repeatedly call start_metadata_sync_to_node
SELECT start_metadata_sync_to_node('localhost', :worker_1_port);

View File

@ -205,6 +205,9 @@ SELECT inhrelid::regclass FROM pg_inherits WHERE inhparent = 'partitioning_test'
ERROR: relation "partitioning_test" does not exist
LINE 1: ...elid::regclass FROM pg_inherits WHERE inhparent = 'partition...
^
-- make sure DROPping from worker node is not allowed
DROP TABLE partitioning_test;
ERROR: table "partitioning_test" does not exist
\c - - - :master_port
-- make sure we can repeatedly call start_metadata_sync_to_node
SELECT start_metadata_sync_to_node('localhost', :worker_1_port);

View File

@ -156,6 +156,9 @@ ALTER TABLE partitioning_test DETACH PARTITION partitioning_test_2009;
SELECT inhrelid::regclass FROM pg_inherits WHERE inhparent = 'partitioning_test'::regclass;
-- make sure DROPping from worker node is not allowed
DROP TABLE partitioning_test;
\c - - - :master_port
-- make sure we can repeatedly call start_metadata_sync_to_node