mirror of https://github.com/citusdata/citus.git
Merge pull request #1798 from citusdata/isolation_tests_improve
Increases the coverage of the isolation tests by adding some of the concurrency testspull/1810/head
commit
59242383be
|
@ -0,0 +1,102 @@
|
|||
Parsed test spec with 2 sessions
|
||||
|
||||
starting permutation: s1-begin s2-begin s1-create_distributed_table s2-create_distributed_table s1-commit s2-commit
|
||||
step s1-begin:
|
||||
BEGIN;
|
||||
|
||||
step s2-begin:
|
||||
BEGIN;
|
||||
|
||||
step s1-create_distributed_table:
|
||||
SELECT create_distributed_table('table_to_distribute', 'id');
|
||||
|
||||
create_distributed_table
|
||||
|
||||
|
||||
step s2-create_distributed_table:
|
||||
SELECT create_distributed_table('table_to_distribute', 'id');
|
||||
<waiting ...>
|
||||
step s1-commit:
|
||||
COMMIT;
|
||||
|
||||
step s2-create_distributed_table: <... completed>
|
||||
error in steps s1-commit s2-create_distributed_table: ERROR: table "table_to_distribute" is already distributed
|
||||
step s2-commit:
|
||||
COMMIT;
|
||||
|
||||
|
||||
starting permutation: s1-begin s2-begin s1-create_distributed_table s2-copy_to_local_table s1-commit s2-commit
|
||||
step s1-begin:
|
||||
BEGIN;
|
||||
|
||||
step s2-begin:
|
||||
BEGIN;
|
||||
|
||||
step s1-create_distributed_table:
|
||||
SELECT create_distributed_table('table_to_distribute', 'id');
|
||||
|
||||
create_distributed_table
|
||||
|
||||
|
||||
step s2-copy_to_local_table:
|
||||
COPY table_to_distribute FROM PROGRAM 'echo "0\n1\n2\n3\n4\n5\n6\n7\n8"';
|
||||
<waiting ...>
|
||||
step s1-commit:
|
||||
COMMIT;
|
||||
|
||||
step s2-copy_to_local_table: <... completed>
|
||||
step s2-commit:
|
||||
COMMIT;
|
||||
|
||||
|
||||
starting permutation: s1-begin s2-begin s2-copy_to_local_table s1-create_distributed_table s2-commit s1-commit
|
||||
step s1-begin:
|
||||
BEGIN;
|
||||
|
||||
step s2-begin:
|
||||
BEGIN;
|
||||
|
||||
step s2-copy_to_local_table:
|
||||
COPY table_to_distribute FROM PROGRAM 'echo "0\n1\n2\n3\n4\n5\n6\n7\n8"';
|
||||
|
||||
step s1-create_distributed_table:
|
||||
SELECT create_distributed_table('table_to_distribute', 'id');
|
||||
<waiting ...>
|
||||
step s2-commit:
|
||||
COMMIT;
|
||||
|
||||
step s1-create_distributed_table: <... completed>
|
||||
create_distributed_table
|
||||
|
||||
|
||||
step s1-commit:
|
||||
COMMIT;
|
||||
|
||||
|
||||
starting permutation: s1-copy_to_local_table s1-begin s2-begin s1-create_distributed_table s2-create_distributed_table s1-commit s2-commit
|
||||
step s1-copy_to_local_table:
|
||||
COPY table_to_distribute FROM PROGRAM 'echo "0\n1\n2\n3\n4\n5\n6\n7\n8"';
|
||||
|
||||
step s1-begin:
|
||||
BEGIN;
|
||||
|
||||
step s2-begin:
|
||||
BEGIN;
|
||||
|
||||
step s1-create_distributed_table:
|
||||
SELECT create_distributed_table('table_to_distribute', 'id');
|
||||
|
||||
create_distributed_table
|
||||
|
||||
|
||||
step s2-create_distributed_table:
|
||||
SELECT create_distributed_table('table_to_distribute', 'id');
|
||||
<waiting ...>
|
||||
step s1-commit:
|
||||
COMMIT;
|
||||
|
||||
step s2-create_distributed_table: <... completed>
|
||||
error in steps s1-commit s2-create_distributed_table: ERROR: table "table_to_distribute" is already distributed
|
||||
step s2-commit:
|
||||
COMMIT;
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
Parsed test spec with 2 sessions
|
||||
|
||||
starting permutation: s1-begin s2-begin s1-master_append_table_to_shard s2-master_append_table_to_shard s1-commit s2-commit
|
||||
step s1-begin:
|
||||
BEGIN;
|
||||
|
||||
step s2-begin:
|
||||
BEGIN;
|
||||
|
||||
step s1-master_append_table_to_shard:
|
||||
SELECT
|
||||
master_append_table_to_shard(shardid, 'table_to_be_appended', 'localhost', 57636)
|
||||
FROM
|
||||
pg_dist_shard
|
||||
WHERE
|
||||
'table_to_append'::regclass::oid = logicalrelid;
|
||||
|
||||
master_append_table_to_shard
|
||||
|
||||
0.213333
|
||||
step s2-master_append_table_to_shard:
|
||||
|
||||
SELECT
|
||||
master_append_table_to_shard(shardid, 'table_to_be_appended', 'localhost', 57636)
|
||||
FROM
|
||||
pg_dist_shard
|
||||
WHERE
|
||||
'table_to_append'::regclass::oid = logicalrelid;
|
||||
<waiting ...>
|
||||
step s1-commit:
|
||||
COMMIT;
|
||||
|
||||
step s2-master_append_table_to_shard: <... completed>
|
||||
master_append_table_to_shard
|
||||
|
||||
0.32
|
||||
step s2-commit:
|
||||
COMMIT;
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
Parsed test spec with 2 sessions
|
||||
|
||||
starting permutation: s1-begin s2-begin s1-master_apply_delete_command_all_shard s2-master_apply_delete_command_all_shard s1-commit s2-commit
|
||||
step s1-begin:
|
||||
BEGIN;
|
||||
|
||||
step s2-begin:
|
||||
BEGIN;
|
||||
|
||||
step s1-master_apply_delete_command_all_shard:
|
||||
SELECT master_apply_delete_command($$DELETE FROM table_to_delete_from WHERE id >= 0$$);
|
||||
|
||||
master_apply_delete_command
|
||||
|
||||
1
|
||||
step s2-master_apply_delete_command_all_shard:
|
||||
SELECT master_apply_delete_command($$DELETE FROM table_to_delete_from WHERE id >= 0$$);
|
||||
<waiting ...>
|
||||
step s1-commit:
|
||||
COMMIT;
|
||||
|
||||
step s2-master_apply_delete_command_all_shard: <... completed>
|
||||
master_apply_delete_command
|
||||
|
||||
0
|
||||
step s2-commit:
|
||||
COMMIT;
|
||||
|
||||
|
||||
starting permutation: s1-begin s2-begin s1-master_apply_delete_command_all_shard s2-master_apply_delete_command_row s1-commit s2-commit
|
||||
step s1-begin:
|
||||
BEGIN;
|
||||
|
||||
step s2-begin:
|
||||
BEGIN;
|
||||
|
||||
step s1-master_apply_delete_command_all_shard:
|
||||
SELECT master_apply_delete_command($$DELETE FROM table_to_delete_from WHERE id >= 0$$);
|
||||
|
||||
master_apply_delete_command
|
||||
|
||||
1
|
||||
step s2-master_apply_delete_command_row:
|
||||
SELECT master_apply_delete_command($$DELETE FROM table_to_delete_from WHERE id >= 0 and id < 3$$);
|
||||
<waiting ...>
|
||||
step s1-commit:
|
||||
COMMIT;
|
||||
|
||||
step s2-master_apply_delete_command_row: <... completed>
|
||||
master_apply_delete_command
|
||||
|
||||
0
|
||||
step s2-commit:
|
||||
COMMIT;
|
||||
|
||||
|
||||
starting permutation: s1-begin s2-begin s1-master_apply_delete_command_row s2-master_apply_delete_command_all_shard s1-commit s2-commit
|
||||
step s1-begin:
|
||||
BEGIN;
|
||||
|
||||
step s2-begin:
|
||||
BEGIN;
|
||||
|
||||
step s1-master_apply_delete_command_row:
|
||||
SELECT master_apply_delete_command($$DELETE FROM table_to_delete_from WHERE id >= 0 and id < 3$$);
|
||||
|
||||
master_apply_delete_command
|
||||
|
||||
0
|
||||
step s2-master_apply_delete_command_all_shard:
|
||||
SELECT master_apply_delete_command($$DELETE FROM table_to_delete_from WHERE id >= 0$$);
|
||||
<waiting ...>
|
||||
step s1-commit:
|
||||
COMMIT;
|
||||
|
||||
step s2-master_apply_delete_command_all_shard: <... completed>
|
||||
master_apply_delete_command
|
||||
|
||||
1
|
||||
step s2-commit:
|
||||
COMMIT;
|
||||
|
||||
|
||||
starting permutation: s1-begin s2-begin s1-master_apply_delete_command_row s2-master_apply_delete_command_row s1-commit s2-commit
|
||||
step s1-begin:
|
||||
BEGIN;
|
||||
|
||||
step s2-begin:
|
||||
BEGIN;
|
||||
|
||||
step s1-master_apply_delete_command_row:
|
||||
SELECT master_apply_delete_command($$DELETE FROM table_to_delete_from WHERE id >= 0 and id < 3$$);
|
||||
|
||||
master_apply_delete_command
|
||||
|
||||
0
|
||||
step s2-master_apply_delete_command_row:
|
||||
SELECT master_apply_delete_command($$DELETE FROM table_to_delete_from WHERE id >= 0 and id < 3$$);
|
||||
<waiting ...>
|
||||
step s1-commit:
|
||||
COMMIT;
|
||||
|
||||
step s2-master_apply_delete_command_row: <... completed>
|
||||
master_apply_delete_command
|
||||
|
||||
0
|
||||
step s2-commit:
|
||||
COMMIT;
|
||||
|
|
@ -62,17 +62,17 @@ step s2-commit:
|
|||
COMMIT;
|
||||
|
||||
|
||||
starting permutation: s1-begin s1-update_value_1_of_1_or_3 s2-begin s2-update_value_1_of_4_or_6 s1-commit s2-commit s2-select
|
||||
starting permutation: s1-begin s1-update_value_1_of_1_or_3_to_5 s2-begin s2-update_value_1_of_4_or_6_to_4 s1-commit s2-commit s2-select
|
||||
step s1-begin:
|
||||
BEGIN;
|
||||
|
||||
step s1-update_value_1_of_1_or_3:
|
||||
step s1-update_value_1_of_1_or_3_to_5:
|
||||
UPDATE users_test_table SET value_1 = 5 WHERE user_id = 1 or user_id = 3;
|
||||
|
||||
step s2-begin:
|
||||
BEGIN;
|
||||
|
||||
step s2-update_value_1_of_4_or_6:
|
||||
step s2-update_value_1_of_4_or_6_to_4:
|
||||
UPDATE users_test_table SET value_1 = 4 WHERE user_id = 4 or user_id = 6;
|
||||
|
||||
step s1-commit:
|
||||
|
@ -94,23 +94,23 @@ user_id value_1 value_2 value_3
|
|||
6 4 11 25
|
||||
7 27 12 18
|
||||
|
||||
starting permutation: s1-begin s1-update_value_1_of_1_or_3 s2-begin s2-update_value_1_of_1_or_3 s1-commit s2-commit s2-select
|
||||
starting permutation: s1-begin s1-update_value_1_of_1_or_3_to_5 s2-begin s2-update_value_1_of_1_or_3_to_8 s1-commit s2-commit s2-select
|
||||
step s1-begin:
|
||||
BEGIN;
|
||||
|
||||
step s1-update_value_1_of_1_or_3:
|
||||
step s1-update_value_1_of_1_or_3_to_5:
|
||||
UPDATE users_test_table SET value_1 = 5 WHERE user_id = 1 or user_id = 3;
|
||||
|
||||
step s2-begin:
|
||||
BEGIN;
|
||||
|
||||
step s2-update_value_1_of_1_or_3:
|
||||
step s2-update_value_1_of_1_or_3_to_8:
|
||||
UPDATE users_test_table SET value_1 = 8 WHERE user_id = 1 or user_id = 3;
|
||||
<waiting ...>
|
||||
step s1-commit:
|
||||
COMMIT;
|
||||
|
||||
step s2-update_value_1_of_1_or_3: <... completed>
|
||||
step s2-update_value_1_of_1_or_3_to_8: <... completed>
|
||||
step s2-commit:
|
||||
COMMIT;
|
||||
|
||||
|
@ -200,6 +200,47 @@ user_id value_1 value_2 value_3
|
|||
5 17 14 4
|
||||
3 11 78 18
|
||||
|
||||
starting permutation: s1-begin s2-begin s1-update_value_1_of_1_or_3_to_5 s2-update_value_1_of_1_or_3_to_8 s1-commit s2-commit
|
||||
step s1-begin:
|
||||
BEGIN;
|
||||
|
||||
step s2-begin:
|
||||
BEGIN;
|
||||
|
||||
step s1-update_value_1_of_1_or_3_to_5:
|
||||
UPDATE users_test_table SET value_1 = 5 WHERE user_id = 1 or user_id = 3;
|
||||
|
||||
step s2-update_value_1_of_1_or_3_to_8:
|
||||
UPDATE users_test_table SET value_1 = 8 WHERE user_id = 1 or user_id = 3;
|
||||
<waiting ...>
|
||||
step s1-commit:
|
||||
COMMIT;
|
||||
|
||||
step s2-update_value_1_of_1_or_3_to_8: <... completed>
|
||||
step s2-commit:
|
||||
COMMIT;
|
||||
|
||||
|
||||
starting permutation: s1-begin s2-begin s2-update_value_1_of_1_or_3_to_8 s1-update_value_1_of_2_or_4_to_5 s2-commit s1-commit
|
||||
step s1-begin:
|
||||
BEGIN;
|
||||
|
||||
step s2-begin:
|
||||
BEGIN;
|
||||
|
||||
step s2-update_value_1_of_1_or_3_to_8:
|
||||
UPDATE users_test_table SET value_1 = 8 WHERE user_id = 1 or user_id = 3;
|
||||
|
||||
step s1-update_value_1_of_2_or_4_to_5:
|
||||
UPDATE users_test_table SET value_1 = 5 WHERE user_id = 2 or user_id = 4;
|
||||
|
||||
step s2-commit:
|
||||
COMMIT;
|
||||
|
||||
step s1-commit:
|
||||
COMMIT;
|
||||
|
||||
|
||||
starting permutation: s1-begin s1-change_connection_mode_to_sequential s1-update_all_value_1 s2-begin s2-change_connection_mode_to_sequential s2-update_all_value_1 s1-commit s2-commit s2-select
|
||||
step s1-begin:
|
||||
BEGIN;
|
||||
|
@ -239,14 +280,14 @@ user_id value_1 value_2 value_3
|
|||
6 6 11 25
|
||||
7 6 12 18
|
||||
|
||||
starting permutation: s1-begin s1-change_connection_mode_to_sequential s1-update_value_1_of_1_or_3 s2-begin s2-change_connection_mode_to_sequential s2-update_value_1_of_1_or_3 s1-commit s2-commit s2-select
|
||||
starting permutation: s1-begin s1-change_connection_mode_to_sequential s1-update_value_1_of_1_or_3_to_5 s2-begin s2-change_connection_mode_to_sequential s2-update_value_1_of_1_or_3_to_8 s1-commit s2-commit s2-select
|
||||
step s1-begin:
|
||||
BEGIN;
|
||||
|
||||
step s1-change_connection_mode_to_sequential:
|
||||
set citus.multi_shard_modify_mode to 'sequential';
|
||||
|
||||
step s1-update_value_1_of_1_or_3:
|
||||
step s1-update_value_1_of_1_or_3_to_5:
|
||||
UPDATE users_test_table SET value_1 = 5 WHERE user_id = 1 or user_id = 3;
|
||||
|
||||
step s2-begin:
|
||||
|
@ -255,13 +296,13 @@ step s2-begin:
|
|||
step s2-change_connection_mode_to_sequential:
|
||||
set citus.multi_shard_modify_mode to 'sequential';
|
||||
|
||||
step s2-update_value_1_of_1_or_3:
|
||||
step s2-update_value_1_of_1_or_3_to_8:
|
||||
UPDATE users_test_table SET value_1 = 8 WHERE user_id = 1 or user_id = 3;
|
||||
<waiting ...>
|
||||
step s1-commit:
|
||||
COMMIT;
|
||||
|
||||
step s2-update_value_1_of_1_or_3: <... completed>
|
||||
step s2-update_value_1_of_1_or_3_to_8: <... completed>
|
||||
step s2-commit:
|
||||
COMMIT;
|
||||
|
||||
|
@ -278,14 +319,14 @@ user_id value_1 value_2 value_3
|
|||
6 21 11 25
|
||||
7 27 12 18
|
||||
|
||||
starting permutation: s1-begin s1-change_connection_mode_to_sequential s1-update_value_1_of_1_or_3 s2-begin s2-change_connection_mode_to_sequential s2-update_value_1_of_4_or_6 s1-commit s2-commit s2-select
|
||||
starting permutation: s1-begin s1-change_connection_mode_to_sequential s1-update_value_1_of_1_or_3_to_5 s2-begin s2-change_connection_mode_to_sequential s2-update_value_1_of_4_or_6_to_4 s1-commit s2-commit s2-select
|
||||
step s1-begin:
|
||||
BEGIN;
|
||||
|
||||
step s1-change_connection_mode_to_sequential:
|
||||
set citus.multi_shard_modify_mode to 'sequential';
|
||||
|
||||
step s1-update_value_1_of_1_or_3:
|
||||
step s1-update_value_1_of_1_or_3_to_5:
|
||||
UPDATE users_test_table SET value_1 = 5 WHERE user_id = 1 or user_id = 3;
|
||||
|
||||
step s2-begin:
|
||||
|
@ -294,7 +335,7 @@ step s2-begin:
|
|||
step s2-change_connection_mode_to_sequential:
|
||||
set citus.multi_shard_modify_mode to 'sequential';
|
||||
|
||||
step s2-update_value_1_of_4_or_6:
|
||||
step s2-update_value_1_of_4_or_6_to_4:
|
||||
UPDATE users_test_table SET value_1 = 4 WHERE user_id = 4 or user_id = 6;
|
||||
|
||||
step s1-commit:
|
||||
|
@ -315,3 +356,56 @@ user_id value_1 value_2 value_3
|
|||
5 35 10 17
|
||||
6 4 11 25
|
||||
7 27 12 18
|
||||
|
||||
starting permutation: s1-begin s2-begin s1-change_connection_mode_to_sequential s2-change_connection_mode_to_sequential s1-update_value_1_of_1_or_3_to_5 s2-update_value_1_of_1_or_3_to_8 s1-commit s2-commit
|
||||
step s1-begin:
|
||||
BEGIN;
|
||||
|
||||
step s2-begin:
|
||||
BEGIN;
|
||||
|
||||
step s1-change_connection_mode_to_sequential:
|
||||
set citus.multi_shard_modify_mode to 'sequential';
|
||||
|
||||
step s2-change_connection_mode_to_sequential:
|
||||
set citus.multi_shard_modify_mode to 'sequential';
|
||||
|
||||
step s1-update_value_1_of_1_or_3_to_5:
|
||||
UPDATE users_test_table SET value_1 = 5 WHERE user_id = 1 or user_id = 3;
|
||||
|
||||
step s2-update_value_1_of_1_or_3_to_8:
|
||||
UPDATE users_test_table SET value_1 = 8 WHERE user_id = 1 or user_id = 3;
|
||||
<waiting ...>
|
||||
step s1-commit:
|
||||
COMMIT;
|
||||
|
||||
step s2-update_value_1_of_1_or_3_to_8: <... completed>
|
||||
step s2-commit:
|
||||
COMMIT;
|
||||
|
||||
|
||||
starting permutation: s1-begin s2-begin s1-change_connection_mode_to_sequential s2-change_connection_mode_to_sequential s2-update_value_1_of_1_or_3_to_8 s1-update_value_1_of_2_or_4_to_5 s1-commit s2-commit
|
||||
step s1-begin:
|
||||
BEGIN;
|
||||
|
||||
step s2-begin:
|
||||
BEGIN;
|
||||
|
||||
step s1-change_connection_mode_to_sequential:
|
||||
set citus.multi_shard_modify_mode to 'sequential';
|
||||
|
||||
step s2-change_connection_mode_to_sequential:
|
||||
set citus.multi_shard_modify_mode to 'sequential';
|
||||
|
||||
step s2-update_value_1_of_1_or_3_to_8:
|
||||
UPDATE users_test_table SET value_1 = 8 WHERE user_id = 1 or user_id = 3;
|
||||
|
||||
step s1-update_value_1_of_2_or_4_to_5:
|
||||
UPDATE users_test_table SET value_1 = 5 WHERE user_id = 2 or user_id = 4;
|
||||
|
||||
step s1-commit:
|
||||
COMMIT;
|
||||
|
||||
step s2-commit:
|
||||
COMMIT;
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ test: isolation_distributed_deadlock_detection
|
|||
# writes, run this test serially.
|
||||
test: isolation_create_restore_point
|
||||
|
||||
test: isolation_create_distributed_table isolation_master_append_table isolation_master_apply_delete
|
||||
test: isolation_multi_shard_modify_vs_all
|
||||
test: isolation_hash_copy_vs_all
|
||||
test: isolation_append_copy_vs_all
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
setup
|
||||
{
|
||||
CREATE TABLE table_to_distribute(id int);
|
||||
}
|
||||
|
||||
teardown
|
||||
{
|
||||
DROP TABLE table_to_distribute CASCADE;
|
||||
}
|
||||
|
||||
session "s1"
|
||||
|
||||
step "s1-begin"
|
||||
{
|
||||
BEGIN;
|
||||
}
|
||||
|
||||
step "s1-create_distributed_table"
|
||||
{
|
||||
SELECT create_distributed_table('table_to_distribute', 'id');
|
||||
}
|
||||
|
||||
step "s1-copy_to_local_table"
|
||||
{
|
||||
COPY table_to_distribute FROM PROGRAM 'echo "0\n1\n2\n3\n4\n5\n6\n7\n8"';
|
||||
}
|
||||
|
||||
step "s1-commit"
|
||||
{
|
||||
COMMIT;
|
||||
}
|
||||
|
||||
session "s2"
|
||||
|
||||
step "s2-begin"
|
||||
{
|
||||
BEGIN;
|
||||
}
|
||||
|
||||
step "s2-create_distributed_table"
|
||||
{
|
||||
SELECT create_distributed_table('table_to_distribute', 'id');
|
||||
}
|
||||
|
||||
step "s2-copy_to_local_table"
|
||||
{
|
||||
COPY table_to_distribute FROM PROGRAM 'echo "0\n1\n2\n3\n4\n5\n6\n7\n8"';
|
||||
}
|
||||
|
||||
step "s2-commit"
|
||||
{
|
||||
COMMIT;
|
||||
}
|
||||
|
||||
#concurrent create_distributed_table on empty table
|
||||
permutation "s1-begin" "s2-begin" "s1-create_distributed_table" "s2-create_distributed_table" "s1-commit" "s2-commit"
|
||||
|
||||
#concurrent create_distributed_table vs. copy to table
|
||||
permutation "s1-begin" "s2-begin" "s1-create_distributed_table" "s2-copy_to_local_table" "s1-commit" "s2-commit"
|
||||
permutation "s1-begin" "s2-begin" "s2-copy_to_local_table" "s1-create_distributed_table" "s2-commit" "s1-commit"
|
||||
|
||||
#concurrent create_distributed_table on non-empty table
|
||||
permutation "s1-copy_to_local_table" "s1-begin" "s2-begin" "s1-create_distributed_table" "s2-create_distributed_table" "s1-commit" "s2-commit"
|
|
@ -0,0 +1,64 @@
|
|||
setup
|
||||
{
|
||||
CREATE TABLE table_to_append(id int);
|
||||
CREATE TABLE table_to_be_appended(id int);
|
||||
|
||||
SELECT create_distributed_table('table_to_append', 'id', 'append');
|
||||
INSERT INTO table_to_be_appended SELECT generate_series(1,1000);
|
||||
|
||||
COPY table_to_append FROM PROGRAM 'echo "0\n7\n8\n9\n10000"';
|
||||
}
|
||||
|
||||
teardown
|
||||
{
|
||||
DROP TABLE table_to_append CASCADE;
|
||||
DROP TABLE table_to_be_appended CASCADE;
|
||||
}
|
||||
|
||||
session "s1"
|
||||
|
||||
step "s1-begin"
|
||||
{
|
||||
BEGIN;
|
||||
}
|
||||
|
||||
step "s1-master_append_table_to_shard"
|
||||
{
|
||||
SELECT
|
||||
master_append_table_to_shard(shardid, 'table_to_be_appended', 'localhost', 57636)
|
||||
FROM
|
||||
pg_dist_shard
|
||||
WHERE
|
||||
'table_to_append'::regclass::oid = logicalrelid;
|
||||
}
|
||||
|
||||
step "s1-commit"
|
||||
{
|
||||
COMMIT;
|
||||
}
|
||||
|
||||
session "s2"
|
||||
|
||||
step "s2-begin"
|
||||
{
|
||||
BEGIN;
|
||||
}
|
||||
|
||||
step "s2-master_append_table_to_shard"
|
||||
{
|
||||
|
||||
SELECT
|
||||
master_append_table_to_shard(shardid, 'table_to_be_appended', 'localhost', 57636)
|
||||
FROM
|
||||
pg_dist_shard
|
||||
WHERE
|
||||
'table_to_append'::regclass::oid = logicalrelid;
|
||||
}
|
||||
|
||||
step "s2-commit"
|
||||
{
|
||||
COMMIT;
|
||||
}
|
||||
|
||||
# concurrent master_append_table_to_shard tests
|
||||
permutation "s1-begin" "s2-begin" "s1-master_append_table_to_shard" "s2-master_append_table_to_shard" "s1-commit" "s2-commit"
|
|
@ -0,0 +1,63 @@
|
|||
setup
|
||||
{
|
||||
CREATE TABLE table_to_delete_from(id int);
|
||||
|
||||
SELECT create_distributed_table('table_to_delete_from', 'id', 'append');
|
||||
|
||||
COPY table_to_delete_from FROM PROGRAM 'echo "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10"';
|
||||
}
|
||||
|
||||
teardown
|
||||
{
|
||||
DROP TABLE table_to_delete_from CASCADE;
|
||||
}
|
||||
|
||||
session "s1"
|
||||
|
||||
step "s1-begin"
|
||||
{
|
||||
BEGIN;
|
||||
}
|
||||
|
||||
step "s1-master_apply_delete_command_all_shard"
|
||||
{
|
||||
SELECT master_apply_delete_command($$DELETE FROM table_to_delete_from WHERE id >= 0$$);
|
||||
}
|
||||
|
||||
step "s1-master_apply_delete_command_row"
|
||||
{
|
||||
SELECT master_apply_delete_command($$DELETE FROM table_to_delete_from WHERE id >= 0 and id < 3$$);
|
||||
}
|
||||
|
||||
step "s1-commit"
|
||||
{
|
||||
COMMIT;
|
||||
}
|
||||
|
||||
session "s2"
|
||||
|
||||
step "s2-begin"
|
||||
{
|
||||
BEGIN;
|
||||
}
|
||||
|
||||
step "s2-master_apply_delete_command_all_shard"
|
||||
{
|
||||
SELECT master_apply_delete_command($$DELETE FROM table_to_delete_from WHERE id >= 0$$);
|
||||
}
|
||||
|
||||
step "s2-master_apply_delete_command_row"
|
||||
{
|
||||
SELECT master_apply_delete_command($$DELETE FROM table_to_delete_from WHERE id >= 0 and id < 3$$);
|
||||
}
|
||||
|
||||
step "s2-commit"
|
||||
{
|
||||
COMMIT;
|
||||
}
|
||||
|
||||
#concurrent master_apply_delete_command vs master_apply_delete_command
|
||||
permutation "s1-begin" "s2-begin" "s1-master_apply_delete_command_all_shard" "s2-master_apply_delete_command_all_shard" "s1-commit" "s2-commit"
|
||||
permutation "s1-begin" "s2-begin" "s1-master_apply_delete_command_all_shard" "s2-master_apply_delete_command_row" "s1-commit" "s2-commit"
|
||||
permutation "s1-begin" "s2-begin" "s1-master_apply_delete_command_row" "s2-master_apply_delete_command_all_shard" "s1-commit" "s2-commit"
|
||||
permutation "s1-begin" "s2-begin" "s1-master_apply_delete_command_row" "s2-master_apply_delete_command_row" "s1-commit" "s2-commit"
|
|
@ -55,11 +55,21 @@ step "s1-update_all_value_1"
|
|||
UPDATE users_test_table SET value_1 = 3;
|
||||
}
|
||||
|
||||
step "s1-update_value_1_of_1_or_3"
|
||||
step "s1-update_value_1_of_1_or_3_to_5"
|
||||
{
|
||||
UPDATE users_test_table SET value_1 = 5 WHERE user_id = 1 or user_id = 3;
|
||||
}
|
||||
|
||||
step "s1-update_value_1_of_1_or_3_to_7"
|
||||
{
|
||||
UPDATE users_test_table SET value_1 = 7 WHERE user_id = 1 or user_id = 3;
|
||||
}
|
||||
|
||||
step "s1-update_value_1_of_2_or_4_to_5"
|
||||
{
|
||||
UPDATE users_test_table SET value_1 = 5 WHERE user_id = 2 or user_id = 4;
|
||||
}
|
||||
|
||||
step "s1-commit"
|
||||
{
|
||||
COMMIT;
|
||||
|
@ -97,12 +107,12 @@ step "s2-update_all_value_1"
|
|||
UPDATE users_test_table SET value_1 = 6;
|
||||
}
|
||||
|
||||
step "s2-update_value_1_of_1_or_3"
|
||||
step "s2-update_value_1_of_1_or_3_to_8"
|
||||
{
|
||||
UPDATE users_test_table SET value_1 = 8 WHERE user_id = 1 or user_id = 3;
|
||||
}
|
||||
|
||||
step "s2-update_value_1_of_4_or_6"
|
||||
step "s2-update_value_1_of_4_or_6_to_4"
|
||||
{
|
||||
UPDATE users_test_table SET value_1 = 4 WHERE user_id = 4 or user_id = 6;
|
||||
}
|
||||
|
@ -115,14 +125,22 @@ step "s2-commit"
|
|||
# test with parallel connections
|
||||
permutation "s1-begin" "s1-update_all_value_1" "s2-begin" "s2-select" "s1-commit" "s2-select" "s2-commit"
|
||||
permutation "s1-begin" "s1-update_all_value_1" "s2-begin" "s2-update_all_value_1" "s1-commit" "s2-commit"
|
||||
permutation "s1-begin" "s1-update_value_1_of_1_or_3" "s2-begin" "s2-update_value_1_of_4_or_6" "s1-commit" "s2-commit" "s2-select"
|
||||
permutation "s1-begin" "s1-update_value_1_of_1_or_3" "s2-begin" "s2-update_value_1_of_1_or_3" "s1-commit" "s2-commit" "s2-select"
|
||||
permutation "s1-begin" "s1-update_value_1_of_1_or_3_to_5" "s2-begin" "s2-update_value_1_of_4_or_6_to_4" "s1-commit" "s2-commit" "s2-select"
|
||||
permutation "s1-begin" "s1-update_value_1_of_1_or_3_to_5" "s2-begin" "s2-update_value_1_of_1_or_3_to_8" "s1-commit" "s2-commit" "s2-select"
|
||||
permutation "s1-begin" "s1-update_all_value_1" "s2-begin" "s2-insert-to-table" "s1-commit" "s2-commit" "s2-select"
|
||||
permutation "s1-begin" "s1-update_all_value_1" "s2-begin" "s2-insert-into-select" "s1-commit" "s2-commit" "s2-select"
|
||||
# multi-shard update affecting the same rows
|
||||
permutation "s1-begin" "s2-begin" "s1-update_value_1_of_1_or_3_to_5" "s2-update_value_1_of_1_or_3_to_8" "s1-commit" "s2-commit"
|
||||
# multi-shard update affecting the different rows
|
||||
permutation "s1-begin" "s2-begin" "s2-update_value_1_of_1_or_3_to_8" "s1-update_value_1_of_2_or_4_to_5" "s2-commit" "s1-commit"
|
||||
|
||||
# test with sequential connections, sequential tests should not block each other
|
||||
# if they are targeting different shards. If multiple connections updating the same
|
||||
# row, second one must wait for the first one.
|
||||
permutation "s1-begin" "s1-change_connection_mode_to_sequential" "s1-update_all_value_1" "s2-begin" "s2-change_connection_mode_to_sequential" "s2-update_all_value_1" "s1-commit" "s2-commit" "s2-select"
|
||||
permutation "s1-begin" "s1-change_connection_mode_to_sequential" "s1-update_value_1_of_1_or_3" "s2-begin" "s2-change_connection_mode_to_sequential" "s2-update_value_1_of_1_or_3" "s1-commit" "s2-commit" "s2-select"
|
||||
permutation "s1-begin" "s1-change_connection_mode_to_sequential" "s1-update_value_1_of_1_or_3" "s2-begin" "s2-change_connection_mode_to_sequential" "s2-update_value_1_of_4_or_6" "s1-commit" "s2-commit" "s2-select"
|
||||
permutation "s1-begin" "s1-change_connection_mode_to_sequential" "s1-update_value_1_of_1_or_3_to_5" "s2-begin" "s2-change_connection_mode_to_sequential" "s2-update_value_1_of_1_or_3_to_8" "s1-commit" "s2-commit" "s2-select"
|
||||
permutation "s1-begin" "s1-change_connection_mode_to_sequential" "s1-update_value_1_of_1_or_3_to_5" "s2-begin" "s2-change_connection_mode_to_sequential" "s2-update_value_1_of_4_or_6_to_4" "s1-commit" "s2-commit" "s2-select"
|
||||
# multi-shard update affecting the same rows
|
||||
permutation "s1-begin" "s2-begin" "s1-change_connection_mode_to_sequential" "s2-change_connection_mode_to_sequential" "s1-update_value_1_of_1_or_3_to_5" "s2-update_value_1_of_1_or_3_to_8" "s1-commit" "s2-commit"
|
||||
# multi-shard update affecting the different rows
|
||||
permutation "s1-begin" "s2-begin" "s1-change_connection_mode_to_sequential" "s2-change_connection_mode_to_sequential" "s2-update_value_1_of_1_or_3_to_8" "s1-update_value_1_of_2_or_4_to_5" "s1-commit" "s2-commit"
|
Loading…
Reference in New Issue