Modify tests to create clean workspace

Since we will now replicate reference tables each time we add node, we need to ensure
that test space is clean in terms of reference tables before any add node operation.
For this purpose we had to change order of multi_drop_extension test which caused
change of some of the colocation ids.
pull/1091/head
Burak Yucesoy 2017-01-05 12:07:12 +03:00
parent 2e3e801768
commit 1d18950860
10 changed files with 180 additions and 142 deletions

View File

@ -436,10 +436,10 @@ SELECT * FROM pg_dist_colocation
ORDER BY colocationid; ORDER BY colocationid;
colocationid | shardcount | replicationfactor | distributioncolumntype colocationid | shardcount | replicationfactor | distributioncolumntype
--------------+------------+-------------------+------------------------ --------------+------------+-------------------+------------------------
1 | 2 | 2 | 23 4 | 2 | 2 | 23
2 | 2 | 1 | 23 5 | 2 | 1 | 23
3 | 2 | 2 | 25 6 | 2 | 2 | 25
4 | 4 | 2 | 23 7 | 4 | 2 | 23
(4 rows) (4 rows)
SELECT logicalrelid, colocationid FROM pg_dist_partition SELECT logicalrelid, colocationid FROM pg_dist_partition
@ -447,28 +447,28 @@ SELECT logicalrelid, colocationid FROM pg_dist_partition
ORDER BY logicalrelid; ORDER BY logicalrelid;
logicalrelid | colocationid logicalrelid | colocationid
---------------+-------------- ---------------+--------------
table1_groupa | 1 table1_groupa | 4
table2_groupa | 1 table2_groupa | 4
table1_groupb | 2 table1_groupb | 5
table2_groupb | 2 table2_groupb | 5
table1_groupc | 3 table1_groupc | 6
table2_groupc | 3 table2_groupc | 6
table1_groupd | 4 table1_groupd | 7
table2_groupd | 4 table2_groupd | 7
table3_groupd | 4 table3_groupd | 7
(9 rows) (9 rows)
-- check effects of dropping tables -- check effects of dropping tables
DROP TABLE table1_groupA; DROP TABLE table1_groupA;
SELECT * FROM pg_dist_colocation WHERE colocationid = 1; SELECT * FROM pg_dist_colocation WHERE colocationid = 4;
colocationid | shardcount | replicationfactor | distributioncolumntype colocationid | shardcount | replicationfactor | distributioncolumntype
--------------+------------+-------------------+------------------------ --------------+------------+-------------------+------------------------
1 | 2 | 2 | 23 4 | 2 | 2 | 23
(1 row) (1 row)
-- dropping all tables in a colocation group also deletes the colocation group -- dropping all tables in a colocation group also deletes the colocation group
DROP TABLE table2_groupA; DROP TABLE table2_groupA;
SELECT * FROM pg_dist_colocation WHERE colocationid = 1; SELECT * FROM pg_dist_colocation WHERE colocationid = 4;
colocationid | shardcount | replicationfactor | distributioncolumntype colocationid | shardcount | replicationfactor | distributioncolumntype
--------------+------------+-------------------+------------------------ --------------+------------+-------------------+------------------------
(0 rows) (0 rows)
@ -558,11 +558,11 @@ SELECT * FROM pg_dist_colocation
ORDER BY colocationid; ORDER BY colocationid;
colocationid | shardcount | replicationfactor | distributioncolumntype colocationid | shardcount | replicationfactor | distributioncolumntype
--------------+------------+-------------------+------------------------ --------------+------------+-------------------+------------------------
2 | 2 | 1 | 23 5 | 2 | 1 | 23
3 | 2 | 2 | 25 6 | 2 | 2 | 25
4 | 4 | 2 | 23 7 | 4 | 2 | 23
5 | 2 | 2 | 23 8 | 2 | 2 | 23
9 | 3 | 2 | 23 12 | 3 | 2 | 23
(5 rows) (5 rows)
SELECT logicalrelid, colocationid FROM pg_dist_partition SELECT logicalrelid, colocationid FROM pg_dist_partition
@ -570,23 +570,23 @@ SELECT logicalrelid, colocationid FROM pg_dist_partition
ORDER BY colocationid, logicalrelid; ORDER BY colocationid, logicalrelid;
logicalrelid | colocationid logicalrelid | colocationid
----------------------------------+-------------- ----------------------------------+--------------
table1_groupb | 2 table1_groupb | 5
table2_groupb | 2 table2_groupb | 5
table1_groupc | 3 table1_groupc | 6
table2_groupc | 3 table2_groupc | 6
table1_groupd | 4 table1_groupd | 7
table2_groupd | 4 table2_groupd | 7
table3_groupd | 4 table3_groupd | 7
table1_groupe | 5 table1_groupe | 8
table2_groupe | 5 table2_groupe | 8
table3_groupe | 5 table3_groupe | 8
schema_collocation.table4_groupe | 5 schema_collocation.table4_groupe | 8
table4_groupe | 5 table4_groupe | 8
table1_group_none_1 | 6 table1_group_none_1 | 9
table2_group_none_1 | 6 table2_group_none_1 | 9
table1_group_none_2 | 7 table1_group_none_2 | 10
table1_group_none_3 | 8 table1_group_none_3 | 11
table1_group_default | 9 table1_group_default | 12
(17 rows) (17 rows)
-- check failing colocate_with options -- check failing colocate_with options
@ -651,12 +651,12 @@ SELECT * FROM pg_dist_colocation
ORDER BY colocationid; ORDER BY colocationid;
colocationid | shardcount | replicationfactor | distributioncolumntype colocationid | shardcount | replicationfactor | distributioncolumntype
--------------+------------+-------------------+------------------------ --------------+------------+-------------------+------------------------
2 | 2 | 1 | 23 5 | 2 | 1 | 23
3 | 2 | 2 | 25 6 | 2 | 2 | 25
4 | 4 | 2 | 23 7 | 4 | 2 | 23
5 | 2 | 2 | 23 8 | 2 | 2 | 23
9 | 3 | 2 | 23 12 | 3 | 2 | 23
10 | 1 | 2 | 0 13 | 1 | 2 | 0
(6 rows) (6 rows)
-- cross check with internal colocation API -- cross check with internal colocation API

