Skip to content

Commit 647fda5

Browse files
committed
pathman: isolation tests
1 parent 9472ae0 commit 647fda5

File tree

4 files changed

+111
-9
lines changed

4 files changed

+111
-9
lines changed

contrib/pg_pathman/Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ check: EXTRA_REGRESS_OPTS=--temp-config=$(top_srcdir)/$(subdir)/conf.add
2828

2929
ISOLATIONCHECKS=insert_trigger
3030

31-
isolationcheck:
31+
submake-isolation:
32+
$(MAKE) -C $(top_builddir)/src/test/isolation all
33+
34+
isolationcheck: | submake-isolation
3235
$(MKDIR_P) isolation_output
3336
$(pg_isolation_regress_check) \
3437
--temp-config=$(top_srcdir)/$(subdir)/conf.add \
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
Parsed test spec with 2 sessions
2+
3+
starting permutation: s1b s1_insert_150 s1r s1_show_partitions s2b s2_insert_150 s2c s2_show_partitions
4+
create_range_partitions
5+
6+
1
7+
step s1b: BEGIN;
8+
step s1_insert_150: INSERT INTO range_rel SELECT generate_series(1, 150);
9+
step s1r: ROLLBACK;
10+
step s1_show_partitions: SELECT * FROM pg_inherits WHERE inhparent = 'range_rel'::regclass::oid;
11+
inhrelid inhparent inhseqno
12+
13+
16453 16445 1
14+
16462 16445 1
15+
step s2b: BEGIN;
16+
step s2_insert_150: INSERT INTO range_rel SELECT generate_series(1, 150);
17+
step s2c: COMMIT;
18+
step s2_show_partitions: SELECT * FROM pg_inherits WHERE inhparent = 'range_rel'::regclass::oid;
19+
inhrelid inhparent inhseqno
20+
21+
16453 16445 1
22+
16462 16445 1
23+
24+
starting permutation: s1b s1_insert_150 s1r s1_show_partitions s2b s2_insert_300 s2c s2_show_partitions
25+
create_range_partitions
26+
27+
1
28+
step s1b: BEGIN;
29+
step s1_insert_150: INSERT INTO range_rel SELECT generate_series(1, 150);
30+
step s1r: ROLLBACK;
31+
step s1_show_partitions: SELECT * FROM pg_inherits WHERE inhparent = 'range_rel'::regclass::oid;
32+
inhrelid inhparent inhseqno
33+
34+
16537 16529 1
35+
16545 16529 1
36+
step s2b: BEGIN;
37+
step s2_insert_300: INSERT INTO range_rel SELECT generate_series(151, 300);
38+
step s2c: COMMIT;
39+
step s2_show_partitions: SELECT * FROM pg_inherits WHERE inhparent = 'range_rel'::regclass::oid;
40+
inhrelid inhparent inhseqno
41+
42+
16537 16529 1
43+
16545 16529 1
44+
16552 16529 1
45+
46+
starting permutation: s1b s1_insert_300 s1r s1_show_partitions s2b s2_insert_150 s2c s2_show_partitions
47+
create_range_partitions
48+
49+
1
50+
step s1b: BEGIN;
51+
step s1_insert_300: INSERT INTO range_rel SELECT generate_series(151, 300);
52+
step s1r: ROLLBACK;
53+
step s1_show_partitions: SELECT * FROM pg_inherits WHERE inhparent = 'range_rel'::regclass::oid;
54+
inhrelid inhparent inhseqno
55+
56+
16627 16619 1
57+
16635 16619 1
58+
16642 16619 1
59+
step s2b: BEGIN;
60+
step s2_insert_150: INSERT INTO range_rel SELECT generate_series(1, 150);
61+
step s2c: COMMIT;
62+
step s2_show_partitions: SELECT * FROM pg_inherits WHERE inhparent = 'range_rel'::regclass::oid;
63+
inhrelid inhparent inhseqno
64+
65+
16627 16619 1
66+
16635 16619 1
67+
16642 16619 1
68+
69+
starting permutation: s1b s1_insert_150 s2b s2_insert_300 s1r s2r s2_show_partitions
70+
create_range_partitions
71+
72+
1
73+
step s1b: BEGIN;
74+
step s1_insert_150: INSERT INTO range_rel SELECT generate_series(1, 150);
75+
step s2b: BEGIN;
76+
step s2_insert_300: INSERT INTO range_rel SELECT generate_series(151, 300);
77+
step s1r: ROLLBACK;
78+
step s2r: ROLLBACK;
79+
step s2_show_partitions: SELECT * FROM pg_inherits WHERE inhparent = 'range_rel'::regclass::oid;
80+
inhrelid inhparent inhseqno
81+
82+
16717 16709 1
83+
16725 16709 1
84+
16732 16709 1
Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,39 @@
11
setup
22
{
3-
--SELECT '>>> SETUP <<<';
43
CREATE EXTENSION pg_pathman;
54
CREATE TABLE range_rel(id serial primary key);
65
SELECT create_range_partitions('range_rel', 'id', 1, 100, 1);
76
}
87

