Skip to content

Commit 720629c

Browse files
committed
new isolation test for 'FOR UPDATE' feature, rename 'insert_trigger.spec'
1 parent 69da310 commit 720629c

File tree

6 files changed

+73
-2
lines changed

6 files changed

+73
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.deps
2+
isolation_output
23
results/pg_pathman.out
34
regression.diffs
45
regression.out

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ endif
2727
$(EXTENSION)--$(EXTVERSION).sql: init.sql hash.sql range.sql
2828
cat $^ > $@
2929

30-
ISOLATIONCHECKS=insert_trigger
30+
ISOLATIONCHECKS=insert_nodes for_update
3131

3232
submake-isolation:
3333
$(MAKE) -C $(top_builddir)/src/test/isolation all

expected/for_update.out

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
Parsed test spec with 2 sessions
2+
3+
starting permutation: s1_b s1_update s2_select s1_r
4+
create_range_partitions
5+
6+
10
7+
step s1_b: begin;
8+
step s1_update: update test_tbl set id = 2 where id = 1;
9+
step s2_select: select * from test_tbl where id = 1;
10+
id val
11+
12+
1 1
13+
step s1_r: rollback;
14+
15+
starting permutation: s1_b s1_update s2_select_locked s1_r
16+
create_range_partitions
17+
18+
10
19+
step s1_b: begin;
20+
step s1_update: update test_tbl set id = 2 where id = 1;
21+
step s2_select_locked: select * from test_tbl where id = 1 for share; <waiting ...>
22+
step s1_r: rollback;
23+
step s2_select_locked: <... completed>
24+
id val
25+
26+
1 1
27+
28+
starting permutation: s1_b s1_update s2_select_locked s1_c
29+
create_range_partitions
30+
31+
10
32+
step s1_b: begin;
33+
step s1_update: update test_tbl set id = 2 where id = 1;
34+
step s2_select_locked: select * from test_tbl where id = 1 for share; <waiting ...>
35+
step s1_c: commit;
36+
step s2_select_locked: <... completed>
37+
id val
38+
File renamed without changes.

specs/for_update.spec

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
setup
2+
{
3+
create extension pg_pathman;
4+
create table test_tbl(id int not null, val real);
5+
insert into test_tbl select i, i from generate_series(1, 1000) as i;
6+
select create_range_partitions('test_tbl', 'id', 1, 100, 10);
7+
}
8+
9+
teardown
10+
{
11+
drop table test_tbl cascade;
12+
drop extension pg_pathman;
13+
}
14+
15+
session "s1"
16+
step "s1_b" { begin; }
17+
step "s1_c" { commit; }
18+
step "s1_r" { rollback; }
19+
step "s1_update" { update test_tbl set id = 2 where id = 1; }
20+
21+
session "s2"
22+
step "s2_b" { begin; }
23+
step "s2_c" { commit; }
24+
step "s2_select_locked" { select * from test_tbl where id = 1 for share; }
25+
step "s2_select" { select * from test_tbl where id = 1; }
26+
27+
28+
permutation "s1_b" "s1_update" "s2_select" "s1_r"
29+
30+
permutation "s1_b" "s1_update" "s2_select_locked" "s1_r"
31+
32+
permutation "s1_b" "s1_update" "s2_select_locked" "s1_c"

specs/insert_trigger.spec renamed to specs/insert_nodes.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ setup
77

88
teardown
99
{
10-
SELECT drop_range_partitions('range_rel');
10+
SELECT drop_partitions('range_rel');
1111
DROP TABLE range_rel CASCADE;
1212
DROP EXTENSION pg_pathman;
1313
}

0 commit comments

Comments
 (0)