From 3a64cfdde398c79cc22ba9d3969965db9bc2605b Mon Sep 17 00:00:00 2001 From: Tomas Vondra Date: Sun, 8 Oct 2017 23:44:27 +0200 Subject: [PATCH] Stabilize combocid test by replicating the table 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 | 62 +++++++++++++------------- src/test/regress/sql/combocid.sql | 2 +- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/test/regress/expected/combocid.out b/src/test/regress/expected/combocid.out index 28e36517af..ddfd95a600 100644 --- a/src/test/regress/expected/combocid.out +++ b/src/test/regress/expected/combocid.out @@ -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 diff --git a/src/test/regress/sql/combocid.sql b/src/test/regress/sql/combocid.sql index 9b1f306c7c..236c3ac5ab 100644 --- a/src/test/regress/sql/combocid.sql +++ b/src/test/regress/sql/combocid.sql @@ -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; -- 2.39.5