View File

@ -1574,7 +1574,7 @@ ERROR: single-shard DML commands must not appear in transaction blocks which co
ROLLBACK; ROLLBACK;
-- clean up tables -- clean up tables
DROP TABLE reference_table_test, reference_table_test_second, reference_table_test_third, DROP TABLE reference_table_test, reference_table_test_second, reference_table_test_third,
reference_table_test_fourth, reference_table_ddl; reference_table_test_fourth, reference_table_ddl, reference_table_composite;
DROP SCHEMA reference_schema CASCADE; DROP SCHEMA reference_schema CASCADE;
NOTICE: drop cascades to 2 other objects NOTICE: drop cascades to 2 other objects
DETAIL: drop cascades to table reference_schema.reference_table_test_sixth DETAIL: drop cascades to table reference_schema.reference_table_test_sixth

View File

@ -5,6 +5,7 @@
-- --
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1360000; ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1360000;
ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 1360000; ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 1360000;
ALTER SEQUENCE pg_catalog.pg_dist_colocationid_seq RESTART 1360000;
-- test with not distributed table -- test with not distributed table
CREATE TABLE upgrade_reference_table_local(column1 int); CREATE TABLE upgrade_reference_table_local(column1 int);
SELECT upgrade_to_reference_table('upgrade_reference_table_local'); SELECT upgrade_to_reference_table('upgrade_reference_table_local');
@ -138,15 +139,16 @@ WHERE colocationid IN
--------------+------------+-------------------+------------------------ --------------+------------+-------------------+------------------------
(0 rows) (0 rows)
SELECT * SELECT
shardid, shardstate, shardlength, nodename, nodeport
FROM pg_dist_shard_placement FROM pg_dist_shard_placement
WHERE shardid IN WHERE shardid IN
(SELECT shardid (SELECT shardid
FROM pg_dist_shard FROM pg_dist_shard
WHERE logicalrelid = 'upgrade_reference_table_append'::regclass); WHERE logicalrelid = 'upgrade_reference_table_append'::regclass);
shardid | shardstate | shardlength | nodename | nodeport | placementid shardid | shardstate | shardlength | nodename | nodeport
---------+------------+-------------+-----------+----------+------------- ---------+------------+-------------+-----------+----------
1360009 | 1 | 8192 | localhost | 57637 | 379 1360009 | 1 | 8192 | localhost | 57637
(1 row) (1 row)
SELECT upgrade_to_reference_table('upgrade_reference_table_append'); SELECT upgrade_to_reference_table('upgrade_reference_table_append');
@ -164,7 +166,7 @@ WHERE
logicalrelid = 'upgrade_reference_table_append'::regclass; logicalrelid = 'upgrade_reference_table_append'::regclass;
partmethod | partkeyisnull | colocationid | repmodel partmethod | partkeyisnull | colocationid | repmodel
------------+---------------+--------------+---------- ------------+---------------+--------------+----------
n | t | 33 | t n | t | 1360002 | t
(1 row) (1 row)
SELECT SELECT
@ -186,19 +188,20 @@ WHERE colocationid IN
WHERE logicalrelid = 'upgrade_reference_table_append'::regclass); WHERE logicalrelid = 'upgrade_reference_table_append'::regclass);
colocationid | shardcount | replicationfactor | distributioncolumntype colocationid | shardcount | replicationfactor | distributioncolumntype
--------------+------------+-------------------+------------------------ --------------+------------+-------------------+------------------------
33 | 1 | 2 | 0 1360002 | 1 | 2 | 0
(1 row) (1 row)
SELECT * SELECT
shardid, shardstate, shardlength, nodename, nodeport
FROM pg_dist_shard_placement FROM pg_dist_shard_placement
WHERE shardid IN WHERE shardid IN
(SELECT shardid (SELECT shardid
FROM pg_dist_shard FROM pg_dist_shard
WHERE logicalrelid = 'upgrade_reference_table_append'::regclass); WHERE logicalrelid = 'upgrade_reference_table_append'::regclass);
shardid | shardstate | shardlength | nodename | nodeport | placementid shardid | shardstate | shardlength | nodename | nodeport
---------+------------+-------------+-----------+----------+------------- ---------+------------+-------------+-----------+----------
1360009 | 1 | 8192 | localhost | 57637 | 379 1360009 | 1 | 8192 | localhost | 57637
1360009 | 1 | 0 | localhost | 57638 | 380 1360009 | 1 | 0 | localhost | 57638
(2 rows) (2 rows)
-- test valid cases, shard exists at one worker -- test valid cases, shard exists at one worker
@ -218,7 +221,7 @@ WHERE
logicalrelid = 'upgrade_reference_table_one_worker'::regclass; logicalrelid = 'upgrade_reference_table_one_worker'::regclass;
partmethod | partkeyisnull | colocationid | repmodel partmethod | partkeyisnull | colocationid | repmodel
------------+---------------+--------------+---------- ------------+---------------+--------------+----------
h | f | 32 | s h | f | 1360001 | s
(1 row) (1 row)
SELECT SELECT
@ -240,18 +243,19 @@ WHERE colocationid IN
WHERE logicalrelid = 'upgrade_reference_table_one_worker'::regclass); WHERE logicalrelid = 'upgrade_reference_table_one_worker'::regclass);
colocationid | shardcount | replicationfactor | distributioncolumntype colocationid | shardcount | replicationfactor | distributioncolumntype
--------------+------------+-------------------+------------------------ --------------+------------+-------------------+------------------------
32 | 1 | 1 | 23 1360001 | 1 | 1 | 23
(1 row) (1 row)
SELECT * SELECT
shardid, shardstate, shardlength, nodename, nodeport
FROM pg_dist_shard_placement FROM pg_dist_shard_placement
WHERE shardid IN WHERE shardid IN
(SELECT shardid (SELECT shardid
FROM pg_dist_shard FROM pg_dist_shard
WHERE logicalrelid = 'upgrade_reference_table_one_worker'::regclass); WHERE logicalrelid = 'upgrade_reference_table_one_worker'::regclass);
shardid | shardstate | shardlength | nodename | nodeport | placementid shardid | shardstate | shardlength | nodename | nodeport
---------+------------+-------------+-----------+----------+------------- ---------+------------+-------------+-----------+----------
1360010 | 1 | 0 | localhost | 57637 | 381 1360010 | 1 | 0 | localhost | 57637
(1 row) (1 row)
SELECT upgrade_to_reference_table('upgrade_reference_table_one_worker'); SELECT upgrade_to_reference_table('upgrade_reference_table_one_worker');
@ -269,7 +273,7 @@ WHERE
logicalrelid = 'upgrade_reference_table_one_worker'::regclass; logicalrelid = 'upgrade_reference_table_one_worker'::regclass;
partmethod | partkeyisnull | colocationid | repmodel partmethod | partkeyisnull | colocationid | repmodel
------------+---------------+--------------+---------- ------------+---------------+--------------+----------
n | t | 33 | t n | t | 1360002 | t
(1 row) (1 row)
SELECT SELECT
@ -291,19 +295,20 @@ WHERE colocationid IN
WHERE logicalrelid = 'upgrade_reference_table_one_worker'::regclass); WHERE logicalrelid = 'upgrade_reference_table_one_worker'::regclass);
colocationid | shardcount | replicationfactor | distributioncolumntype colocationid | shardcount | replicationfactor | distributioncolumntype
--------------+------------+-------------------+------------------------ --------------+------------+-------------------+------------------------
33 | 1 | 2 | 0 1360002 | 1 | 2 | 0
(1 row) (1 row)
SELECT * SELECT
shardid, shardstate, shardlength, nodename, nodeport
FROM pg_dist_shard_placement FROM pg_dist_shard_placement
WHERE shardid IN WHERE shardid IN
(SELECT shardid (SELECT shardid
FROM pg_dist_shard FROM pg_dist_shard
WHERE logicalrelid = 'upgrade_reference_table_one_worker'::regclass); WHERE logicalrelid = 'upgrade_reference_table_one_worker'::regclass);
shardid | shardstate | shardlength | nodename | nodeport | placementid shardid | shardstate | shardlength | nodename | nodeport
---------+------------+-------------+-----------+----------+------------- ---------+------------+-------------+-----------+----------
1360010 | 1 | 0 | localhost | 57637 | 381 1360010 | 1 | 0 | localhost | 57637
1360010 | 1 | 0 | localhost | 57638 | 382 1360010 | 1 | 0 | localhost | 57638
(2 rows) (2 rows)
-- test valid cases, shard exists at both workers but one is unhealthy -- test valid cases, shard exists at both workers but one is unhealthy
@ -325,7 +330,7 @@ WHERE
logicalrelid = 'upgrade_reference_table_one_unhealthy'::regclass; logicalrelid = 'upgrade_reference_table_one_unhealthy'::regclass;
partmethod | partkeyisnull | colocationid | repmodel partmethod | partkeyisnull | colocationid | repmodel
------------+---------------+--------------+---------- ------------+---------------+--------------+----------
h | f | 34 | c h | f | 1360003 | c
(1 row) (1 row)
SELECT SELECT
@ -347,19 +352,20 @@ WHERE colocationid IN
WHERE logicalrelid = 'upgrade_reference_table_one_unhealthy'::regclass); WHERE logicalrelid = 'upgrade_reference_table_one_unhealthy'::regclass);
colocationid | shardcount | replicationfactor | distributioncolumntype colocationid | shardcount | replicationfactor | distributioncolumntype
--------------+------------+-------------------+------------------------ --------------+------------+-------------------+------------------------
34 | 1 | 2 | 23 1360003 | 1 | 2 | 23
(1 row) (1 row)
SELECT * SELECT
shardid, shardstate, shardlength, nodename, nodeport
FROM pg_dist_shard_placement FROM pg_dist_shard_placement
WHERE shardid IN WHERE shardid IN
(SELECT shardid (SELECT shardid
FROM pg_dist_shard FROM pg_dist_shard
WHERE logicalrelid = 'upgrade_reference_table_one_unhealthy'::regclass); WHERE logicalrelid = 'upgrade_reference_table_one_unhealthy'::regclass);
shardid | shardstate | shardlength | nodename | nodeport | placementid shardid | shardstate | shardlength | nodename | nodeport
---------+------------+-------------+-----------+----------+------------- ---------+------------+-------------+-----------+----------
1360011 | 1 | 0 | localhost | 57637 | 383 1360011 | 1 | 0 | localhost | 57637
1360011 | 1 | 0 | localhost | 57638 | 384 1360011 | 1 | 0 | localhost | 57638
(2 rows) (2 rows)
SELECT upgrade_to_reference_table('upgrade_reference_table_one_unhealthy'); SELECT upgrade_to_reference_table('upgrade_reference_table_one_unhealthy');
@ -377,7 +383,7 @@ WHERE
logicalrelid = 'upgrade_reference_table_one_unhealthy'::regclass; logicalrelid = 'upgrade_reference_table_one_unhealthy'::regclass;
partmethod | partkeyisnull | colocationid | repmodel partmethod | partkeyisnull | colocationid | repmodel
------------+---------------+--------------+---------- ------------+---------------+--------------+----------
n | t | 33 | t n | t | 1360002 | t
(1 row) (1 row)
SELECT SELECT
@ -399,19 +405,20 @@ WHERE colocationid IN
WHERE logicalrelid = 'upgrade_reference_table_one_unhealthy'::regclass); WHERE logicalrelid = 'upgrade_reference_table_one_unhealthy'::regclass);
colocationid | shardcount | replicationfactor | distributioncolumntype colocationid | shardcount | replicationfactor | distributioncolumntype
--------------+------------+-------------------+------------------------ --------------+------------+-------------------+------------------------
33 | 1 | 2 | 0 1360002 | 1 | 2 | 0
(1 row) (1 row)
SELECT * SELECT
shardid, shardstate, shardlength, nodename, nodeport
FROM pg_dist_shard_placement FROM pg_dist_shard_placement
WHERE shardid IN WHERE shardid IN
(SELECT shardid (SELECT shardid
FROM pg_dist_shard FROM pg_dist_shard
WHERE logicalrelid = 'upgrade_reference_table_one_unhealthy'::regclass); WHERE logicalrelid = 'upgrade_reference_table_one_unhealthy'::regclass);
shardid | shardstate | shardlength | nodename | nodeport | placementid shardid | shardstate | shardlength | nodename | nodeport
---------+------------+-------------+-----------+----------+------------- ---------+------------+-------------+-----------+----------
1360011 | 1 | 0 | localhost | 57637 | 383 1360011 | 1 | 0 | localhost | 57637
1360011 | 1 | 0 | localhost | 57638 | 384 1360011 | 1 | 0 | localhost | 57638
(2 rows) (2 rows)
-- test valid cases, shard exists at both workers and both are healthy -- test valid cases, shard exists at both workers and both are healthy
@ -431,7 +438,7 @@ WHERE
logicalrelid = 'upgrade_reference_table_both_healthy'::regclass; logicalrelid = 'upgrade_reference_table_both_healthy'::regclass;
partmethod | partkeyisnull | colocationid | repmodel partmethod | partkeyisnull | colocationid | repmodel
------------+---------------+--------------+---------- ------------+---------------+--------------+----------
h | f | 35 | c h | f | 1360004 | c
(1 row) (1 row)
SELECT SELECT
@ -453,19 +460,20 @@ WHERE colocationid IN
WHERE logicalrelid = 'upgrade_reference_table_both_healthy'::regclass); WHERE logicalrelid = 'upgrade_reference_table_both_healthy'::regclass);
colocationid | shardcount | replicationfactor | distributioncolumntype colocationid | shardcount | replicationfactor | distributioncolumntype
--------------+------------+-------------------+------------------------ --------------+------------+-------------------+------------------------
35 | 1 | 2 | 23 1360004 | 1 | 2 | 23
(1 row) (1 row)
SELECT * SELECT
shardid, shardstate, shardlength, nodename, nodeport
FROM pg_dist_shard_placement FROM pg_dist_shard_placement
WHERE shardid IN WHERE shardid IN
(SELECT shardid (SELECT shardid
FROM pg_dist_shard FROM pg_dist_shard
WHERE logicalrelid = 'upgrade_reference_table_both_healthy'::regclass); WHERE logicalrelid = 'upgrade_reference_table_both_healthy'::regclass);
shardid | shardstate | shardlength | nodename | nodeport | placementid shardid | shardstate | shardlength | nodename | nodeport
---------+------------+-------------+-----------+----------+------------- ---------+------------+-------------+-----------+----------
1360012 | 1 | 0 | localhost | 57637 | 385 1360012 | 1 | 0 | localhost | 57637
1360012 | 1 | 0 | localhost | 57638 | 386 1360012 | 1 | 0 | localhost | 57638
(2 rows) (2 rows)
SELECT upgrade_to_reference_table('upgrade_reference_table_both_healthy'); SELECT upgrade_to_reference_table('upgrade_reference_table_both_healthy');
@ -483,7 +491,7 @@ WHERE
logicalrelid = 'upgrade_reference_table_both_healthy'::regclass; logicalrelid = 'upgrade_reference_table_both_healthy'::regclass;
partmethod | partkeyisnull | colocationid | repmodel partmethod | partkeyisnull | colocationid | repmodel
------------+---------------+--------------+---------- ------------+---------------+--------------+----------
n | t | 33 | t n | t | 1360002 | t
(1 row) (1 row)
SELECT SELECT
@ -505,19 +513,20 @@ WHERE colocationid IN
WHERE logicalrelid = 'upgrade_reference_table_both_healthy'::regclass); WHERE logicalrelid = 'upgrade_reference_table_both_healthy'::regclass);
colocationid | shardcount | replicationfactor | distributioncolumntype colocationid | shardcount | replicationfactor | distributioncolumntype
--------------+------------+-------------------+------------------------ --------------+------------+-------------------+------------------------
33 | 1 | 2 | 0 1360002 | 1 | 2 | 0
(1 row) (1 row)
SELECT * SELECT
shardid, shardstate, shardlength, nodename, nodeport
FROM pg_dist_shard_placement FROM pg_dist_shard_placement
WHERE shardid IN WHERE shardid IN
(SELECT shardid (SELECT shardid
FROM pg_dist_shard FROM pg_dist_shard
WHERE logicalrelid = 'upgrade_reference_table_both_healthy'::regclass); WHERE logicalrelid = 'upgrade_reference_table_both_healthy'::regclass);
shardid | shardstate | shardlength | nodename | nodeport | placementid shardid | shardstate | shardlength | nodename | nodeport
---------+------------+-------------+-----------+----------+------------- ---------+------------+-------------+-----------+----------
1360012 | 1 | 0 | localhost | 57637 | 385 1360012 | 1 | 0 | localhost | 57637
1360012 | 1 | 0 | localhost | 57638 | 386 1360012 | 1 | 0 | localhost | 57638
(2 rows) (2 rows)
-- test valid cases, do it in transaction and ROLLBACK -- test valid cases, do it in transaction and ROLLBACK
@ -538,7 +547,7 @@ WHERE
logicalrelid = 'upgrade_reference_table_transaction_rollback'::regclass; logicalrelid = 'upgrade_reference_table_transaction_rollback'::regclass;
partmethod | partkeyisnull | colocationid | repmodel partmethod | partkeyisnull | colocationid | repmodel
------------+---------------+--------------+---------- ------------+---------------+--------------+----------
h | f | 32 | s h | f | 1360001 | s
(1 row) (1 row)
SELECT SELECT
@ -560,18 +569,19 @@ WHERE colocationid IN
WHERE logicalrelid = 'upgrade_reference_table_transaction_rollback'::regclass); WHERE logicalrelid = 'upgrade_reference_table_transaction_rollback'::regclass);
colocationid | shardcount | replicationfactor | distributioncolumntype colocationid | shardcount | replicationfactor | distributioncolumntype
--------------+------------+-------------------+------------------------ --------------+------------+-------------------+------------------------
32 | 1 | 1 | 23 1360001 | 1 | 1 | 23
(1 row) (1 row)
SELECT * SELECT
shardid, shardstate, shardlength, nodename, nodeport
FROM pg_dist_shard_placement FROM pg_dist_shard_placement
WHERE shardid IN WHERE shardid IN
(SELECT shardid (SELECT shardid
FROM pg_dist_shard FROM pg_dist_shard
WHERE logicalrelid = 'upgrade_reference_table_transaction_rollback'::regclass); WHERE logicalrelid = 'upgrade_reference_table_transaction_rollback'::regclass);
shardid | shardstate | shardlength | nodename | nodeport | placementid shardid | shardstate | shardlength | nodename | nodeport
---------+------------+-------------+-----------+----------+------------- ---------+------------+-------------+-----------+----------
1360013 | 1 | 0 | localhost | 57637 | 387 1360013 | 1 | 0 | localhost | 57637
(1 row) (1 row)
BEGIN; BEGIN;
@ -591,7 +601,7 @@ WHERE
logicalrelid = 'upgrade_reference_table_transaction_rollback'::regclass; logicalrelid = 'upgrade_reference_table_transaction_rollback'::regclass;
partmethod | partkeyisnull | colocationid | repmodel partmethod | partkeyisnull | colocationid | repmodel
------------+---------------+--------------+---------- ------------+---------------+--------------+----------
h | f | 32 | s h | f | 1360001 | s
(1 row) (1 row)
SELECT SELECT
@ -613,18 +623,19 @@ WHERE colocationid IN
WHERE logicalrelid = 'upgrade_reference_table_transaction_rollback'::regclass); WHERE logicalrelid = 'upgrade_reference_table_transaction_rollback'::regclass);
colocationid | shardcount | replicationfactor | distributioncolumntype colocationid | shardcount | replicationfactor | distributioncolumntype
--------------+------------+-------------------+------------------------ --------------+------------+-------------------+------------------------
32 | 1 | 1 | 23 1360001 | 1 | 1 | 23
(1 row) (1 row)
SELECT * SELECT
shardid, shardstate, shardlength, nodename, nodeport
FROM pg_dist_shard_placement FROM pg_dist_shard_placement
WHERE shardid IN WHERE shardid IN
(SELECT shardid (SELECT shardid
FROM pg_dist_shard FROM pg_dist_shard
WHERE logicalrelid = 'upgrade_reference_table_transaction_rollback'::regclass); WHERE logicalrelid = 'upgrade_reference_table_transaction_rollback'::regclass);
shardid | shardstate | shardlength | nodename | nodeport | placementid shardid | shardstate | shardlength | nodename | nodeport
---------+------------+-------------+-----------+----------+------------- ---------+------------+-------------+-----------+----------
1360013 | 1 | 0 | localhost | 57637 | 387 1360013 | 1 | 0 | localhost | 57637
(1 row) (1 row)
-- test valid cases, do it in transaction and COMMIT -- test valid cases, do it in transaction and COMMIT
@ -645,7 +656,7 @@ WHERE
logicalrelid = 'upgrade_reference_table_transaction_commit'::regclass; logicalrelid = 'upgrade_reference_table_transaction_commit'::regclass;
partmethod | partkeyisnull | colocationid | repmodel partmethod | partkeyisnull | colocationid | repmodel
------------+---------------+--------------+---------- ------------+---------------+--------------+----------
h | f | 32 | s h | f | 1360001 | s
(1 row) (1 row)
SELECT SELECT
@ -667,18 +678,19 @@ WHERE colocationid IN
WHERE logicalrelid = 'upgrade_reference_table_transaction_commit'::regclass); WHERE logicalrelid = 'upgrade_reference_table_transaction_commit'::regclass);
colocationid | shardcount | replicationfactor | distributioncolumntype colocationid | shardcount | replicationfactor | distributioncolumntype
--------------+------------+-------------------+------------------------ --------------+------------+-------------------+------------------------
32 | 1 | 1 | 23 1360001 | 1 | 1 | 23
(1 row) (1 row)
SELECT * SELECT
shardid, shardstate, shardlength, nodename, nodeport
FROM pg_dist_shard_placement FROM pg_dist_shard_placement
WHERE shardid IN WHERE shardid IN
(SELECT shardid (SELECT shardid
FROM pg_dist_shard FROM pg_dist_shard
WHERE logicalrelid = 'upgrade_reference_table_transaction_commit'::regclass); WHERE logicalrelid = 'upgrade_reference_table_transaction_commit'::regclass);
shardid | shardstate | shardlength | nodename | nodeport | placementid shardid | shardstate | shardlength | nodename | nodeport
---------+------------+-------------+-----------+----------+------------- ---------+------------+-------------+-----------+----------
1360014 | 1 | 0 | localhost | 57637 | 389 1360014 | 1 | 0 | localhost | 57637
(1 row) (1 row)
BEGIN; BEGIN;
@ -698,7 +710,7 @@ WHERE
logicalrelid = 'upgrade_reference_table_transaction_commit'::regclass; logicalrelid = 'upgrade_reference_table_transaction_commit'::regclass;
partmethod | partkeyisnull | colocationid | repmodel partmethod | partkeyisnull | colocationid | repmodel
------------+---------------+--------------+---------- ------------+---------------+--------------+----------
n | t | 33 | t n | t | 1360002 | t
(1 row) (1 row)
SELECT SELECT
@ -720,19 +732,20 @@ WHERE colocationid IN
WHERE logicalrelid = 'upgrade_reference_table_transaction_commit'::regclass); WHERE logicalrelid = 'upgrade_reference_table_transaction_commit'::regclass);
colocationid | shardcount | replicationfactor | distributioncolumntype colocationid | shardcount | replicationfactor | distributioncolumntype
--------------+------------+-------------------+------------------------ --------------+------------+-------------------+------------------------
33 | 1 | 2 | 0 1360002 | 1 | 2 | 0
(1 row) (1 row)
SELECT * SELECT
shardid, shardstate, shardlength, nodename, nodeport
FROM pg_dist_shard_placement FROM pg_dist_shard_placement
WHERE shardid IN WHERE shardid IN
(SELECT shardid (SELECT shardid
FROM pg_dist_shard FROM pg_dist_shard
WHERE logicalrelid = 'upgrade_reference_table_transaction_commit'::regclass); WHERE logicalrelid = 'upgrade_reference_table_transaction_commit'::regclass);
shardid | shardstate | shardlength | nodename | nodeport | placementid shardid | shardstate | shardlength | nodename | nodeport
---------+------------+-------------+-----------+----------+------------- ---------+------------+-------------+-----------+----------
1360014 | 1 | 0 | localhost | 57637 | 389 1360014 | 1 | 0 | localhost | 57637
1360014 | 1 | 0 | localhost | 57638 | 390 1360014 | 1 | 0 | localhost | 57638
(2 rows) (2 rows)
-- verify that shard is replicated to other worker -- verify that shard is replicated to other worker

View File

@ -449,3 +449,9 @@ SELECT
FROM FROM
multi_outer_join_right_reference FULL JOIN multi_outer_join_right_reference FULL JOIN
multi_outer_join_third_reference ON (t_custkey = r_custkey); multi_outer_join_third_reference ON (t_custkey = r_custkey);
-- DROP unused tables to clean up workspace
DROP TABLE multi_outer_join_left_hash;
DROP TABLE multi_outer_join_right_reference;
DROP TABLE multi_outer_join_third_reference;
DROP TABLE multi_outer_join_right_hash;

View File

@ -157,6 +157,11 @@ test: multi_router_planner
# ---------- # ----------
test: multi_large_shardid test: multi_large_shardid
# ----------
# multi_drop_extension makes sure we can safely drop and recreate the extension
# ----------
test: multi_drop_extension
# ---------- # ----------
# multi_metadata_sync tests the propagation of mx-related metadata changes to metadata workers # multi_metadata_sync tests the propagation of mx-related metadata changes to metadata workers
# multi_unsupported_worker_operations tests that unsupported operations error out on metadata workers # multi_unsupported_worker_operations tests that unsupported operations error out on metadata workers
@ -164,11 +169,6 @@ test: multi_large_shardid
test: multi_metadata_sync test: multi_metadata_sync
test: multi_unsupported_worker_operations test: multi_unsupported_worker_operations
# ----------
# multi_drop_extension makes sure we can safely drop and recreate the extension
# ----------
test: multi_drop_extension
# ---------- # ----------
# multi_schema_support makes sure we can work with tables in schemas other than public with no problem # multi_schema_support makes sure we can work with tables in schemas other than public with no problem
# ---------- # ----------

View File

@ -834,3 +834,8 @@ FROM
7 | 7 |
(30 rows) (30 rows)
-- DROP unused tables to clean up workspace
DROP TABLE multi_outer_join_left_hash;
DROP TABLE multi_outer_join_right_reference;
DROP TABLE multi_outer_join_third_reference;
DROP TABLE multi_outer_join_right_hash;

View File

@ -219,11 +219,11 @@ SELECT logicalrelid, colocationid FROM pg_dist_partition
-- check effects of dropping tables -- check effects of dropping tables
DROP TABLE table1_groupA; DROP TABLE table1_groupA;
SELECT * FROM pg_dist_colocation WHERE colocationid = 1; SELECT * FROM pg_dist_colocation WHERE colocationid = 4;
-- dropping all tables in a colocation group also deletes the colocation group -- dropping all tables in a colocation group also deletes the colocation group
DROP TABLE table2_groupA; DROP TABLE table2_groupA;
SELECT * FROM pg_dist_colocation WHERE colocationid = 1; SELECT * FROM pg_dist_colocation WHERE colocationid = 4;
-- create dropped colocation group again -- create dropped colocation group again
SET citus.shard_count = 2; SET citus.shard_count = 2;

View File

@ -986,5 +986,5 @@ ROLLBACK;
-- clean up tables -- clean up tables
DROP TABLE reference_table_test, reference_table_test_second, reference_table_test_third, DROP TABLE reference_table_test, reference_table_test_second, reference_table_test_third,
reference_table_test_fourth, reference_table_ddl; reference_table_test_fourth, reference_table_ddl, reference_table_composite;
DROP SCHEMA reference_schema CASCADE; DROP SCHEMA reference_schema CASCADE;

View File

@ -94,6 +94,7 @@ SELECT master_apply_delete_command('DELETE FROM mx_table');
SELECT count(*) FROM mx_table; SELECT count(*) FROM mx_table;
-- master_add_node -- master_add_node
SELECT master_add_node('localhost', 5432); SELECT master_add_node('localhost', 5432);
SELECT * FROM pg_dist_node WHERE nodename='localhost' AND nodeport=5432; SELECT * FROM pg_dist_node WHERE nodename='localhost' AND nodeport=5432;

View File

@ -6,6 +6,7 @@
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1360000; ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1360000;
ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 1360000; ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 1360000;
ALTER SEQUENCE pg_catalog.pg_dist_colocationid_seq RESTART 1360000;
-- test with not distributed table -- test with not distributed table
CREATE TABLE upgrade_reference_table_local(column1 int); CREATE TABLE upgrade_reference_table_local(column1 int);
@ -91,7 +92,8 @@ WHERE colocationid IN
FROM pg_dist_partition FROM pg_dist_partition
WHERE logicalrelid = 'upgrade_reference_table_append'::regclass); WHERE logicalrelid = 'upgrade_reference_table_append'::regclass);
SELECT * SELECT
shardid, shardstate, shardlength, nodename, nodeport
FROM pg_dist_shard_placement FROM pg_dist_shard_placement
WHERE shardid IN WHERE shardid IN
(SELECT shardid (SELECT shardid
@ -122,7 +124,8 @@ WHERE colocationid IN
FROM pg_dist_partition FROM pg_dist_partition
WHERE logicalrelid = 'upgrade_reference_table_append'::regclass); WHERE logicalrelid = 'upgrade_reference_table_append'::regclass);
SELECT * SELECT
shardid, shardstate, shardlength, nodename, nodeport
FROM pg_dist_shard_placement FROM pg_dist_shard_placement
WHERE shardid IN WHERE shardid IN
(SELECT shardid (SELECT shardid
@ -155,7 +158,8 @@ WHERE colocationid IN
FROM pg_dist_partition FROM pg_dist_partition
WHERE logicalrelid = 'upgrade_reference_table_one_worker'::regclass); WHERE logicalrelid = 'upgrade_reference_table_one_worker'::regclass);
SELECT * SELECT
shardid, shardstate, shardlength, nodename, nodeport
FROM pg_dist_shard_placement FROM pg_dist_shard_placement
WHERE shardid IN WHERE shardid IN
(SELECT shardid (SELECT shardid
@ -186,7 +190,8 @@ WHERE colocationid IN
FROM pg_dist_partition FROM pg_dist_partition
WHERE logicalrelid = 'upgrade_reference_table_one_worker'::regclass); WHERE logicalrelid = 'upgrade_reference_table_one_worker'::regclass);
SELECT * SELECT
shardid, shardstate, shardlength, nodename, nodeport
FROM pg_dist_shard_placement FROM pg_dist_shard_placement
WHERE shardid IN WHERE shardid IN
(SELECT shardid (SELECT shardid
@ -221,7 +226,8 @@ WHERE colocationid IN
FROM pg_dist_partition FROM pg_dist_partition
WHERE logicalrelid = 'upgrade_reference_table_one_unhealthy'::regclass); WHERE logicalrelid = 'upgrade_reference_table_one_unhealthy'::regclass);
SELECT * SELECT
shardid, shardstate, shardlength, nodename, nodeport
FROM pg_dist_shard_placement FROM pg_dist_shard_placement
WHERE shardid IN WHERE shardid IN
(SELECT shardid (SELECT shardid
@ -252,7 +258,8 @@ WHERE colocationid IN
FROM pg_dist_partition FROM pg_dist_partition
WHERE logicalrelid = 'upgrade_reference_table_one_unhealthy'::regclass); WHERE logicalrelid = 'upgrade_reference_table_one_unhealthy'::regclass);
SELECT * SELECT
shardid, shardstate, shardlength, nodename, nodeport
FROM pg_dist_shard_placement FROM pg_dist_shard_placement
WHERE shardid IN WHERE shardid IN
(SELECT shardid (SELECT shardid
@ -285,7 +292,8 @@ WHERE colocationid IN
FROM pg_dist_partition FROM pg_dist_partition
WHERE logicalrelid = 'upgrade_reference_table_both_healthy'::regclass); WHERE logicalrelid = 'upgrade_reference_table_both_healthy'::regclass);
SELECT * SELECT
shardid, shardstate, shardlength, nodename, nodeport
FROM pg_dist_shard_placement FROM pg_dist_shard_placement
WHERE shardid IN WHERE shardid IN
(SELECT shardid (SELECT shardid
@ -316,7 +324,8 @@ WHERE colocationid IN
FROM pg_dist_partition FROM pg_dist_partition
WHERE logicalrelid = 'upgrade_reference_table_both_healthy'::regclass); WHERE logicalrelid = 'upgrade_reference_table_both_healthy'::regclass);
SELECT * SELECT
shardid, shardstate, shardlength, nodename, nodeport
FROM pg_dist_shard_placement FROM pg_dist_shard_placement
WHERE shardid IN WHERE shardid IN
(SELECT shardid (SELECT shardid
@ -350,7 +359,8 @@ WHERE colocationid IN
FROM pg_dist_partition FROM pg_dist_partition
WHERE logicalrelid = 'upgrade_reference_table_transaction_rollback'::regclass); WHERE logicalrelid = 'upgrade_reference_table_transaction_rollback'::regclass);
SELECT * SELECT
shardid, shardstate, shardlength, nodename, nodeport
FROM pg_dist_shard_placement FROM pg_dist_shard_placement
WHERE shardid IN WHERE shardid IN
(SELECT shardid (SELECT shardid
@ -383,7 +393,8 @@ WHERE colocationid IN
FROM pg_dist_partition FROM pg_dist_partition
WHERE logicalrelid = 'upgrade_reference_table_transaction_rollback'::regclass); WHERE logicalrelid = 'upgrade_reference_table_transaction_rollback'::regclass);
SELECT * SELECT
shardid, shardstate, shardlength, nodename, nodeport
FROM pg_dist_shard_placement FROM pg_dist_shard_placement
WHERE shardid IN WHERE shardid IN
(SELECT shardid (SELECT shardid
@ -417,7 +428,8 @@ WHERE colocationid IN
FROM pg_dist_partition FROM pg_dist_partition
WHERE logicalrelid = 'upgrade_reference_table_transaction_commit'::regclass); WHERE logicalrelid = 'upgrade_reference_table_transaction_commit'::regclass);
SELECT * SELECT
shardid, shardstate, shardlength, nodename, nodeport
FROM pg_dist_shard_placement FROM pg_dist_shard_placement
WHERE shardid IN WHERE shardid IN
(SELECT shardid (SELECT shardid
@ -450,7 +462,8 @@ WHERE colocationid IN
FROM pg_dist_partition FROM pg_dist_partition
WHERE logicalrelid = 'upgrade_reference_table_transaction_commit'::regclass); WHERE logicalrelid = 'upgrade_reference_table_transaction_commit'::regclass);
SELECT * SELECT
shardid, shardstate, shardlength, nodename, nodeport
FROM pg_dist_shard_placement FROM pg_dist_shard_placement
WHERE shardid IN WHERE shardid IN
(SELECT shardid (SELECT shardid