Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit672e3ec

Browse files
committed
Re-add BRIN isolation test
This time, instead of using a core isolation test, put it on its owntest module; this way it can require the pageinspect module to bepresent before running.The module's Makefile is loosely modeled after test_decoding's, so thatit's easy to add further tests for either pg_regress or isolationtesterlater.Backpatch to 9.5.
1 parent6a0779a commit672e3ec

File tree

5 files changed

+117
-0
lines changed

5 files changed

+117
-0
lines changed

‎src/test/modules/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ top_builddir = ../../..
55
include$(top_builddir)/src/Makefile.global
66

77
SUBDIRS =\
8+
brin\
89
commit_ts\
910
dummy_seclabel\
1011
test_ddl_deparse\

‎src/test/modules/brin/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Generated subdirectories
2+
/isolation_output/
3+
/tmp_check/

‎src/test/modules/brin/Makefile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# src/test/modules/brin/Makefile
2+
3+
EXTRA_CLEAN = ./isolation_output
4+
EXTRA_INSTALL=contrib/pageinspect
5+
6+
ISOLATIONCHECKS=summarization-and-inprogress-insertion
7+
8+
ifdefUSE_PGXS
9+
PG_CONFIG = pg_config
10+
PGXS :=$(shell$(PG_CONFIG) --pgxs)
11+
include$(PGXS)
12+
else
13+
subdir = src/test/modules/brin
14+
top_builddir = ../../../..
15+
include$(top_builddir)/src/Makefile.global
16+
include$(top_srcdir)/contrib/contrib-global.mk
17+
endif
18+
19+
check: isolation-check
20+
21+
isolation-check: | submake-isolation
22+
$(MKDIR_P) isolation_output
23+
$(pg_isolation_regress_check)\
24+
--outputdir=./isolation_output\
25+
$(ISOLATIONCHECKS)
26+
27+
PHONY: check isolation-check
28+
29+
submake-isolation:
30+
$(MAKE) -C$(top_builddir)/src/test/isolation all
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
Parsed test spec with 2 sessions
2+
3+
starting permutation: s2check s1b s2b s1i s2summ s1c s2c s2check
4+
step s2check: SELECT * FROM brin_page_items(get_raw_page('brinidx', 2), 'brinidx'::regclass);
5+
itemoffset blknum attnum allnulls hasnulls placeholder value
6+
7+
1 0 1 f f f {1 .. 1}
8+
step s1b: BEGIN ISOLATION LEVEL REPEATABLE READ;
9+
step s2b: BEGIN ISOLATION LEVEL REPEATABLE READ; SELECT 1;
10+
?column?
11+
12+
1
13+
step s1i: INSERT INTO brin_iso VALUES (1000);
14+
step s2summ: SELECT brin_summarize_new_values('brinidx'::regclass);
15+
brin_summarize_new_values
16+
17+
1
18+
step s1c: COMMIT;
19+
step s2c: COMMIT;
20+
step s2check: SELECT * FROM brin_page_items(get_raw_page('brinidx', 2), 'brinidx'::regclass);
21+
itemoffset blknum attnum allnulls hasnulls placeholder value
22+
23+
1 0 1 f f f {1 .. 1}
24+
2 1 1 f f f {1 .. 1000}
25+
26+
starting permutation: s2check s1b s1i s2vacuum s1c s2check
27+
step s2check: SELECT * FROM brin_page_items(get_raw_page('brinidx', 2), 'brinidx'::regclass);
28+
itemoffset blknum attnum allnulls hasnulls placeholder value
29+
30+
1 0 1 f f f {1 .. 1}
31+
step s1b: BEGIN ISOLATION LEVEL REPEATABLE READ;
32+
step s1i: INSERT INTO brin_iso VALUES (1000);
33+
step s2vacuum: VACUUM brin_iso;
34+
step s1c: COMMIT;
35+
step s2check: SELECT * FROM brin_page_items(get_raw_page('brinidx', 2), 'brinidx'::regclass);
36+
itemoffset blknum attnum allnulls hasnulls placeholder value
37+
38+
1 0 1 f f f {1 .. 1}
39+
2 1 1 f f f {1 .. 1000}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# This test verifies that values inserted in transactions still in progress
2+
# are considered during concurrent range summarization (either using the
3+
# brin_summarize_new_values function or regular VACUUM).
4+
5+
setup
6+
{
7+
CREATETABLEbrin_iso(
8+
valueint
9+
)WITH(fillfactor=10);
10+
CREATEINDEXbrinidxONbrin_isoUSINGbrin(value)WITH(pages_per_range=1);
11+
--thisfillsthefirstpage
12+
DO $$
13+
DECLAREcurtidtid;
14+
BEGIN
15+
LOOP
16+
INSERTINTObrin_isoVALUES(1)RETURNINGctidINTOcurtid;
17+
EXITWHENcurtid >tid'(1, 0)';
18+
ENDLOOP;
19+
END;
20+
$$;
21+
CREATEEXTENSIONIFNOTEXISTSpageinspect;
22+
}
23+
24+
teardown
25+
{
26+
DROPTABLEbrin_iso;
27+
}
28+
29+
session"s1"
30+
step"s1b"{BEGINISOLATIONLEVELREPEATABLEREAD;}
31+
step"s1i"{INSERTINTObrin_isoVALUES(1000);}
32+
step"s1c"{COMMIT;}
33+
34+
session"s2"
35+
step"s2b"{BEGINISOLATIONLEVELREPEATABLEREAD;SELECT1;}
36+
step"s2summ"{SELECTbrin_summarize_new_values('brinidx'::regclass);}
37+
step"s2c"{COMMIT;}
38+
39+
step"s2vacuum"{VACUUMbrin_iso;}
40+
41+
step"s2check"{SELECT *FROMbrin_page_items(get_raw_page('brinidx',2),'brinidx'::regclass);}
42+
43+
permutation"s2check""s1b""s2b""s1i""s2summ""s1c""s2c""s2check"
44+
permutation"s2check""s1b""s1i""s2vacuum""s1c""s2check"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp