add isolation tests

merge-cstore-pykello
Hadi Moshayedi 2020-10-05 10:43:03 -07:00
parent 2ede755107
commit 74dd1facf3
5 changed files with 137 additions and 0 deletions

View File

@ -35,6 +35,7 @@ DATA = cstore_fdw--1.7.sql cstore_fdw--1.6--1.7.sql cstore_fdw--1.5--1.6.sql cs
cstore_fdw--1.0--1.1.sql cstore_fdw--1.7--1.8.sql cstore_fdw--1.0--1.1.sql cstore_fdw--1.7--1.8.sql
REGRESS = extension_create REGRESS = extension_create
ISOLATION = create
EXTRA_CLEAN = cstore.pb-c.h cstore.pb-c.c data/*.cstore data/*.cstore.footer \ EXTRA_CLEAN = cstore.pb-c.h cstore.pb-c.c data/*.cstore data/*.cstore.footer \
sql/block_filtering.sql sql/create.sql sql/data_types.sql sql/load.sql \ sql/block_filtering.sql sql/create.sql sql/data_types.sql sql/load.sql \
sql/copyto.sql expected/block_filtering.out expected/create.out \ sql/copyto.sql expected/block_filtering.out expected/create.out \
@ -54,6 +55,7 @@ ifeq ($(USE_TABLEAM),yes)
OBJS += cstore_tableam.o OBJS += cstore_tableam.o
REGRESS += am_create am_load am_query am_analyze am_data_types am_functions \ REGRESS += am_create am_load am_query am_analyze am_data_types am_functions \
am_drop am_insert am_copyto am_alter am_rollback am_truncate am_vacuum am_clean am_drop am_insert am_copyto am_alter am_rollback am_truncate am_vacuum am_clean
ISOLATION += am_vacuum_vs_insert
endif endif
ifeq ($(enable_coverage),yes) ifeq ($(enable_coverage),yes)
@ -76,6 +78,22 @@ PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs) PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS) include $(PGXS)
# command for getting postgres source directory is taken from citus/configure.in
POSTGRES_SRCDIR=$(shell grep ^abs_top_srcdir $(shell dirname $(shell $(PG_CONFIG) --pgxs))/../Makefile.global|cut -d ' ' -f3-)
PGXS_ISOLATION_TESTER=$(top_builddir)/src/test/isolation/pg_isolation_regress
# If postgres installation doesn't include pg_isolation_regress, try using the
# one in postgres source directory.
ifeq (,$(wildcard $(PGXS_ISOLATION_TESTER)))
pg_isolation_regress_installcheck = \
$(POSTGRES_SRCDIR)/src/test/isolation/pg_isolation_regress \
--inputdir=$(srcdir) $(EXTRA_REGRESS_OPTS)
else
pg_isolation_regress_installcheck = \
$(PGXS_ISOLATION_TESTER) \
--inputdir=$(srcdir) $(EXTRA_REGRESS_OPTS)
endif
installcheck: installcheck:
reindent: reindent:

View File

@ -0,0 +1,58 @@
Parsed test spec with 2 sessions
starting permutation: s1-insert s1-begin s1-insert s2-vacuum s1-commit s2-select
step s1-insert:
INSERT INTO test_vacuum_vs_insert SELECT i, 2 * i FROM generate_series(1, 3) i;
step s1-begin:
BEGIN;
step s1-insert:
INSERT INTO test_vacuum_vs_insert SELECT i, 2 * i FROM generate_series(1, 3) i;
step s2-vacuum:
VACUUM test_vacuum_vs_insert;
step s1-commit:
COMMIT;
step s2-select:
SELECT * FROM test_vacuum_vs_insert;
a b
1 2
2 4
3 6
1 2
2 4
3 6
starting permutation: s1-insert s1-begin s1-insert s2-vacuum-full s1-commit s2-select
step s1-insert:
INSERT INTO test_vacuum_vs_insert SELECT i, 2 * i FROM generate_series(1, 3) i;
step s1-begin:
BEGIN;
step s1-insert:
INSERT INTO test_vacuum_vs_insert SELECT i, 2 * i FROM generate_series(1, 3) i;
step s2-vacuum-full:
VACUUM FULL test_vacuum_vs_insert;
<waiting ...>
step s1-commit:
COMMIT;
step s2-vacuum-full: <... completed>
step s2-select:
SELECT * FROM test_vacuum_vs_insert;
a b
1 2
2 4
3 6
1 2
2 4
3 6

6
expected/create.out Normal file
View File

@ -0,0 +1,6 @@
Parsed test spec with 1 sessions
starting permutation: s1a
step s1a:
CREATE EXTENSION cstore_fdw;

View File

@ -0,0 +1,47 @@
setup
{
CREATE TABLE test_vacuum_vs_insert (a int, b int) USING cstore_tableam;
}
teardown
{
DROP TABLE IF EXISTS test_vacuum_vs_insert CASCADE;
}
session "s1"
step "s1-begin"
{
BEGIN;
}
step "s1-insert"
{
INSERT INTO test_vacuum_vs_insert SELECT i, 2 * i FROM generate_series(1, 3) i;
}
step "s1-commit"
{
COMMIT;
}
session "s2"
step "s2-vacuum"
{
VACUUM test_vacuum_vs_insert;
}
step "s2-vacuum-full"
{
VACUUM FULL test_vacuum_vs_insert;
}
step "s2-select"
{
SELECT * FROM test_vacuum_vs_insert;
}
permutation "s1-insert" "s1-begin" "s1-insert" "s2-vacuum" "s1-commit" "s2-select"
permutation "s1-insert" "s1-begin" "s1-insert" "s2-vacuum-full" "s1-commit" "s2-select"

8
specs/create.spec Normal file
View File

@ -0,0 +1,8 @@
session "s1"
step "s1a"
{
CREATE EXTENSION cstore_fdw;
}
permutation "s1a"