File tree Expand file tree Collapse file tree
localtests/panic-on-warnings-update-pk-with-duplicate-on-new-unique-index Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,16 +13,18 @@ drop event if exists gh_ost_test;
1313delimiter ;;
1414create 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
2121begin
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;
2830end ;;
You can’t perform that action at this time.
0 commit comments