mirror of https://github.com/citusdata/citus.git
Add multi-row isolation tests
parent
addde54464
commit
a578506718
|
@ -28,3 +28,62 @@ step s1-insert:
|
||||||
step s2-update:
|
step s2-update:
|
||||||
UPDATE test_concurrent_dml SET data = 'blarg' WHERE test_id = 1;
|
UPDATE test_concurrent_dml SET data = 'blarg' WHERE test_id = 1;
|
||||||
|
|
||||||
|
|
||||||
|
starting permutation: s1-begin s1-multi-insert s2-update s1-commit
|
||||||
|
master_create_worker_shards
|
||||||
|
|
||||||
|
|
||||||
|
step s1-begin:
|
||||||
|
BEGIN;
|
||||||
|
|
||||||
|
step s1-multi-insert:
|
||||||
|
INSERT INTO test_concurrent_dml VALUES (1), (2);
|
||||||
|
|
||||||
|
step s2-update:
|
||||||
|
UPDATE test_concurrent_dml SET data = 'blarg' WHERE test_id = 1;
|
||||||
|
<waiting ...>
|
||||||
|
step s1-commit:
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
step s2-update: <... completed>
|
||||||
|
|
||||||
|
starting permutation: s1-begin s1-multi-insert s2-multi-insert-overlap s1-commit
|
||||||
|
master_create_worker_shards
|
||||||
|
|
||||||
|
|
||||||
|
step s1-begin:
|
||||||
|
BEGIN;
|
||||||
|
|
||||||
|
step s1-multi-insert:
|
||||||
|
INSERT INTO test_concurrent_dml VALUES (1), (2);
|
||||||
|
|
||||||
|
step s2-multi-insert-overlap:
|
||||||
|
INSERT INTO test_concurrent_dml VALUES (1), (4);
|
||||||
|
<waiting ...>
|
||||||
|
step s1-commit:
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
step s2-multi-insert-overlap: <... completed>
|
||||||
|
|
||||||
|
starting permutation: s1-begin s2-begin s1-multi-insert s2-multi-insert s1-commit s2-commit
|
||||||
|
master_create_worker_shards
|
||||||
|
|
||||||
|
|
||||||
|
step s1-begin:
|
||||||
|
BEGIN;
|
||||||
|
|
||||||
|
step s2-begin:
|
||||||
|
BEGIN;
|
||||||
|
|
||||||
|
step s1-multi-insert:
|
||||||
|
INSERT INTO test_concurrent_dml VALUES (1), (2);
|
||||||
|
|
||||||
|
step s2-multi-insert:
|
||||||
|
INSERT INTO test_concurrent_dml VALUES (3), (4);
|
||||||
|
|
||||||
|
step s1-commit:
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
step s2-commit:
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ step s1-get-current-transaction-id:
|
||||||
|
|
||||||
row
|
row
|
||||||
|
|
||||||
(0,290)
|
(0,301)
|
||||||
step s2-get-first-worker-active-transactions:
|
step s2-get-first-worker-active-transactions:
|
||||||
SELECT * FROM run_command_on_workers('SELECT row(initiator_node_identifier, transaction_number)
|
SELECT * FROM run_command_on_workers('SELECT row(initiator_node_identifier, transaction_number)
|
||||||
FROM
|
FROM
|
||||||
|
@ -109,4 +109,4 @@ step s2-get-first-worker-active-transactions:
|
||||||
|
|
||||||
nodename nodeport success result
|
nodename nodeport success result
|
||||||
|
|
||||||
localhost 57637 t (0,290)
|
localhost 57637 t (0,301)
|
||||||
|
|
|
@ -29,11 +29,11 @@ step detector-dump-wait-edges:
|
||||||
|
|
||||||
waiting_transaction_numblocking_transaction_numblocking_transaction_waiting
|
waiting_transaction_numblocking_transaction_numblocking_transaction_waiting
|
||||||
|
|
||||||
293 292 f
|
304 303 f
|
||||||
transactionnumberwaitingtransactionnumbers
|
transactionnumberwaitingtransactionnumbers
|
||||||
|
|
||||||
292
|
303
|
||||||
293 292
|
304 303
|
||||||
step s1-abort:
|
step s1-abort:
|
||||||
ABORT;
|
ABORT;
|
||||||
|
|
||||||
|
@ -77,14 +77,14 @@ step detector-dump-wait-edges:
|
||||||
|
|
||||||
waiting_transaction_numblocking_transaction_numblocking_transaction_waiting
|
waiting_transaction_numblocking_transaction_numblocking_transaction_waiting
|
||||||
|
|
||||||
297 296 f
|
308 307 f
|
||||||
298 296 f
|
309 307 f
|
||||||
298 297 t
|
309 308 t
|
||||||
transactionnumberwaitingtransactionnumbers
|
transactionnumberwaitingtransactionnumbers
|
||||||
|
|
||||||
296
|
307
|
||||||
297 296
|
308 307
|
||||||
298 296,297
|
309 307,308
|
||||||
step s1-abort:
|
step s1-abort:
|
||||||
ABORT;
|
ABORT;
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ step s1-finish:
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
step s2-insert: <... completed>
|
step s2-insert: <... completed>
|
||||||
error in steps s1-finish s2-insert: ERROR: duplicate key value violates unique constraint "test_locking_a_key_102781"
|
error in steps s1-finish s2-insert: ERROR: duplicate key value violates unique constraint "test_locking_a_key_102793"
|
||||||
step s2-finish:
|
step s2-finish:
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,11 @@ step "s1-insert"
|
||||||
INSERT INTO test_concurrent_dml VALUES(1);
|
INSERT INTO test_concurrent_dml VALUES(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
step "s1-multi-insert"
|
||||||
|
{
|
||||||
|
INSERT INTO test_concurrent_dml VALUES (1), (2);
|
||||||
|
}
|
||||||
|
|
||||||
step "s1-commit"
|
step "s1-commit"
|
||||||
{
|
{
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
@ -29,12 +34,42 @@ step "s1-commit"
|
||||||
|
|
||||||
session "s2"
|
session "s2"
|
||||||
|
|
||||||
|
step "s2-begin"
|
||||||
|
{
|
||||||
|
BEGIN;
|
||||||
|
}
|
||||||
|
|
||||||
step "s2-update"
|
step "s2-update"
|
||||||
{
|
{
|
||||||
UPDATE test_concurrent_dml SET data = 'blarg' WHERE test_id = 1;
|
UPDATE test_concurrent_dml SET data = 'blarg' WHERE test_id = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
step "s2-multi-insert-overlap"
|
||||||
|
{
|
||||||
|
INSERT INTO test_concurrent_dml VALUES (1), (4);
|
||||||
|
}
|
||||||
|
|
||||||
|
step "s2-multi-insert"
|
||||||
|
{
|
||||||
|
INSERT INTO test_concurrent_dml VALUES (3), (4);
|
||||||
|
}
|
||||||
|
|
||||||
|
step "s2-commit"
|
||||||
|
{
|
||||||
|
COMMIT;
|
||||||
|
}
|
||||||
|
|
||||||
# verify that an in-progress insert blocks concurrent updates
|
# verify that an in-progress insert blocks concurrent updates
|
||||||
permutation "s1-begin" "s1-insert" "s2-update" "s1-commit"
|
permutation "s1-begin" "s1-insert" "s2-update" "s1-commit"
|
||||||
|
|
||||||
# but an insert without xact will not block
|
# but an insert without xact will not block
|
||||||
permutation "s1-insert" "s2-update"
|
permutation "s1-insert" "s2-update"
|
||||||
|
|
||||||
|
# verify that an in-progress multi-row insert blocks concurrent updates
|
||||||
|
permutation "s1-begin" "s1-multi-insert" "s2-update" "s1-commit"
|
||||||
|
|
||||||
|
# two multi-row inserts that hit same shards will block
|
||||||
|
permutation "s1-begin" "s1-multi-insert" "s2-multi-insert-overlap" "s1-commit"
|
||||||
|
|
||||||
|
# but concurrent multi-row inserts don't block unless shards overlap
|
||||||
|
permutation "s1-begin" "s2-begin" "s1-multi-insert" "s2-multi-insert" "s1-commit" "s2-commit"
|
||||||
|
|
Loading…
Reference in New Issue