Resolve failures in the prepared_xacts regression test suite
authorTomas Vondra <[email protected]>
Sun, 23 Apr 2017 16:46:01 +0000 (18:46 +0200)
committerTomas Vondra <[email protected]>
Sun, 23 Apr 2017 16:46:01 +0000 (18:46 +0200)
This simply adopts the expected results from Postgres-XL 9.5,
instead of the results (apparently) inherited from upstream.

src/test/regress/expected/prepared_xacts.out

index b795fc8151015dcf536442d2025a81eaa00a4f5f..ce5a30c2eba269d2680a8d9edf0beda9edf2c985 100644 (file)
@@ -6,7 +6,7 @@
 -- isn't really needed ... stopping and starting the postmaster would
 -- be enough, but we can't even do that here.
 -- create a simple table that we'll use in the tests
-CREATE TABLE pxtest1 (foobar VARCHAR(10));
+CREATE TABLE pxtest1 (foobar VARCHAR(10)) distribute by replication;
 INSERT INTO pxtest1 VALUES ('aaa');
 -- Test PREPARE TRANSACTION
 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
@@ -110,7 +110,6 @@ SELECT pgxc_prepared_xact FROM pgxc_prepared_xacts ORDER by 1;
 
 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
 INSERT INTO pxtest1 VALUES ('fff');
-SELECT * FROM pxtest1  ORDER BY foobar;
 -- This should fail, because the gid foo3 is already in use
 PREPARE TRANSACTION 'foo3';
 ERROR:  transaction identifier "foo3" is already in use
@@ -156,22 +155,24 @@ SELECT * FROM pxtest1;
 
 -- This should fail, because the two transactions have a write-skew anomaly
 INSERT INTO pxtest1 VALUES ('fff');
-ERROR:  could not serialize access due to read/write dependencies among transactions
-DETAIL:  Reason code: Canceled on identification as a pivot, during write.
-HINT:  The transaction might succeed if retried.
 PREPARE TRANSACTION 'foo5';
 SELECT gid FROM pg_prepared_xacts;
  gid  
 ------
  foo4
-(1 row)
+ foo5
+(2 rows)
 
 ROLLBACK PREPARED 'foo4';
 SELECT gid FROM pg_prepared_xacts;
- gid 
------
-(0 rows)
+ gid  
+------
+ foo5
+(1 row)
 
+-- In Postgres-XL, serializable is not yet supported, and SERIALIZABLE falls to
+-- read-committed silently, so rollback transaction properly
+ROLLBACK PREPARED 'foo5';
 -- Clean up
 DROP TABLE pxtest1;
 -- Test subtransactions
@@ -179,10 +180,15 @@ BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
   CREATE TABLE pxtest2 (a int);
   INSERT INTO pxtest2 VALUES (1);
   SAVEPOINT a;
+ERROR:  SAVEPOINT is not yet supported.
     INSERT INTO pxtest2 VALUES (2);
+ERROR:  current transaction is aborted, commands ignored until end of transaction block
   ROLLBACK TO a;
+ERROR:  no such savepoint
   SAVEPOINT b;
+ERROR:  current transaction is aborted, commands ignored until end of transaction block
   INSERT INTO pxtest2 VALUES (3);
+ERROR:  current transaction is aborted, commands ignored until end of transaction block
 PREPARE TRANSACTION 'regress-one';
 CREATE TABLE pxtest3(fff int);
 -- Test shared invalidation
@@ -212,9 +218,15 @@ LINE 1: SELECT * FROM pxtest2;
 SELECT gid FROM pg_prepared_xacts ORDER BY gid;
      gid     
 -------------
- regress-one
  regress-two
-(2 rows)
+(1 row)
+
+-- Check prepared transactions in the cluster
+SELECT pgxc_prepared_xact FROM pgxc_prepared_xacts ORDER by 1;
+ pgxc_prepared_xact 
+--------------------
+ regress-two
+(1 row)
 
 -- pxtest3 should be locked because of the pending DROP
 begin;
@@ -228,9 +240,15 @@ rollback;
 SELECT gid FROM pg_prepared_xacts ORDER BY gid;
      gid     
 -------------
- regress-one
  regress-two
-(2 rows)
+(1 row)
+
+-- Check prepared transactions in the cluster
+SELECT pgxc_prepared_xact FROM pgxc_prepared_xacts ORDER by 1;
+ pgxc_prepared_xact 
+--------------------
+ regress-two
+(1 row)
 
 -- pxtest3 should still be locked because of the pending DROP
 begin;
@@ -240,21 +258,14 @@ ERROR:  canceling statement due to statement timeout
 rollback;
 -- Commit table creation
 COMMIT PREPARED 'regress-one';
+ERROR:  prepared transaction with identifier "regress-one" does not exist
 \d pxtest2
-    Table "public.pxtest2"
- Column |  Type   | Modifiers 
---------+---------+-----------
- a      | integer | 
-
 SELECT * FROM pxtest2;
- a 
----
- 1
- 3
-(2 rows)
-
+ERROR:  relation "pxtest2" does not exist
+LINE 1: SELECT * FROM pxtest2;
+                      ^
 -- There should be one prepared transaction
-SELECT gid FROM pg_prepared_xacts;
+SELECT gid FROM pg_prepared_xacts ORDER BY 1;
      gid     
 -------------
  regress-two
@@ -287,6 +298,7 @@ SELECT pgxc_prepared_xact FROM pgxc_prepared_xacts ORDER by 1;
 
 -- Clean up
 DROP TABLE pxtest2;
+ERROR:  table "pxtest2" does not exist
 DROP TABLE pxtest3;  -- will still be there if prepared xacts are disabled
 ERROR:  table "pxtest3" does not exist
 DROP TABLE pxtest4;