| 1 |
# Force usage of ondisk decoding snapshots to test that code path. |
| 2 |
setup |
| 3 |
{ |
| 4 |
DROP TABLE IF EXISTS do_write; |
| 5 |
CREATE TABLE do_write(id serial primary key); |
| 6 |
} |
| 7 |
|
| 8 |
teardown |
| 9 |
{ |
| 10 |
DROP TABLE do_write; |
| 11 |
SELECT 'stop' FROM pg_drop_replication_slot('isolation_slot'); |
| 12 |
} |
| 13 |
|
| 14 |
|
| 15 |
session "s1" |
| 16 |
setup { SET synchronous_commit=on; } |
| 17 |
|
| 18 |
step "s1init" {SELECT 'init' FROM pg_create_logical_replication_slot('isolation_slot', 'test_decoding');} |
| 19 |
step "s1start" {SELECT data FROM pg_logical_slot_get_changes('isolation_slot', NULL, NULL, 'include-xids', 'false');} |
| 20 |
step "s1insert" { INSERT INTO do_write DEFAULT VALUES; } |
| 21 |
step "s1checkpoint" { CHECKPOINT; } |
| 22 |
step "s1alter" { ALTER TABLE do_write ADD COLUMN addedbys1 int; } |
| 23 |
|
| 24 |
session "s2" |
| 25 |
setup { SET synchronous_commit=on; } |
| 26 |
|
| 27 |
step "s2b" { BEGIN; } |
| 28 |
step "s2txid" { SELECT pg_current_xact_id() IS NULL; } |
| 29 |
step "s2alter" { ALTER TABLE do_write ADD COLUMN addedbys2 int; } |
| 30 |
step "s2c" { COMMIT; } |
| 31 |
|
| 32 |
|
| 33 |
session "s3" |
| 34 |
setup { SET synchronous_commit=on; } |
| 35 |
|
| 36 |
step "s3b" { BEGIN; } |
| 37 |
step "s3txid" { SELECT pg_current_xact_id() IS NULL; } |
| 38 |
step "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. |
| 45 |
permutation "s2b" "s2txid" "s1init" "s3b" "s3txid" "s2alter" "s2c" "s2b" "s2txid" "s3c" "s2c" "s1insert" "s1checkpoint" "s1start" "s1insert" "s1alter" "s1insert" "s1start" |