Skip to content

Commit ef49305

Browse files
committed
Force synchronous commit to be enabled for all test_decoding tests.
Without that the tests fail when forced to be run against a cluster with synchronous_commit = off (as the WAL might not yet be flushed to disk by the point logical decoding gets called, and thus the expected output breaks). Most tests already do that, add it to a few newer tests. Author: Andres Freund
1 parent f82d4d6 commit ef49305

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

contrib/test_decoding/expected/truncate.out

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
-- predictability
2+
SET synchronous_commit = on;
13
SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot', 'test_decoding');
24
?column?
35
----------

contrib/test_decoding/specs/oldest_xmin.spec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ teardown
1717
}
1818

1919
session "s0"
20+
setup { SET synchronous_commit=on; }
2021
step "s0_begin" { BEGIN; }
2122
step "s0_getxid" { SELECT txid_current() IS NULL; }
2223
step "s0_alter" { ALTER TYPE basket DROP ATTRIBUTE mangos; }
@@ -26,6 +27,7 @@ step "s0_vacuum" { VACUUM pg_attribute; }
2627
step "s0_get_changes" { SELECT data FROM pg_logical_slot_get_changes('isolation_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1'); }
2728

2829
session "s1"
30+
setup { SET synchronous_commit=on; }
2931
step "s1_begin" { BEGIN; }
3032
step "s1_insert" { INSERT INTO harvest VALUES ((1, 2, 3)); }
3133
step "s1_commit" { COMMIT; }

contrib/test_decoding/specs/snapshot_transfer.spec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ teardown
1717
}
1818

1919
session "s0"
20+
setup { SET synchronous_commit=on; }
2021
step "s0_begin" { BEGIN; }
2122
step "s0_begin_sub0" { SAVEPOINT s0; }
2223
step "s0_log_assignment" { SELECT txid_current() IS NULL; }
@@ -30,6 +31,7 @@ step "s0_commit" { COMMIT; }
3031
step "s0_get_changes" { SELECT data FROM pg_logical_slot_get_changes('isolation_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1'); }
3132

3233
session "s1"
34+
setup { SET synchronous_commit=on; }
3335
step "s1_produce_new_snap" { ALTER TABLE harvest ADD COLUMN mangos int; }
3436

3537
# start top-level without base snap, get base snap in subxact, then create new

contrib/test_decoding/sql/truncate.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
-- predictability
2+
SET synchronous_commit = on;
3+
14
SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot', 'test_decoding');
25

36
CREATE TABLE tab1 (id serial unique, data int);

0 commit comments

Comments
 (0)