mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-12 18:34:36 +08:00
Re-add BRIN isolation test
This time, instead of using a core isolation test, put it on its own test module; this way it can require the pageinspect module to be present before running. The module's Makefile is loosely modeled after test_decoding's, so that it's easy to add further tests for either pg_regress or isolationtester later. Backpatch to 9.5.
This commit is contained in:
parent
6a0779a397
commit
672e3ec0e9
@ -5,6 +5,7 @@ top_builddir = ../../..
|
|||||||
include $(top_builddir)/src/Makefile.global
|
include $(top_builddir)/src/Makefile.global
|
||||||
|
|
||||||
SUBDIRS = \
|
SUBDIRS = \
|
||||||
|
brin \
|
||||||
commit_ts \
|
commit_ts \
|
||||||
dummy_seclabel \
|
dummy_seclabel \
|
||||||
test_ddl_deparse \
|
test_ddl_deparse \
|
||||||
|
3
src/test/modules/brin/.gitignore
vendored
Normal file
3
src/test/modules/brin/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Generated subdirectories
|
||||||
|
/isolation_output/
|
||||||
|
/tmp_check/
|
30
src/test/modules/brin/Makefile
Normal file
30
src/test/modules/brin/Makefile
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
# src/test/modules/brin/Makefile
|
||||||
|
|
||||||
|
EXTRA_CLEAN = ./isolation_output
|
||||||
|
EXTRA_INSTALL=contrib/pageinspect
|
||||||
|
|
||||||
|
ISOLATIONCHECKS=summarization-and-inprogress-insertion
|
||||||
|
|
||||||
|
ifdef USE_PGXS
|
||||||
|
PG_CONFIG = pg_config
|
||||||
|
PGXS := $(shell $(PG_CONFIG) --pgxs)
|
||||||
|
include $(PGXS)
|
||||||
|
else
|
||||||
|
subdir = src/test/modules/brin
|
||||||
|
top_builddir = ../../../..
|
||||||
|
include $(top_builddir)/src/Makefile.global
|
||||||
|
include $(top_srcdir)/contrib/contrib-global.mk
|
||||||
|
endif
|
||||||
|
|
||||||
|
check: isolation-check
|
||||||
|
|
||||||
|
isolation-check: | submake-isolation
|
||||||
|
$(MKDIR_P) isolation_output
|
||||||
|
$(pg_isolation_regress_check) \
|
||||||
|
--outputdir=./isolation_output \
|
||||||
|
$(ISOLATIONCHECKS)
|
||||||
|
|
||||||
|
PHONY: check isolation-check
|
||||||
|
|
||||||
|
submake-isolation:
|
||||||
|
$(MAKE) -C $(top_builddir)/src/test/isolation all
|
@ -0,0 +1,39 @@
|
|||||||
|
Parsed test spec with 2 sessions
|
||||||
|
|
||||||
|
starting permutation: s2check s1b s2b s1i s2summ s1c s2c s2check
|
||||||
|
step s2check: SELECT * FROM brin_page_items(get_raw_page('brinidx', 2), 'brinidx'::regclass);
|
||||||
|
itemoffset blknum attnum allnulls hasnulls placeholder value
|
||||||
|
|
||||||
|
1 0 1 f f f {1 .. 1}
|
||||||
|
step s1b: BEGIN ISOLATION LEVEL REPEATABLE READ;
|
||||||
|
step s2b: BEGIN ISOLATION LEVEL REPEATABLE READ; SELECT 1;
|
||||||
|
?column?
|
||||||
|
|
||||||
|
1
|
||||||
|
step s1i: INSERT INTO brin_iso VALUES (1000);
|
||||||
|
step s2summ: SELECT brin_summarize_new_values('brinidx'::regclass);
|
||||||
|
brin_summarize_new_values
|
||||||
|
|
||||||
|
1
|
||||||
|
step s1c: COMMIT;
|
||||||
|
step s2c: COMMIT;
|
||||||
|
step s2check: SELECT * FROM brin_page_items(get_raw_page('brinidx', 2), 'brinidx'::regclass);
|
||||||
|
itemoffset blknum attnum allnulls hasnulls placeholder value
|
||||||
|
|
||||||
|
1 0 1 f f f {1 .. 1}
|
||||||
|
2 1 1 f f f {1 .. 1000}
|
||||||
|
|
||||||
|
starting permutation: s2check s1b s1i s2vacuum s1c s2check
|
||||||
|
step s2check: SELECT * FROM brin_page_items(get_raw_page('brinidx', 2), 'brinidx'::regclass);
|
||||||
|
itemoffset blknum attnum allnulls hasnulls placeholder value
|
||||||
|
|
||||||
|
1 0 1 f f f {1 .. 1}
|
||||||
|
step s1b: BEGIN ISOLATION LEVEL REPEATABLE READ;
|
||||||
|
step s1i: INSERT INTO brin_iso VALUES (1000);
|
||||||
|
step s2vacuum: VACUUM brin_iso;
|
||||||
|
step s1c: COMMIT;
|
||||||
|
step s2check: SELECT * FROM brin_page_items(get_raw_page('brinidx', 2), 'brinidx'::regclass);
|
||||||
|
itemoffset blknum attnum allnulls hasnulls placeholder value
|
||||||
|
|
||||||
|
1 0 1 f f f {1 .. 1}
|
||||||
|
2 1 1 f f f {1 .. 1000}
|
@ -0,0 +1,44 @@
|
|||||||
|
# This test verifies that values inserted in transactions still in progress
|
||||||
|
# are considered during concurrent range summarization (either using the
|
||||||
|
# brin_summarize_new_values function or regular VACUUM).
|
||||||
|
|
||||||
|
setup
|
||||||
|
{
|
||||||
|
CREATE TABLE brin_iso (
|
||||||
|
value int
|
||||||
|
) WITH (fillfactor=10);
|
||||||
|
CREATE INDEX brinidx ON brin_iso USING brin (value) WITH (pages_per_range=1);
|
||||||
|
-- this fills the first page
|
||||||
|
DO $$
|
||||||
|
DECLARE curtid tid;
|
||||||
|
BEGIN
|
||||||
|
LOOP
|
||||||
|
INSERT INTO brin_iso VALUES (1) RETURNING ctid INTO curtid;
|
||||||
|
EXIT WHEN curtid > tid '(1, 0)';
|
||||||
|
END LOOP;
|
||||||
|
END;
|
||||||
|
$$;
|
||||||
|
CREATE EXTENSION IF NOT EXISTS pageinspect;
|
||||||
|
}
|
||||||
|
|
||||||
|
teardown
|
||||||
|
{
|
||||||
|
DROP TABLE brin_iso;
|
||||||
|
}
|
||||||
|
|
||||||
|
session "s1"
|
||||||
|
step "s1b" { BEGIN ISOLATION LEVEL REPEATABLE READ; }
|
||||||
|
step "s1i" { INSERT INTO brin_iso VALUES (1000); }
|
||||||
|
step "s1c" { COMMIT; }
|
||||||
|
|
||||||
|
session "s2"
|
||||||
|
step "s2b" { BEGIN ISOLATION LEVEL REPEATABLE READ; SELECT 1; }
|
||||||
|
step "s2summ" { SELECT brin_summarize_new_values('brinidx'::regclass); }
|
||||||
|
step "s2c" { COMMIT; }
|
||||||
|
|
||||||
|
step "s2vacuum" { VACUUM brin_iso; }
|
||||||
|
|
||||||
|
step "s2check" { SELECT * FROM brin_page_items(get_raw_page('brinidx', 2), 'brinidx'::regclass); }
|
||||||
|
|
||||||
|
permutation "s2check" "s1b" "s2b" "s1i" "s2summ" "s1c" "s2c" "s2check"
|
||||||
|
permutation "s2check" "s1b" "s1i" "s2vacuum" "s1c" "s2check"
|
Loading…
Reference in New Issue
Block a user