Remove placementId from the ORDER BY to make results consistent

pull/2166/head
Onder Kalaci 2018-05-11 17:04:50 +03:00
parent 12e50d96dc
commit ed47e4e6b9
2 changed files with 20 additions and 20 deletions

View File

@ -632,7 +632,7 @@ COPY numbers_hash FROM STDIN WITH (FORMAT 'csv');
-- verify each placement is active
SELECT shardid, shardstate, nodename, nodeport
FROM pg_dist_shard_placement join pg_dist_shard using(shardid)
WHERE logicalrelid = 'numbers_hash'::regclass order by placementid, shardid, nodeport;
WHERE logicalrelid = 'numbers_hash'::regclass order by shardid, nodeport;
-- create a reference table
CREATE TABLE numbers_reference(a int, b int);
@ -647,7 +647,7 @@ CREATE TABLE numbers_hash_other(a int, b int);
SELECT create_distributed_table('numbers_hash_other', 'a');
SELECT shardid, shardstate, nodename, nodeport
FROM pg_dist_shard_placement join pg_dist_shard using(shardid)
WHERE logicalrelid = 'numbers_hash_other'::regclass order by placementid, shardid, nodeport;
WHERE logicalrelid = 'numbers_hash_other'::regclass order by shardid, nodeport;
-- manually corrupt pg_dist_shard such that both copies of one shard is placed in
-- worker_1. This is to test the behavior when no replica of a shard is accessible.
@ -675,7 +675,7 @@ COPY numbers_hash FROM STDIN WITH (FORMAT 'csv');
-- verify shards in the first worker as marked invalid
SELECT shardid, shardstate, nodename, nodeport
FROM pg_dist_shard_placement join pg_dist_shard using(shardid)
WHERE logicalrelid = 'numbers_hash'::regclass order by placementid, shardid, nodeport;
WHERE logicalrelid = 'numbers_hash'::regclass order by shardid, nodeport;
-- try to insert into a reference table copy should fail
COPY numbers_reference FROM STDIN WITH (FORMAT 'csv');
@ -702,7 +702,7 @@ COPY numbers_hash_other FROM STDIN WITH (FORMAT 'csv');
-- since copy has failed altogether
SELECT shardid, shardstate, nodename, nodeport
FROM pg_dist_shard_placement join pg_dist_shard using(shardid)
WHERE logicalrelid = 'numbers_hash_other'::regclass order by placementid, shardid, nodeport;
WHERE logicalrelid = 'numbers_hash_other'::regclass order by shardid, nodeport;
-- re-enable test_user on the first worker
\c - :default_user - :worker_1_port
@ -748,7 +748,7 @@ SELECT count(a) FROM numbers_hash;
-- verify shard is still marked as valid
SELECT shardid, shardstate, nodename, nodeport
FROM pg_dist_shard_placement join pg_dist_shard using(shardid)
WHERE logicalrelid = 'numbers_hash'::regclass order by placementid, shardid, nodeport;
WHERE logicalrelid = 'numbers_hash'::regclass order by shardid, nodeport;
DROP TABLE numbers_hash;
SELECT * FROM run_command_on_workers('DROP USER test_user');

View File

@ -826,15 +826,15 @@ COPY numbers_hash FROM STDIN WITH (FORMAT 'csv');
-- verify each placement is active
SELECT shardid, shardstate, nodename, nodeport
FROM pg_dist_shard_placement join pg_dist_shard using(shardid)
WHERE logicalrelid = 'numbers_hash'::regclass order by placementid, shardid, nodeport;
WHERE logicalrelid = 'numbers_hash'::regclass order by shardid, nodeport;
shardid | shardstate | nodename | nodeport
---------+------------+-----------+----------
560171 | 1 | localhost | 57638
560171 | 1 | localhost | 57637
560171 | 1 | localhost | 57638
560172 | 1 | localhost | 57637
560172 | 1 | localhost | 57638
560173 | 1 | localhost | 57638
560173 | 1 | localhost | 57637
560173 | 1 | localhost | 57638
560174 | 1 | localhost | 57637
560174 | 1 | localhost | 57638
(8 rows)
@ -858,17 +858,17 @@ SELECT create_distributed_table('numbers_hash_other', 'a');
SELECT shardid, shardstate, nodename, nodeport
FROM pg_dist_shard_placement join pg_dist_shard using(shardid)
WHERE logicalrelid = 'numbers_hash_other'::regclass order by placementid, shardid, nodeport;
WHERE logicalrelid = 'numbers_hash_other'::regclass order by shardid, nodeport;
shardid | shardstate | nodename | nodeport
---------+------------+-----------+----------
560176 | 1 | localhost | 57637
560176 | 1 | localhost | 57638
560177 | 1 | localhost | 57638
560177 | 1 | localhost | 57637
560177 | 1 | localhost | 57638
560178 | 1 | localhost | 57637
560178 | 1 | localhost | 57638
560179 | 1 | localhost | 57638
560179 | 1 | localhost | 57637
560179 | 1 | localhost | 57638
(8 rows)
-- manually corrupt pg_dist_shard such that both copies of one shard is placed in
@ -897,15 +897,15 @@ CONTEXT: COPY numbers_hash, line 6: "6,6"
-- verify shards in the first worker as marked invalid
SELECT shardid, shardstate, nodename, nodeport
FROM pg_dist_shard_placement join pg_dist_shard using(shardid)
WHERE logicalrelid = 'numbers_hash'::regclass order by placementid, shardid, nodeport;
WHERE logicalrelid = 'numbers_hash'::regclass order by shardid, nodeport;
shardid | shardstate | nodename | nodeport
---------+------------+-----------+----------
560171 | 1 | localhost | 57638
560171 | 3 | localhost | 57637
560171 | 1 | localhost | 57638
560172 | 3 | localhost | 57637
560172 | 1 | localhost | 57638
560173 | 1 | localhost | 57638
560173 | 3 | localhost | 57637
560173 | 1 | localhost | 57638
560174 | 3 | localhost | 57637
560174 | 1 | localhost | 57638
(8 rows)
@ -941,17 +941,17 @@ CONTEXT: COPY numbers_hash_other, line 1: "1,1"
-- since copy has failed altogether
SELECT shardid, shardstate, nodename, nodeport
FROM pg_dist_shard_placement join pg_dist_shard using(shardid)
WHERE logicalrelid = 'numbers_hash_other'::regclass order by placementid, shardid, nodeport;
WHERE logicalrelid = 'numbers_hash_other'::regclass order by shardid, nodeport;
shardid | shardstate | nodename | nodeport
---------+------------+-----------+----------
560176 | 1 | localhost | 57637
560176 | 1 | localhost | 57637
560177 | 1 | localhost | 57638
560177 | 1 | localhost | 57637
560177 | 1 | localhost | 57638
560178 | 1 | localhost | 57637
560178 | 1 | localhost | 57638
560179 | 1 | localhost | 57638
560179 | 1 | localhost | 57637
560179 | 1 | localhost | 57638
(8 rows)
-- re-enable test_user on the first worker
@ -993,15 +993,15 @@ SELECT count(a) FROM numbers_hash;
-- verify shard is still marked as valid
SELECT shardid, shardstate, nodename, nodeport
FROM pg_dist_shard_placement join pg_dist_shard using(shardid)
WHERE logicalrelid = 'numbers_hash'::regclass order by placementid, shardid, nodeport;
WHERE logicalrelid = 'numbers_hash'::regclass order by shardid, nodeport;
shardid | shardstate | nodename | nodeport
---------+------------+-----------+----------
560180 | 1 | localhost | 57638
560180 | 1 | localhost | 57637
560180 | 1 | localhost | 57638
560181 | 1 | localhost | 57637
560181 | 1 | localhost | 57638
560182 | 1 | localhost | 57638
560182 | 1 | localhost | 57637
560182 | 1 | localhost | 57638
560183 | 1 | localhost | 57637
560183 | 1 | localhost | 57638
(8 rows)