1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
# name: test/sql/update/test_stress_update_issue_19688.test
# description: Concurrent stress test: UPDATE/DELETE/INSERT
# group: [update]
statement ok
DROP TABLE IF EXISTS test_stress_update_issue_19688
statement ok
CREATE TABLE test_stress_update_issue_19688 (
id INTEGER,
val INTEGER
)
# Insert 1000 initial rows
statement ok
INSERT INTO test_stress_update_issue_19688 SELECT range AS id, range * 1000 AS val FROM range(1000)
# Verify initial count
query I
SELECT COUNT(*) FROM test_stress_update_issue_19688
----
1000
# Launch 8 concurrent workers to perform UPDATE/DELETE/INSERT operations on the same rows
concurrentloop threadid 0 8
# Each worker operates on all 1000 rows
loop i 0 1000
statement maybe
UPDATE test_stress_update_issue_19688 SET val = (${threadid} * 10000 + ${i}) WHERE id = ${i}
----
TransactionContext Error
statement maybe
DELETE FROM test_stress_update_issue_19688 WHERE id = ${i}
----
TransactionContext Error
statement maybe
INSERT INTO test_stress_update_issue_19688 VALUES (${i}, ${threadid} * 10000 + ${i})
----
TransactionContext Error
endloop
endloop
# Verify all IDs from 0-999 are present
query I
SELECT COUNT(DISTINCT id) FROM test_stress_update_issue_19688
----
1000
|