mirror of https://github.com/citusdata/citus.git
Use RowExclusiveLock shard resource lock in COPY
parent
b685dfa99f
commit
acbc0fe0de
|
@ -2088,7 +2088,12 @@ CitusCopyDestReceiverStartup(DestReceiver *dest, int operation,
|
||||||
|
|
||||||
/* prevent concurrent placement changes and non-commutative DML statements */
|
/* prevent concurrent placement changes and non-commutative DML statements */
|
||||||
LockShardListMetadata(shardIntervalList, ShareLock);
|
LockShardListMetadata(shardIntervalList, ShareLock);
|
||||||
LockShardListResources(shardIntervalList, ShareLock);
|
|
||||||
|
/*
|
||||||
|
* Prevent concurrent UPDATE/DELETE on replication factor >1
|
||||||
|
* (see multi_router_executor.c)
|
||||||
|
*/
|
||||||
|
LockShardListResources(shardIntervalList, RowExclusiveLock);
|
||||||
|
|
||||||
/* keep the table metadata to avoid looking it up for every tuple */
|
/* keep the table metadata to avoid looking it up for every tuple */
|
||||||
copyDest->tableMetadata = cacheEntry;
|
copyDest->tableMetadata = cacheEntry;
|
||||||
|
|
|
@ -97,13 +97,12 @@ create_distributed_table
|
||||||
step s1-initialize: COPY hash_copy FROM PROGRAM 'echo 0, a, 0\\n1, b, 1\\n2, c, 2\\n3, d, 3\\n4, e, 4' WITH CSV;
|
step s1-initialize: COPY hash_copy FROM PROGRAM 'echo 0, a, 0\\n1, b, 1\\n2, c, 2\\n3, d, 3\\n4, e, 4' WITH CSV;
|
||||||
step s1-begin: BEGIN;
|
step s1-begin: BEGIN;
|
||||||
step s1-copy: COPY hash_copy FROM PROGRAM 'echo 5, f, 5\\n6, g, 6\\n7, h, 7\\n8, i, 8\\n9, j, 9' WITH CSV;
|
step s1-copy: COPY hash_copy FROM PROGRAM 'echo 5, f, 5\\n6, g, 6\\n7, h, 7\\n8, i, 8\\n9, j, 9' WITH CSV;
|
||||||
step s2-insert-select: INSERT INTO hash_copy SELECT * FROM hash_copy; <waiting ...>
|
step s2-insert-select: INSERT INTO hash_copy SELECT * FROM hash_copy;
|
||||||
step s1-commit: COMMIT;
|
step s1-commit: COMMIT;
|
||||||
step s2-insert-select: <... completed>
|
|
||||||
step s1-select-count: SELECT COUNT(*) FROM hash_copy;
|
step s1-select-count: SELECT COUNT(*) FROM hash_copy;
|
||||||
count
|
count
|
||||||
|
|
||||||
20
|
15
|
||||||
|
|
||||||
starting permutation: s1-initialize s1-begin s1-copy s2-update s1-commit s1-select-count
|
starting permutation: s1-initialize s1-begin s1-copy s2-update s1-commit s1-select-count
|
||||||
create_distributed_table
|
create_distributed_table
|
||||||
|
@ -307,16 +306,15 @@ create_distributed_table
|
||||||
step s1-initialize: COPY hash_copy FROM PROGRAM 'echo 0, a, 0\\n1, b, 1\\n2, c, 2\\n3, d, 3\\n4, e, 4' WITH CSV;
|
step s1-initialize: COPY hash_copy FROM PROGRAM 'echo 0, a, 0\\n1, b, 1\\n2, c, 2\\n3, d, 3\\n4, e, 4' WITH CSV;
|
||||||
step s1-begin: BEGIN;
|
step s1-begin: BEGIN;
|
||||||
step s1-copy: COPY hash_copy FROM PROGRAM 'echo 5, f, 5\\n6, g, 6\\n7, h, 7\\n8, i, 8\\n9, j, 9' WITH CSV;
|
step s1-copy: COPY hash_copy FROM PROGRAM 'echo 5, f, 5\\n6, g, 6\\n7, h, 7\\n8, i, 8\\n9, j, 9' WITH CSV;
|
||||||
step s2-master-modify-multiple-shards: SELECT master_modify_multiple_shards('DELETE FROM hash_copy;'); <waiting ...>
|
step s2-master-modify-multiple-shards: SELECT master_modify_multiple_shards('DELETE FROM hash_copy;');
|
||||||
step s1-commit: COMMIT;
|
|
||||||
step s2-master-modify-multiple-shards: <... completed>
|
|
||||||
master_modify_multiple_shards
|
master_modify_multiple_shards
|
||||||
|
|
||||||
10
|
5
|
||||||
|
step s1-commit: COMMIT;
|
||||||
step s1-select-count: SELECT COUNT(*) FROM hash_copy;
|
step s1-select-count: SELECT COUNT(*) FROM hash_copy;
|
||||||
count
|
count
|
||||||
|
|
||||||
0
|
5
|
||||||
|
|
||||||
starting permutation: s1-initialize s1-begin s1-copy s2-master-drop-all-shards s1-commit s1-select-count
|
starting permutation: s1-initialize s1-begin s1-copy s2-master-drop-all-shards s1-commit s1-select-count
|
||||||
create_distributed_table
|
create_distributed_table
|
||||||
|
@ -439,9 +437,8 @@ create_distributed_table
|
||||||
step s1-initialize: COPY hash_copy FROM PROGRAM 'echo 0, a, 0\\n1, b, 1\\n2, c, 2\\n3, d, 3\\n4, e, 4' WITH CSV;
|
step s1-initialize: COPY hash_copy FROM PROGRAM 'echo 0, a, 0\\n1, b, 1\\n2, c, 2\\n3, d, 3\\n4, e, 4' WITH CSV;
|
||||||
step s1-begin: BEGIN;
|
step s1-begin: BEGIN;
|
||||||
step s1-insert-select: INSERT INTO hash_copy SELECT * FROM hash_copy;
|
step s1-insert-select: INSERT INTO hash_copy SELECT * FROM hash_copy;
|
||||||
step s2-copy: COPY hash_copy FROM PROGRAM 'echo 5, f, 5\\n6, g, 6\\n7, h, 7\\n8, i, 8\\n9, j, 9' WITH CSV; <waiting ...>
|
step s2-copy: COPY hash_copy FROM PROGRAM 'echo 5, f, 5\\n6, g, 6\\n7, h, 7\\n8, i, 8\\n9, j, 9' WITH CSV;
|
||||||
step s1-commit: COMMIT;
|
step s1-commit: COMMIT;
|
||||||
step s2-copy: <... completed>
|
|
||||||
step s1-select-count: SELECT COUNT(*) FROM hash_copy;
|
step s1-select-count: SELECT COUNT(*) FROM hash_copy;
|
||||||
count
|
count
|
||||||
|
|
||||||
|
@ -634,9 +631,8 @@ step s1-master-modify-multiple-shards: SELECT master_modify_multiple_shards('DEL
|
||||||
master_modify_multiple_shards
|
master_modify_multiple_shards
|
||||||
|
|
||||||
5
|
5
|
||||||
step s2-copy: COPY hash_copy FROM PROGRAM 'echo 5, f, 5\\n6, g, 6\\n7, h, 7\\n8, i, 8\\n9, j, 9' WITH CSV; <waiting ...>
|
step s2-copy: COPY hash_copy FROM PROGRAM 'echo 5, f, 5\\n6, g, 6\\n7, h, 7\\n8, i, 8\\n9, j, 9' WITH CSV;
|
||||||
step s1-commit: COMMIT;
|
step s1-commit: COMMIT;
|
||||||
step s2-copy: <... completed>
|
|
||||||
step s1-select-count: SELECT COUNT(*) FROM hash_copy;
|
step s1-select-count: SELECT COUNT(*) FROM hash_copy;
|
||||||
count
|
count
|
||||||
|
|
||||||
|
|
|
@ -288,12 +288,11 @@ step s1-initialize:
|
||||||
|
|
||||||
step s1-begin: BEGIN;
|
step s1-begin: BEGIN;
|
||||||
step s1-insert-select: INSERT INTO insert_of_insert_select_hash SELECT * FROM select_of_insert_select_hash ORDER BY 1, 2 LIMIT 5;;
|
step s1-insert-select: INSERT INTO insert_of_insert_select_hash SELECT * FROM select_of_insert_select_hash ORDER BY 1, 2 LIMIT 5;;
|
||||||
step s2-master-modify-multiple-shards-on-inserted: SELECT master_modify_multiple_shards('DELETE FROM insert_of_insert_select_hash;'); <waiting ...>
|
step s2-master-modify-multiple-shards-on-inserted: SELECT master_modify_multiple_shards('DELETE FROM insert_of_insert_select_hash;');
|
||||||
step s1-commit: COMMIT;
|
|
||||||
step s2-master-modify-multiple-shards-on-inserted: <... completed>
|
|
||||||
master_modify_multiple_shards
|
master_modify_multiple_shards
|
||||||
|
|
||||||
15
|
10
|
||||||
|
step s1-commit: COMMIT;
|
||||||
step s1-select-count: SELECT COUNT(*) FROM select_of_insert_select_hash;
|
step s1-select-count: SELECT COUNT(*) FROM select_of_insert_select_hash;
|
||||||
count
|
count
|
||||||
|
|
||||||
|
@ -908,9 +907,8 @@ step s1-master-modify-multiple-shards-on-inserted: SELECT master_modify_multiple
|
||||||
master_modify_multiple_shards
|
master_modify_multiple_shards
|
||||||
|
|
||||||
10
|
10
|
||||||
step s2-insert-select: INSERT INTO insert_of_insert_select_hash SELECT * FROM select_of_insert_select_hash ORDER BY 1, 2 LIMIT 5; <waiting ...>
|
step s2-insert-select: INSERT INTO insert_of_insert_select_hash SELECT * FROM select_of_insert_select_hash ORDER BY 1, 2 LIMIT 5;
|
||||||
step s1-commit: COMMIT;
|
step s1-commit: COMMIT;
|
||||||
step s2-insert-select: <... completed>
|
|
||||||
step s1-select-count: SELECT COUNT(*) FROM select_of_insert_select_hash;
|
step s1-select-count: SELECT COUNT(*) FROM select_of_insert_select_hash;
|
||||||
count
|
count
|
||||||
|
|
||||||
|
|
|
@ -97,13 +97,12 @@ create_distributed_table
|
||||||
step s1-initialize: COPY partitioned_copy FROM PROGRAM 'echo 0, a, 0\\n1, b, 1\\n2, c, 2\\n3, d, 3\\n4, e, 4' WITH CSV;
|
step s1-initialize: COPY partitioned_copy FROM PROGRAM 'echo 0, a, 0\\n1, b, 1\\n2, c, 2\\n3, d, 3\\n4, e, 4' WITH CSV;
|
||||||
step s1-begin: BEGIN;
|
step s1-begin: BEGIN;
|
||||||
step s1-copy: COPY partitioned_copy FROM PROGRAM 'echo 5, f, 5\\n6, g, 6\\n7, h, 7\\n8, i, 8\\n9, j, 9' WITH CSV;
|
step s1-copy: COPY partitioned_copy FROM PROGRAM 'echo 5, f, 5\\n6, g, 6\\n7, h, 7\\n8, i, 8\\n9, j, 9' WITH CSV;
|
||||||
step s2-insert-select: INSERT INTO partitioned_copy SELECT * FROM partitioned_copy; <waiting ...>
|
step s2-insert-select: INSERT INTO partitioned_copy SELECT * FROM partitioned_copy;
|
||||||
step s1-commit: COMMIT;
|
step s1-commit: COMMIT;
|
||||||
step s2-insert-select: <... completed>
|
|
||||||
step s1-select-count: SELECT COUNT(*) FROM partitioned_copy;
|
step s1-select-count: SELECT COUNT(*) FROM partitioned_copy;
|
||||||
count
|
count
|
||||||
|
|
||||||
20
|
15
|
||||||
|
|
||||||
starting permutation: s1-initialize s1-begin s1-copy s2-update s1-commit s1-select-count
|
starting permutation: s1-initialize s1-begin s1-copy s2-update s1-commit s1-select-count
|
||||||
create_distributed_table
|
create_distributed_table
|
||||||
|
@ -246,16 +245,15 @@ create_distributed_table
|
||||||
step s1-initialize: COPY partitioned_copy FROM PROGRAM 'echo 0, a, 0\\n1, b, 1\\n2, c, 2\\n3, d, 3\\n4, e, 4' WITH CSV;
|
step s1-initialize: COPY partitioned_copy FROM PROGRAM 'echo 0, a, 0\\n1, b, 1\\n2, c, 2\\n3, d, 3\\n4, e, 4' WITH CSV;
|
||||||
step s1-begin: BEGIN;
|
step s1-begin: BEGIN;
|
||||||
step s1-copy: COPY partitioned_copy FROM PROGRAM 'echo 5, f, 5\\n6, g, 6\\n7, h, 7\\n8, i, 8\\n9, j, 9' WITH CSV;
|
step s1-copy: COPY partitioned_copy FROM PROGRAM 'echo 5, f, 5\\n6, g, 6\\n7, h, 7\\n8, i, 8\\n9, j, 9' WITH CSV;
|
||||||
step s2-master-modify-multiple-shards: SELECT master_modify_multiple_shards('DELETE FROM partitioned_copy;'); <waiting ...>
|
step s2-master-modify-multiple-shards: SELECT master_modify_multiple_shards('DELETE FROM partitioned_copy;');
|
||||||
step s1-commit: COMMIT;
|
|
||||||
step s2-master-modify-multiple-shards: <... completed>
|
|
||||||
master_modify_multiple_shards
|
master_modify_multiple_shards
|
||||||
|
|
||||||
10
|
5
|
||||||
|
step s1-commit: COMMIT;
|
||||||
step s1-select-count: SELECT COUNT(*) FROM partitioned_copy;
|
step s1-select-count: SELECT COUNT(*) FROM partitioned_copy;
|
||||||
count
|
count
|
||||||
|
|
||||||
0
|
5
|
||||||
|
|
||||||
starting permutation: s1-initialize s1-begin s1-copy s2-master-drop-all-shards s1-commit s1-select-count
|
starting permutation: s1-initialize s1-begin s1-copy s2-master-drop-all-shards s1-commit s1-select-count
|
||||||
create_distributed_table
|
create_distributed_table
|
||||||
|
@ -378,9 +376,8 @@ create_distributed_table
|
||||||
step s1-initialize: COPY partitioned_copy FROM PROGRAM 'echo 0, a, 0\\n1, b, 1\\n2, c, 2\\n3, d, 3\\n4, e, 4' WITH CSV;
|
step s1-initialize: COPY partitioned_copy FROM PROGRAM 'echo 0, a, 0\\n1, b, 1\\n2, c, 2\\n3, d, 3\\n4, e, 4' WITH CSV;
|
||||||
step s1-begin: BEGIN;
|
step s1-begin: BEGIN;
|
||||||
step s1-insert-select: INSERT INTO partitioned_copy SELECT * FROM partitioned_copy;
|
step s1-insert-select: INSERT INTO partitioned_copy SELECT * FROM partitioned_copy;
|
||||||
step s2-copy: COPY partitioned_copy FROM PROGRAM 'echo 5, f, 5\\n6, g, 6\\n7, h, 7\\n8, i, 8\\n9, j, 9' WITH CSV; <waiting ...>
|
step s2-copy: COPY partitioned_copy FROM PROGRAM 'echo 5, f, 5\\n6, g, 6\\n7, h, 7\\n8, i, 8\\n9, j, 9' WITH CSV;
|
||||||
step s1-commit: COMMIT;
|
step s1-commit: COMMIT;
|
||||||
step s2-copy: <... completed>
|
|
||||||
step s1-select-count: SELECT COUNT(*) FROM partitioned_copy;
|
step s1-select-count: SELECT COUNT(*) FROM partitioned_copy;
|
||||||
count
|
count
|
||||||
|
|
||||||
|
@ -532,9 +529,8 @@ step s1-master-modify-multiple-shards: SELECT master_modify_multiple_shards('DEL
|
||||||
master_modify_multiple_shards
|
master_modify_multiple_shards
|
||||||
|
|
||||||
5
|
5
|
||||||
step s2-copy: COPY partitioned_copy FROM PROGRAM 'echo 5, f, 5\\n6, g, 6\\n7, h, 7\\n8, i, 8\\n9, j, 9' WITH CSV; <waiting ...>
|
step s2-copy: COPY partitioned_copy FROM PROGRAM 'echo 5, f, 5\\n6, g, 6\\n7, h, 7\\n8, i, 8\\n9, j, 9' WITH CSV;
|
||||||
step s1-commit: COMMIT;
|
step s1-commit: COMMIT;
|
||||||
step s2-copy: <... completed>
|
|
||||||
step s1-select-count: SELECT COUNT(*) FROM partitioned_copy;
|
step s1-select-count: SELECT COUNT(*) FROM partitioned_copy;
|
||||||
count
|
count
|
||||||
|
|
||||||
|
|
|
@ -83,9 +83,8 @@ create_reference_table
|
||||||
step s1-initialize: COPY reference_copy FROM PROGRAM 'echo 0, a, 0\\n1, b, 1\\n2, c, 2\\n3, d, 3\\n4, e, 4' WITH CSV;
|
step s1-initialize: COPY reference_copy FROM PROGRAM 'echo 0, a, 0\\n1, b, 1\\n2, c, 2\\n3, d, 3\\n4, e, 4' WITH CSV;
|
||||||
step s1-begin: BEGIN;
|
step s1-begin: BEGIN;
|
||||||
step s1-copy: COPY reference_copy FROM PROGRAM 'echo 5, f, 5\\n6, g, 6\\n7, h, 7\\n8, i, 8\\n9, j, 9' WITH CSV;
|
step s1-copy: COPY reference_copy FROM PROGRAM 'echo 5, f, 5\\n6, g, 6\\n7, h, 7\\n8, i, 8\\n9, j, 9' WITH CSV;
|
||||||
step s2-insert: INSERT INTO reference_copy VALUES(0, 'k', 0); <waiting ...>
|
step s2-insert: INSERT INTO reference_copy VALUES(0, 'k', 0);
|
||||||
step s1-commit: COMMIT;
|
step s1-commit: COMMIT;
|
||||||
step s2-insert: <... completed>
|
|
||||||
step s1-select-count: SELECT COUNT(*) FROM reference_copy;
|
step s1-select-count: SELECT COUNT(*) FROM reference_copy;
|
||||||
count
|
count
|
||||||
|
|
||||||
|
@ -410,9 +409,8 @@ create_reference_table
|
||||||
step s1-initialize: COPY reference_copy FROM PROGRAM 'echo 0, a, 0\\n1, b, 1\\n2, c, 2\\n3, d, 3\\n4, e, 4' WITH CSV;
|
step s1-initialize: COPY reference_copy FROM PROGRAM 'echo 0, a, 0\\n1, b, 1\\n2, c, 2\\n3, d, 3\\n4, e, 4' WITH CSV;
|
||||||
step s1-begin: BEGIN;
|
step s1-begin: BEGIN;
|
||||||
step s1-insert: INSERT INTO reference_copy VALUES(0, 'k', 0);
|
step s1-insert: INSERT INTO reference_copy VALUES(0, 'k', 0);
|
||||||
step s2-copy: COPY reference_copy FROM PROGRAM 'echo 5, f, 5\\n6, g, 6\\n7, h, 7\\n8, i, 8\\n9, j, 9' WITH CSV; <waiting ...>
|
step s2-copy: COPY reference_copy FROM PROGRAM 'echo 5, f, 5\\n6, g, 6\\n7, h, 7\\n8, i, 8\\n9, j, 9' WITH CSV;
|
||||||
step s1-commit: COMMIT;
|
step s1-commit: COMMIT;
|
||||||
step s2-copy: <... completed>
|
|
||||||
step s1-select-count: SELECT COUNT(*) FROM reference_copy;
|
step s1-select-count: SELECT COUNT(*) FROM reference_copy;
|
||||||
count
|
count
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue