Stabilize combocid test by replicating the table
authorTomas Vondra <[email protected]>
Sun, 8 Oct 2017 21:44:27 +0000 (23:44 +0200)
committerTomas Vondra <[email protected]>
Sun, 8 Oct 2017 21:59:38 +0000 (23:59 +0200)
Commit 1d14325822 randomized the choice of a starting node with
ROUNDROBIN distribution, so that the data in combocid tests are not
all placed on the first node but distributed randomly (despite using
single-row INSERTS as before).

So to stabilize the test, make the table replicated. The table only
has a single column and the test updates is, so we can't use any
other stable distribution (e.g. BY HASH).

The expected results were obtained by running the combocid.sql on
PostgreSQL 10, so there might be some cmin differences.

src/test/regress/expected/combocid.out
src/test/regress/sql/combocid.sql

index 28e36517afcc6c56f8e7fe659af854a4bda40297..ddfd95a6004cf8c60baa73d294105e47b7deae04 100644 (file)
@@ -1,7 +1,7 @@
 --
 -- Tests for some likely failure cases with combo cmin/cmax mechanism
 --
-CREATE TEMP TABLE combocidtest (foobar int) DISTRIBUTE BY ROUNDROBIN;
+CREATE TEMP TABLE combocidtest (foobar int) DISTRIBUTE BY REPLICATION;
 BEGIN;
 -- a few dummy ops to push up the CommandId counter
 INSERT INTO combocidtest SELECT 1 LIMIT 0;
@@ -20,7 +20,7 @@ SELECT ctid,cmin,* FROM combocidtest ORDER BY ctid;
  ctid  | cmin | foobar 
 -------+------+--------
  (0,1) |   10 |      1
- (0,1) |   11 |      2
+ (0,2) |   11 |      2
 (2 rows)
 
 -- SAVEPOINT s1;
@@ -29,8 +29,8 @@ UPDATE combocidtest SET foobar = foobar + 10;
 SELECT ctid,cmin,* FROM combocidtest ORDER BY ctid;
  ctid  | cmin | foobar 
 -------+------+--------
- (0,2) |   12 |     11
- (0,2) |   12 |     12
+ (0,3) |   12 |     11
+ (0,4) |   12 |     12
 (2 rows)
 
 -- ROLLBACK TO s1;
@@ -39,8 +39,8 @@ SELECT ctid,cmin,* FROM combocidtest ORDER BY ctid;
 SELECT ctid,cmin,* FROM combocidtest ORDER BY ctid;
  ctid  | cmin | foobar 
 -------+------+--------
- (0,2) |   12 |     11
- (0,2) |   12 |     12
+ (0,3) |   12 |     11
+ (0,4) |   12 |     12
 (2 rows)
 
 COMMIT;
@@ -48,8 +48,8 @@ COMMIT;
 SELECT ctid,cmin,* FROM combocidtest;
  ctid  | cmin | foobar 
 -------+------+--------
- (0,2) |   12 |     11
- (0,2) |   12 |     12
+ (0,3) |   12 |     11
+ (0,4) |   12 |     12
 (2 rows)
 
 -- Test combo cids with portals
@@ -60,17 +60,17 @@ DELETE FROM combocidtest;
 FETCH ALL FROM c;
  ctid  | cmin | foobar 
 -------+------+--------
- (0,2) |    2 |     11
- (0,2) |    2 |     12
- (0,3) |    0 |    333
+ (0,3) |    1 |     11
+ (0,4) |    1 |     12
+ (0,5) |    0 |    333
 (3 rows)
 
 ROLLBACK;
 SELECT ctid,cmin,* FROM combocidtest ORDER BY ctid;
  ctid  | cmin | foobar 
 -------+------+--------
- (0,2) |    2 |     11
- (0,2) |    2 |     12
+ (0,3) |    1 |     11
+ (0,4) |    1 |     12
 (2 rows)
 
 -- check behavior with locked tuples
@@ -90,9 +90,9 @@ INSERT INTO combocidtest VALUES (444);
 SELECT ctid,cmin,* FROM combocidtest ORDER BY ctid;
  ctid  | cmin | foobar 
 -------+------+--------
- (0,2) |    2 |     11
- (0,2) |    2 |     12
- (0,4) |   10 |    444
+ (0,3) |    1 |     11
+ (0,4) |    1 |     12
+ (0,6) |   10 |    444
 (3 rows)
 
 -- SAVEPOINT s1;
@@ -100,17 +100,17 @@ SELECT ctid,cmin,* FROM combocidtest ORDER BY ctid;
 SELECT ctid,cmin,* FROM combocidtest FOR UPDATE;
  ctid  | cmin | foobar 
 -------+------+--------
- (0,2) |    2 |     11
- (0,2) |    2 |     12
- (0,4) |   10 |    444
+ (0,3) |    1 |     11
+ (0,4) |    1 |     12
+ (0,6) |   10 |    444
 (3 rows)
 
 SELECT ctid,cmin,* FROM combocidtest ORDER BY ctid;
  ctid  | cmin | foobar 
 -------+------+--------
- (0,2) |    2 |     11
- (0,2) |    2 |     12
- (0,4) |   10 |    444
+ (0,3) |    1 |     11
+ (0,4) |    1 |     12
+ (0,6) |   10 |    444
 (3 rows)
 
 -- but this does
@@ -118,27 +118,27 @@ UPDATE combocidtest SET foobar = foobar + 10;
 SELECT ctid,cmin,* FROM combocidtest ORDER BY ctid;
  ctid  | cmin | foobar 
 -------+------+--------
- (0,3) |   12 |     21
- (0,5) |   12 |     22
- (0,6) |   12 |    454
+ (0,7) |   12 |     21
+ (0,8) |   12 |     22
+ (0,9) |   12 |    454
 (3 rows)
 
 -- ROLLBACK TO s1;
 SELECT ctid,cmin,* FROM combocidtest ORDER BY ctid;
  ctid  | cmin | foobar 
 -------+------+--------
- (0,3) |   12 |     21
- (0,5) |   12 |     22
- (0,6) |   12 |    454
+ (0,7) |   12 |     21
+ (0,8) |   12 |     22
+ (0,9) |   12 |    454
 (3 rows)
 
 COMMIT;
 SELECT ctid,cmin,* FROM combocidtest ORDER BY ctid;
  ctid  | cmin | foobar 
 -------+------+--------
- (0,3) |   12 |     21
- (0,5) |   12 |     22
- (0,6) |   12 |    454
+ (0,7) |   12 |     21
+ (0,8) |   12 |     22
+ (0,9) |   12 |    454
 (3 rows)
 
 -- test for bug reported in
index 9b1f306c7c9c2d778ad4a50703a82fe855da8011..236c3ac5abfc34a3f9f318caebdfc53f55157e7c 100644 (file)
@@ -1,7 +1,7 @@
 --
 -- Tests for some likely failure cases with combo cmin/cmax mechanism
 --
-CREATE TEMP TABLE combocidtest (foobar int) DISTRIBUTE BY ROUNDROBIN;
+CREATE TEMP TABLE combocidtest (foobar int) DISTRIBUTE BY REPLICATION;
 
 BEGIN;