From dd6a456bede09f65e0590311876e0b4e8f8e4f0b Mon Sep 17 00:00:00 2001 From: Burak Yucesoy Date: Mon, 10 Jul 2017 15:46:48 +0300 Subject: [PATCH] Add tests for concurrent INSERT and VACUUM behaviour --- .../expected/isolation_insert_vs_vacuum.out | 36 ++++++++++++++ src/test/regress/isolation_schedule | 4 +- .../specs/isolation_insert_vs_vacuum.spec | 47 +++++++++++++++++++ 3 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 src/test/regress/expected/isolation_insert_vs_vacuum.out create mode 100644 src/test/regress/specs/isolation_insert_vs_vacuum.spec diff --git a/src/test/regress/expected/isolation_insert_vs_vacuum.out b/src/test/regress/expected/isolation_insert_vs_vacuum.out new file mode 100644 index 000000000..eb6c481b1 --- /dev/null +++ b/src/test/regress/expected/isolation_insert_vs_vacuum.out @@ -0,0 +1,36 @@ +Parsed test spec with 2 sessions + +starting permutation: s1-begin s1-insert s2-vacuum-analyze s1-commit +create_distributed_table + + +step s1-begin: + BEGIN; + +step s1-insert: + INSERT INTO test_insert_vacuum VALUES(1, 1); + +step s2-vacuum-analyze: + VACUUM ANALYZE test_insert_vacuum; + +step s1-commit: + COMMIT; + + +starting permutation: s1-begin s1-insert s2-vacuum-full s1-commit +create_distributed_table + + +step s1-begin: + BEGIN; + +step s1-insert: + INSERT INTO test_insert_vacuum VALUES(1, 1); + +step s2-vacuum-full: + VACUUM FULL test_insert_vacuum; + +step s1-commit: + COMMIT; + +step s2-vacuum-full: <... completed> diff --git a/src/test/regress/isolation_schedule b/src/test/regress/isolation_schedule index 8f7dd91e5..48995f909 100644 --- a/src/test/regress/isolation_schedule +++ b/src/test/regress/isolation_schedule @@ -7,4 +7,6 @@ test: isolation_cluster_management test: isolation_dml_vs_repair isolation_copy_placement_vs_copy_placement test: isolation_concurrent_dml isolation_data_migration -test: isolation_drop_shards isolation_copy_placement_vs_modification +test: isolation_drop_shards isolation_copy_placement_vs_modification + +test: isolation_insert_vs_vacuum diff --git a/src/test/regress/specs/isolation_insert_vs_vacuum.spec b/src/test/regress/specs/isolation_insert_vs_vacuum.spec new file mode 100644 index 000000000..050e6dc82 --- /dev/null +++ b/src/test/regress/specs/isolation_insert_vs_vacuum.spec @@ -0,0 +1,47 @@ +setup +{ + SET citus.shard_replication_factor TO 1; + CREATE TABLE test_insert_vacuum(column1 int, column2 int); + SELECT create_distributed_table('test_insert_vacuum', 'column1'); +} + +teardown +{ + DROP TABLE test_insert_vacuum; +} + +session "s1" + +step "s1-begin" +{ + BEGIN; +} + +step "s1-insert" +{ + INSERT INTO test_insert_vacuum VALUES(1, 1); +} + +step "s1-commit" +{ + COMMIT; +} + +session "s2" + +step "s2-vacuum-analyze" +{ + VACUUM ANALYZE test_insert_vacuum; +} + +step "s2-vacuum-full" +{ + VACUUM FULL test_insert_vacuum; +} + +# INSERT and VACUUM ANALYZE should not block each other. +permutation "s1-begin" "s1-insert" "s2-vacuum-analyze" "s1-commit" + +# INSERT and VACUUM FULL should block each other. +permutation "s1-begin" "s1-insert" "s2-vacuum-full" "s1-commit" +