1# Force usage of ondisk decoding snapshots to test that code path.
2setup
3{
4    DROP TABLE IF EXISTS do_write;
5    CREATE TABLE do_write(id serial primary key);
6}
7
8teardown
9{
10    DROP TABLE do_write;
11    SELECT 'stop' FROM pg_drop_replication_slot('isolation_slot');
12}
13
14
15session "s1"
16setup { SET synchronous_commit=on; }
17
18step "s1init" {SELECT 'init' FROM pg_create_logical_replication_slot('isolation_slot', 'test_decoding');}
19step "s1start" {SELECT data FROM pg_logical_slot_get_changes('isolation_slot', NULL, NULL, 'include-xids', 'false');}
20step "s1insert" { INSERT INTO do_write DEFAULT VALUES; }
21step "s1checkpoint" { CHECKPOINT; }
22step "s1alter" { ALTER TABLE do_write ADD COLUMN addedbys1 int; }
23
24session "s2"
25setup { SET synchronous_commit=on; }
26
27step "s2b" { BEGIN; }
28step "s2txid" { SELECT pg_current_xact_id() IS NULL; }
29step "s2alter" { ALTER TABLE do_write ADD COLUMN addedbys2 int; }
30step "s2c" { COMMIT; }
31
32
33session "s3"
34setup { SET synchronous_commit=on; }
35
36step "s3b" { BEGIN; }
37step "s3txid" { SELECT pg_current_xact_id() IS NULL; }
38step "s3c" { COMMIT; }
39
40# Force usage of ondisk snapshot by starting and not finishing a
41# transaction with an assigned xid after consistency has been
42# reached. In combination with a checkpoint forcing a snapshot to be
43# written and a new restart point computed that'll lead to the usage
44# of the snapshot.
45permutation "s2b" "s2txid" "s1init" "s3b" "s3txid" "s2alter" "s2c" "s2b" "s2txid" "s3c" "s2c" "s1insert" "s1checkpoint" "s1start" "s1insert" "s1alter" "s1insert" "s1start"
46