mirror of https://github.com/citusdata/citus.git
Add test for master_create_empty_shard on coordinator
parent
5234caecca
commit
59a81491e8
|
@ -415,7 +415,7 @@ CreateAppendDistributedShardPlacements(Oid relationId, int64 shardId,
|
|||
if (NodeIsCoordinator(workerNode))
|
||||
{
|
||||
ereport(NOTICE, (errmsg(
|
||||
"Creating placements for the append partitioned tables on the coordinator is not allowed.")));
|
||||
"Creating placements for the append partitioned tables on the coordinator is not supported, skipping coordinator ...")));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -510,6 +510,36 @@ NOTICE: executing the command locally: SELECT count(*) AS count FROM (coordinat
|
|||
(1 row)
|
||||
|
||||
ROLLBACK;
|
||||
-- issue #4237: preventing empty placement creation on coordinator
|
||||
CREATE TABLE test_append_table(a int);
|
||||
SELECT create_distributed_table('test_append_table', 'a', 'append');
|
||||
create_distributed_table
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
-- this will fail since it will try to create an empty placement in the
|
||||
-- coordinator as well
|
||||
SET citus.shard_replication_factor TO 3;
|
||||
SELECT master_create_empty_shard('test_append_table');
|
||||
NOTICE: Creating placements for the append partitioned tables on the coordinator is not supported, skipping coordinator ...
|
||||
ERROR: could only create 2 of 3 of required shard replicas
|
||||
-- this will create an empty shard with replicas in the two worker nodes
|
||||
SET citus.shard_replication_factor TO 2;
|
||||
SELECT 1 FROM master_create_empty_shard('test_append_table');
|
||||
?column?
|
||||
---------------------------------------------------------------------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
-- verify groupid is not 0 for each placement
|
||||
SELECT COUNT(*) FROM pg_dist_placement p, pg_dist_shard s WHERE p.shardid = s.shardid AND s.logicalrelid = 'test_append_table'::regclass AND p.groupid > 0;
|
||||
count
|
||||
---------------------------------------------------------------------
|
||||
2
|
||||
(1 row)
|
||||
|
||||
SET citus.shard_replication_factor TO 1;
|
||||
\set VERBOSITY terse
|
||||
DROP TABLE ref_table;
|
||||
NOTICE: executing the command locally: DROP TABLE IF EXISTS coordinator_shouldhaveshards.ref_table_xxxxx CASCADE
|
||||
|
@ -518,6 +548,7 @@ DROP TABLE test;
|
|||
DROP TABLE dist_table;
|
||||
DROP TABLE ref;
|
||||
NOTICE: executing the command locally: DROP TABLE IF EXISTS coordinator_shouldhaveshards.ref_xxxxx CASCADE
|
||||
DROP TABLE test_append_table;
|
||||
DROP SCHEMA coordinator_shouldhaveshards CASCADE;
|
||||
NOTICE: drop cascades to table local
|
||||
SELECT 1 FROM master_set_node_property('localhost', :master_port, 'shouldhaveshards', false);
|
||||
|
|
|
@ -214,6 +214,20 @@ INSERT INTO ref_table SELECT *, * FROM generate_series(1, 100);
|
|||
SELECT COUNT(*) FROM test JOIN ref_table USING(x);
|
||||
ROLLBACK;
|
||||
|
||||
-- issue #4237: preventing empty placement creation on coordinator
|
||||
CREATE TABLE test_append_table(a int);
|
||||
SELECT create_distributed_table('test_append_table', 'a', 'append');
|
||||
-- this will fail since it will try to create an empty placement in the
|
||||
-- coordinator as well
|
||||
SET citus.shard_replication_factor TO 3;
|
||||
SELECT master_create_empty_shard('test_append_table');
|
||||
-- this will create an empty shard with replicas in the two worker nodes
|
||||
SET citus.shard_replication_factor TO 2;
|
||||
SELECT 1 FROM master_create_empty_shard('test_append_table');
|
||||
-- verify groupid is not 0 for each placement
|
||||
SELECT COUNT(*) FROM pg_dist_placement p, pg_dist_shard s WHERE p.shardid = s.shardid AND s.logicalrelid = 'test_append_table'::regclass AND p.groupid > 0;
|
||||
SET citus.shard_replication_factor TO 1;
|
||||
|
||||
\set VERBOSITY terse
|
||||
DROP TABLE ref_table;
|
||||
|
||||
|
@ -221,6 +235,7 @@ DELETE FROM test;
|
|||
DROP TABLE test;
|
||||
DROP TABLE dist_table;
|
||||
DROP TABLE ref;
|
||||
DROP TABLE test_append_table;
|
||||
|
||||
DROP SCHEMA coordinator_shouldhaveshards CASCADE;
|
||||
|
||||
|
|
Loading…
Reference in New Issue