|
| 1 | +# Making and updating table before and after the snapshot. |
| 2 | + |
| 3 | +teardown { |
| 4 | + select pg_switch_to_snapshot( 0 ); |
| 5 | + select pg_remove_snapshot( ( select recent_snapshot from pg_control_snapshot() ) ); |
| 6 | + DROP TABLE IF EXISTS t1 CASCADE; |
| 7 | +} |
| 8 | + |
| 9 | +session "s1" |
| 10 | +step "s1_cr" { |
| 11 | + create table t1 as |
| 12 | + select generate_series as id, trim( to_char( generate_series, '000' ) ) as "name" |
| 13 | + from generate_series( 1, 10 ); |
| 14 | + create index t1_id_idx on t1 ( id ); |
| 15 | +} |
| 16 | +step "s1_sel" { |
| 17 | + copy ( select * from t1 order by id ) to STDOUT; |
| 18 | +} |
| 19 | +step "s1_upd" { |
| 20 | + update t1 set name = name || '_upd_sess1' where id % 4 = 0; |
| 21 | +} |
| 22 | +step "s1_del" { |
| 23 | + delete from t1 where id % 4 = 1; |
| 24 | +} |
| 25 | +step "s1_ins" { |
| 26 | + insert into t1 |
| 27 | + select generate_series as id, trim( to_char( generate_series, '000' ) ) || '_new' as "name" |
| 28 | + from generate_series( 11, 20 ); |
| 29 | +} |
| 30 | +step "s1_dr" { |
| 31 | + drop table t1; |
| 32 | +} |
| 33 | +step "s1_sb_0" { |
| 34 | + select pg_set_backend_snapshot( 0 ); |
| 35 | +} |
| 36 | +step "s1_sb_1" { |
| 37 | + select pg_set_backend_snapshot( ( select recent_snapshot - 2 from pg_control_snapshot() ) ); |
| 38 | +} |
| 39 | +step "s1_sb_2" { |
| 40 | + select pg_set_backend_snapshot( ( select recent_snapshot - 1 from pg_control_snapshot() ) ); |
| 41 | +} |
| 42 | +step "s1_sb_3" { |
| 43 | + select pg_set_backend_snapshot( ( select recent_snapshot from pg_control_snapshot() ) ); |
| 44 | +} |
| 45 | + |
| 46 | +session "s2" |
| 47 | +step "s2_sel" { |
| 48 | + copy ( select * from t1 order by id ) to STDOUT; |
| 49 | +} |
| 50 | +step "s2_upd" { |
| 51 | + update t1 set name = name || '_upd_sess2' where id % 4 = 2; |
| 52 | +} |
| 53 | +step "s2_sb_0" { |
| 54 | + select pg_set_backend_snapshot( 0 ); |
| 55 | +} |
| 56 | +step "s2_sb_1" { |
| 57 | + select pg_set_backend_snapshot( ( select recent_snapshot - 2 from pg_control_snapshot() ) ); |
| 58 | +} |
| 59 | +step "s2_sb_2" { |
| 60 | + select pg_set_backend_snapshot( ( select recent_snapshot - 1 from pg_control_snapshot() ) ); |
| 61 | +} |
| 62 | +step "s2_sb_3" { |
| 63 | + select pg_set_backend_snapshot( ( select recent_snapshot from pg_control_snapshot() ) ); |
| 64 | +} |
| 65 | + |
| 66 | +session "s3" |
| 67 | +step "s3_mk_sn" { |
| 68 | + select 1 from pg_make_snapshot(); |
| 69 | +} |
| 70 | +step "s3_sw_0" { |
| 71 | + select pg_switch_to_snapshot( 0 ); |
| 72 | +} |
| 73 | +step "s3_sw_1" { |
| 74 | + select pg_switch_to_snapshot( ( select recent_snapshot - 2 from pg_control_snapshot() ) ); |
| 75 | +} |
| 76 | +step "s3_sw_2" { |
| 77 | + select pg_switch_to_snapshot( ( select recent_snapshot - 1 from pg_control_snapshot() ) ); |
| 78 | +} |
| 79 | +step "s3_sw_3" { |
| 80 | + select pg_switch_to_snapshot( ( select recent_snapshot from pg_control_snapshot() ) ); |
| 81 | +} |
| 82 | +step "s3_rc_sn" { |
| 83 | + select pg_recover_to_snapshot( ( select recent_snapshot from pg_control_snapshot() ) ); |
| 84 | +} |
| 85 | +step "s3_rc_sn_1" { |
| 86 | + select pg_recover_to_snapshot( ( select recent_snapshot - 2 from pg_control_snapshot() ) ); |
| 87 | +} |
| 88 | +step "s3_rc_sn_2" { |
| 89 | + select pg_recover_to_snapshot( ( select recent_snapshot - 1 from pg_control_snapshot() ) ); |
| 90 | +} |
| 91 | + |
| 92 | +permutation "s3_mk_sn" "s1_cr" "s1_upd" "s2_upd" "s3_mk_sn" "s1_del" "s3_mk_sn" "s1_dr" "s3_sw_1" "s1_sel" "s2_sel" "s3_sw_2" "s1_sel" "s2_sel" "s3_sw_3" "s1_sel" "s2_sel" "s3_sw_0" "s1_sel" "s2_sel" |
| 93 | +permutation "s3_mk_sn" "s1_cr" "s1_upd" "s2_upd" "s3_mk_sn" "s1_del" "s3_mk_sn" "s1_dr" "s1_sb_1" "s1_sel" "s2_sel" "s1_sb_2" "s1_sel" "s2_sel" "s1_sb_3" "s1_sel" "s2_sel" "s1_sb_0" "s1_sel" "s2_sel" |
| 94 | +permutation "s3_mk_sn" "s1_cr" "s1_upd" "s2_upd" "s3_mk_sn" "s1_del" "s3_mk_sn" "s1_dr" "s2_sb_1" "s1_sel" "s2_sel" "s2_sb_2" "s1_sel" "s2_sel" "s2_sb_3" "s1_sel" "s2_sel" "s2_sb_0" "s1_sel" "s2_sel" |
| 95 | +permutation "s3_mk_sn" "s1_cr" "s1_upd" "s2_upd" "s3_mk_sn" "s1_del" "s3_mk_sn" "s1_dr" "s3_rc_sn" "s1_sel" "s2_sel" "s3_rc_sn" "s1_sel" "s2_sel" "s3_rc_sn" "s1_sel" "s2_sel" "s3_mk_sn" |
| 96 | +permutation "s3_mk_sn" "s1_cr" "s1_upd" "s2_upd" "s3_mk_sn" "s1_del" "s3_mk_sn" "s1_dr" "s3_rc_sn_2" "s1_sel" "s2_sel" "s3_mk_sn" |
0 commit comments