forked from timescale/timescaledb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix concurrent locking with chunk_data_node table
Concurrent insert into dist hypertable after a data node marked as unavailable would produce 'tuple concurrently deleted` error. The problem occurs because of missing tuple level locking during scan and concurrent delete from chunk_data_node table afterwards, which should be treated as `SELECT … FOR UPDATE` case instead. Based on the fix by @erimatnor. Fix timescale#5153
- Loading branch information
Showing
11 changed files
with
237 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
Parsed test spec with 3 sessions | ||
|
||
starting permutation: s1_init s1_set_unavailable s3_lock_enable s1_insert s2_insert s3_lock_release s1_set_available | ||
node_name | ||
----------- | ||
data_node_1 | ||
(1 row) | ||
|
||
node_name | ||
----------- | ||
data_node_2 | ||
(1 row) | ||
|
||
node_name | ||
----------- | ||
data_node_3 | ||
(1 row) | ||
|
||
node_name | ||
----------- | ||
data_node_4 | ||
(1 row) | ||
|
||
created | ||
------- | ||
t | ||
(1 row) | ||
|
||
step s1_init: INSERT INTO metric1(ts, val, dev_id) SELECT s.*, 3.14, d.* FROM generate_series('2021-08-17 00:00:00'::timestamp, '2021-08-17 00:00:59'::timestamp, '1 s'::interval) s CROSS JOIN generate_series(1, 500) d; | ||
step s1_set_unavailable: SELECT alter_data_node('data_node_4', available=>false); | ||
alter_data_node | ||
-------------------------------------- | ||
(data_node_4,localhost,55432,cdha_4,f) | ||
(1 row) | ||
|
||
step s3_lock_enable: SELECT debug_waitpoint_enable('chunk_data_node_delete'); | ||
debug_waitpoint_enable | ||
---------------------- | ||
|
||
(1 row) | ||
|
||
step s1_insert: INSERT INTO metric1(ts, val, dev_id) SELECT s.*, 3.14, d.* FROM generate_series('2021-08-17 00:01:00'::timestamp, '2021-08-17 00:01:59'::timestamp, '1 s'::interval) s CROSS JOIN generate_series(1, 249) d; <waiting ...> | ||
step s2_insert: INSERT INTO metric1(ts, val, dev_id) SELECT s.*, 3.14, d.* FROM generate_series('2021-08-17 00:01:00'::timestamp, '2021-08-17 00:01:59'::timestamp, '1 s'::interval) s CROSS JOIN generate_series(250, 499) d; <waiting ...> | ||
step s3_lock_release: SELECT debug_waitpoint_release('chunk_data_node_delete'); | ||
debug_waitpoint_release | ||
----------------------- | ||
|
||
(1 row) | ||
|
||
step s1_insert: <... completed> | ||
step s2_insert: <... completed> | ||
step s1_set_available: SELECT alter_data_node('data_node_4', available=>true); | ||
alter_data_node | ||
-------------------------------------- | ||
(data_node_4,localhost,55432,cdha_4,t) | ||
(1 row) | ||
|
Oops, something went wrong.