Skip to content

Commit 223d590

Browse files
committed
Reduce flakiness pt. 2
1 parent f1a1162 commit 223d590

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

  • localtests/panic-on-warnings-update-pk-with-duplicate-on-new-unique-index

localtests/panic-on-warnings-update-pk-with-duplicate-on-new-unique-index/create.sql

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,18 @@ drop event if exists gh_ost_test;
1313
delimiter ;;
1414
create event gh_ost_test
1515
on schedule every 1 second
16-
starts current_timestamp + interval 6 second
16+
starts current_timestamp
1717
ends current_timestamp + interval 60 second
1818
on completion not preserve
1919
enable
2020
do
2121
begin
22-
-- This UPDATE modifies the primary key, so it will be converted to DELETE + INSERT
23-
-- The INSERT will attempt to insert email='alice@example.com' (duplicate)
24-
-- which violates the new unique index being added by the migration
25-
-- Delay of 6s ensures this fires after row copy starts (throttle delays until 5s)
26-
-- but before migration completes, so duplicate is caught during DML event application
27-
update gh_ost_test set id=10, email='alice@example.com' where id=2;
22+
-- Poll for row copy to start by checking if alice has been copied to ghost table
23+
-- Once row copy has started, fire the UPDATE that creates a duplicate
24+
if exists (select 1 from test._gh_ost_test_gho where email = 'alice@example.com') then
25+
-- This UPDATE modifies the primary key, so it will be converted to DELETE + INSERT
26+
-- The INSERT will attempt to insert email='alice@example.com' (duplicate)
27+
-- which violates the new unique index being added by the migration
28+
update gh_ost_test set id=10, email='alice@example.com' where id=2;
29+
end if;
2830
end ;;

0 commit comments

Comments
 (0)