Merge pull request #2721 from citusdata/fix_test_2pc

Fix wrong transaction recovery test output
pull/2727/head
Önder Kalacı 2019-05-22 08:39:46 +02:00 committed by GitHub
commit 178142fe01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -224,7 +224,10 @@ SELECT recover_prepared_transactions();
(1 row) (1 row)
-- Create a single-replica table to enable 2PC in multi-statement transactions -- Create a single-replica table to enable 2PC in multi-statement transactions
SET citus.shard_replication_factor TO 1;
CREATE TABLE test_recovery_single (LIKE test_recovery); CREATE TABLE test_recovery_single (LIKE test_recovery);
-- creating distributed table should write 2 transaction recovery records
-- one connection/transaction per node
SELECT create_distributed_table('test_recovery_single', 'x'); SELECT create_distributed_table('test_recovery_single', 'x');
create_distributed_table create_distributed_table
-------------------------- --------------------------
@ -232,6 +235,8 @@ SELECT create_distributed_table('test_recovery_single', 'x');
(1 row) (1 row)
-- Multi-statement transactions should write 2 transaction recovery records -- Multi-statement transactions should write 2 transaction recovery records
-- since the transaction block expands the nodes that participate in the
-- distributed transaction
BEGIN; BEGIN;
INSERT INTO test_recovery_single VALUES ('hello-0'); INSERT INTO test_recovery_single VALUES ('hello-0');
INSERT INTO test_recovery_single VALUES ('hello-2'); INSERT INTO test_recovery_single VALUES ('hello-2');
@ -239,7 +244,7 @@ COMMIT;
SELECT count(*) FROM pg_dist_transaction; SELECT count(*) FROM pg_dist_transaction;
count count
------- -------
2 4
(1 row) (1 row)
-- Test whether auto-recovery runs -- Test whether auto-recovery runs

View File

@ -110,10 +110,16 @@ SELECT count(*) FROM pg_dist_transaction;
SELECT recover_prepared_transactions(); SELECT recover_prepared_transactions();
-- Create a single-replica table to enable 2PC in multi-statement transactions -- Create a single-replica table to enable 2PC in multi-statement transactions
SET citus.shard_replication_factor TO 1;
CREATE TABLE test_recovery_single (LIKE test_recovery); CREATE TABLE test_recovery_single (LIKE test_recovery);
-- creating distributed table should write 2 transaction recovery records
-- one connection/transaction per node
SELECT create_distributed_table('test_recovery_single', 'x'); SELECT create_distributed_table('test_recovery_single', 'x');
-- Multi-statement transactions should write 2 transaction recovery records -- Multi-statement transactions should write 2 transaction recovery records
-- since the transaction block expands the nodes that participate in the
-- distributed transaction
BEGIN; BEGIN;
INSERT INTO test_recovery_single VALUES ('hello-0'); INSERT INTO test_recovery_single VALUES ('hello-0');
INSERT INTO test_recovery_single VALUES ('hello-2'); INSERT INTO test_recovery_single VALUES ('hello-2');