98
teardown
109
{
11-
--SELECT '>>> TEARDOWN <<<';
12-
--SELECT drop_range_partitions('range_rel');
10+
SELECT drop_range_partitions('range_rel');
1311
DROP TABLE range_rel CASCADE;
1412
DROP EXTENSION pg_pathman;
1513
}
1614

1715
session "s1"
18-
step "s1i" { INSERT INTO range_rel SELECT generate_series(1, 150); }
19-
step "s1d" { SELECT * FROM pg_inherits WHERE inhparent = 'range_rel'::regclass::oid; }
16+
step "s1b" { BEGIN; }
17+
step "s1_insert_150" { INSERT INTO range_rel SELECT generate_series(1, 150); }
18+
step "s1_insert_300" { INSERT INTO range_rel SELECT generate_series(151, 300); }
19+
step "s1_show_partitions" { SELECT * FROM pg_inherits WHERE inhparent = 'range_rel'::regclass::oid; }
20+
step "s1r" { ROLLBACK; }
21+
step "s1c" { COMMIT; }
2022

2123
session "s2"
22-
step "s2i" { INSERT INTO range_rel SELECT generate_series(151, 300); }
24+
step "s2b" { BEGIN; }
25+
step "s2_insert_150" { INSERT INTO range_rel SELECT generate_series(1, 150); }
26+
step "s2_insert_300" { INSERT INTO range_rel SELECT generate_series(151, 300); }
27+
step "s2_show_partitions" { SELECT * FROM pg_inherits WHERE inhparent = 'range_rel'::regclass::oid; }
28+
step "s2r" { ROLLBACK; }
29+
step "s2c" { COMMIT; }
30+
31+
# Rollback first transactions
32+
permutation "s1b" "s1_insert_150" "s1r" "s1_show_partitions" "s2b" "s2_insert_150" "s2c" "s2_show_partitions"
33+
34+
permutation "s1b" "s1_insert_150" "s1r" "s1_show_partitions" "s2b" "s2_insert_300" "s2c" "s2_show_partitions"
35+
36+
permutation "s1b" "s1_insert_300" "s1r" "s1_show_partitions" "s2b" "s2_insert_150" "s2c" "s2_show_partitions"
37+
38+
# Rollback both transactions
39+
permutation "s1b" "s1_insert_150" "s2b" "s2_insert_300" "s1r" "s2r" "s2_show_partitions"

contrib/pg_pathman/worker.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,6 @@ bg_worker_main(Datum main_arg)
102102
PartitionArgs *args;
103103
dsm_handle handle = DatumGetInt32(main_arg);
104104

105-
elog(WARNING, "Worker started. Handle %d", handle);
106-
107105
/* Create resource owner */
108106
CurrentResourceOwner = ResourceOwnerCreate(NULL, "CreatePartitionsWorker");
109107

0 commit comments

Comments
 (0)