add isolation tests that show reference table creation doesn't block anymore

onder/fix/reference-lock-contention
Nils Dijk 2022-08-15 23:47:30 +02:00
parent 4a290560b2
commit 1dccc40268
No known key found for this signature in database
GPG Key ID: CA1177EF9434F241
3 changed files with 186 additions and 0 deletions

View File

@ -0,0 +1,105 @@
unused step name: s1-abort
unused step name: s2-abort
Parsed test spec with 2 sessions
starting permutation: s1-begin s1-create s2-create s1-commit
create_reference_table
---------------------------------------------------------------------
(1 row)
step s1-begin:
BEGIN;
step s1-create:
CREATE TABLE reference_table_s1(a int);
SELECT create_reference_table('reference_table_s1');
create_reference_table
---------------------------------------------------------------------
(1 row)
step s2-create:
CREATE TABLE reference_table_s2(a int);
SELECT create_reference_table('reference_table_s2');
create_reference_table
---------------------------------------------------------------------
(1 row)
step s1-commit:
COMMIT;
starting permutation: s1-create s2-create s1-begin s1-drop s2-drop s1-commit
create_reference_table
---------------------------------------------------------------------
(1 row)
step s1-create:
CREATE TABLE reference_table_s1(a int);
SELECT create_reference_table('reference_table_s1');
create_reference_table
---------------------------------------------------------------------
(1 row)
step s2-create:
CREATE TABLE reference_table_s2(a int);
SELECT create_reference_table('reference_table_s2');
create_reference_table
---------------------------------------------------------------------
(1 row)
step s1-begin:
BEGIN;
step s1-drop:
DROP TABLE reference_table_s1;
step s2-drop:
DROP TABLE reference_table_s2;
step s1-commit:
COMMIT;
starting permutation: s1-create s2-begin s2-create s1-drop s2-commit
create_reference_table
---------------------------------------------------------------------
(1 row)
step s1-create:
CREATE TABLE reference_table_s1(a int);
SELECT create_reference_table('reference_table_s1');
create_reference_table
---------------------------------------------------------------------
(1 row)
step s2-begin:
BEGIN;
step s2-create:
CREATE TABLE reference_table_s2(a int);
SELECT create_reference_table('reference_table_s2');
create_reference_table
---------------------------------------------------------------------
(1 row)
step s1-drop:
DROP TABLE reference_table_s1;
step s2-commit:
COMMIT;

View File

@ -69,6 +69,7 @@ test: isolation_undistribute_table
test: isolation_fix_partition_shard_index_names
test: isolation_global_pid
test: isolation_citus_locks
test: isolation_reference_table
# Rebalancer
test: isolation_blocking_move_single_shard_commands

View File

@ -0,0 +1,80 @@
// reference tables _do_ lock on the first reference table in the shardgroup due to the lack of shardgroups in the
// system. When we run the tests we want to make sure the tables we are testing against cannot be the first reference
// table. For this purpose we create a reference table that we will _not_ interact with during the tests.
setup
{
CREATE TABLE first_reference_table(a int);
SELECT create_reference_table('first_reference_table');
}
teardown
{
DROP TABLE first_reference_table;
DROP TABLE IF EXISTS reference_table_s1;
DROP TABLE IF EXISTS reference_table_s2;
}
session "s1"
step "s1-begin"
{
BEGIN;
}
step "s1-create"
{
CREATE TABLE reference_table_s1(a int);
SELECT create_reference_table('reference_table_s1');
}
step "s1-drop"
{
DROP TABLE reference_table_s1;
}
step "s1-abort"
{
ABORT;
}
step "s1-commit"
{
COMMIT;
}
session "s2"
step "s2-begin"
{
BEGIN;
}
step "s2-create"
{
CREATE TABLE reference_table_s2(a int);
SELECT create_reference_table('reference_table_s2');
}
step "s2-drop"
{
DROP TABLE reference_table_s2;
}
step "s2-abort"
{
ABORT;
}
step "s2-commit"
{
COMMIT;
}
// creates don't block each other
permutation "s1-begin" "s1-create" "s2-create" "s1-commit"
// drops don't block each other
permutation "s1-create" "s2-create" "s1-begin" "s1-drop" "s2-drop" "s1-commit"
// create and drop don't block each other
permutation "s1-create" "s2-begin" "s2-create" "s1-drop" "s2-commit"