A fix for MDEV-31043 is already in the branch. Besides, this time the failure affects transactional engines as well, reproducible with at least InnoDB, MyISAM, Aria, HEAP.
The test case is non-deterministic, run with --repeat=N. It fails for me on almost every attempt, but it can vary on different machines and builds.
The second table (t2) seems to be important somehow, at least I couldn't replace its operation with just a sleep.
--source include/have_sequence.inc
CREATETABLE t1 (b int);
INSERTINTO t1 VALUES (0),(0);
CREATETABLE t2 (a int);
INSERTINTO t2 (a) select seq from seq_1_to_128;
--connect (con1,localhost,root,,)
--send
ALTERTABLE t1 MODIFY b SERIAL;
--connection default
DELETEFROM t2 ORDERBY a LIMIT 1;
DELETEFROM t1 ORDERBY b LIMIT 2;
--connection con1
--reap
# Cleanup
DROPTABLE t1, t2;
bb-11.0-oalter 6f5427417eff
mysqltest: At line 18: query 'reap' failed: ER_KEY_NOT_FOUND (1032): Can't find record in 't1'
Attachments
Issue Links
causes
MDEV-31128Server crashes in Rows_log_event::find_row upon concurrent DML and ALTER
Closed
MDEV-31172Server crash or ASAN errors in online_alter_check_autoinc
Closed
includes
MDEV-31128Server crashes in Rows_log_event::find_row upon concurrent DML and ALTER
Closed
MDEV-31136Online ALTER is allowed on master but fails on slave with ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
Closed
MDEV-31172Server crash or ASAN errors in online_alter_check_autoinc
ER_KEY_NOT_FOUND seems to become a generic marker for ONLINE ALTER TABLE.
The problem here is with an added AUTO_INCREMENT (SERIAL) for a field spec, whereas the initial values were 0:
CREATETABLE t1 (b int) engine=InnoDB;
INSERTINTO t1 VALUES (0),(0);
connect con1,localhost,root,,;
ALTERTABLE t1 MODIFY b SERIAL;
select * from t1;
b
1
2
DROPTABLE t1;
The autoinc value was silently applied under disabled NO_AUTO_VALUE_ON_ZERO mode.
So the value '0' from the online change could not be found.
Nikita Malyavin
added a comment - ER_KEY_NOT_FOUND seems to become a generic marker for ONLINE ALTER TABLE.
The problem here is with an added AUTO_INCREMENT (SERIAL) for a field spec, whereas the initial values were 0:
CREATE TABLE t1 (b int ) engine=InnoDB;
INSERT INTO t1 VALUES (0),(0);
connect con1,localhost,root,,;
ALTER TABLE t1 MODIFY b SERIAL;
select * from t1;
b
1
2
DROP TABLE t1;
The autoinc value was silently applied under disabled NO_AUTO_VALUE_ON_ZERO mode.
So the value '0' from the online change could not be found.
serg I already wrote an algorithm that covers a good subset. I think I'd really like to avoid mentioning that something with AUTO_INC doesn't work in the article
Nikita Malyavin
added a comment - serg I already wrote an algorithm that covers a good subset. I think I'd really like to avoid mentioning that something with AUTO_INC doesn't work in the article
You cannot disable NO_AUTO_VALUE_ON_ZERO, non-blocking alter must produce the same result as blocking.
Technically, you can do online when AUTO_INC is added if the old table had a PK and this PK isn't changed in the ALTER TABLE. But I think it's a very corner use case, normally AUTO_INC is PK.
Sergei Golubchik
added a comment - You cannot disable NO_AUTO_VALUE_ON_ZERO, non-blocking alter must produce the same result as blocking.
Technically, you can do online when AUTO_INC is added if the old table had a PK and this PK isn't changed in the ALTER TABLE. But I think it's a very corner use case, normally AUTO_INC is PK.
altertable t1 modify b int auto_increment, addkey(b);
select * from t1 orderby a,b;
droptable t1;
it prints
a b
1 1
2 10
3 11
4 12
I don't understand how it could be even possible to do the above online.
If I recall correctly, conceptually online alter should produce the same result as if all concurrent updates were done before the alter.
Sergei Golubchik
added a comment - - edited consider this example
create table t1 (a int , b int );
insert t1 values (1, NULL ),(2, NULL ),(3, NULL ),(4, NULL );
update t1 set b=10 where a=2;
alter table t1 modify b int auto_increment, add key (b);
select * from t1 order by a,b;
drop table t1;
it prints
a b
1 1
2 10
3 11
4 12
I don't understand how it could be even possible to do the above online.
If I recall correctly, conceptually online alter should produce the same result as if all concurrent updates were done before the alter.
But of course. A user does SELECT — sees the old table structure. Performs UPDATE, commits, runs SELECT again — sees the old table structure, with the updated content. There's no other way to interpret it, the UPDATE was applied to the old table structure, before the ALTER.
Sergei Golubchik
added a comment - But of course. A user does SELECT — sees the old table structure. Performs UPDATE , commits, runs SELECT again — sees the old table structure, with the updated content. There's no other way to interpret it, the UPDATE was applied to the old table structure, before the ALTER .
db2d411bc is obsolete, it seems, because d23555b19206 (MDEV-30984) rewrites it.
I've already commented on d23555b19206, so there's no need to review db2d411bc anymore.
Sergei Golubchik
added a comment - db2d411bc is obsolete, it seems, because d23555b19206 ( MDEV-30984 ) rewrites it.
I've already commented on d23555b19206, so there's no need to review db2d411bc anymore.
Well, yes, it can be done so, almost. Thanks. the commit could be useful to understand the intentions at first place, but I can squash it
Nikita Malyavin
added a comment - Well, yes, it can be done so, almost. Thanks. the commit could be useful to understand the intentions at first place, but I can squash it
People
Nikita Malyavin
Elena Stepanova
Votes:
0Vote for this issue
Watchers:
3Start watching this issue
Dates
Created:
Updated:
Resolved:
Git Integration
Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.
{"report":{"fcp":1372.4000005722046,"ttfb":469.4000005722046,"pageVisibility":"visible","entityId":121110,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"b282becc-2417-42fd-b64a-26e399db2150","navigationType":0,"readyForUser":1453.1000003814697,"redirectCount":0,"resourceLoadedEnd":1620.2000007629395,"resourceLoadedStart":478,"resourceTiming":[{"duration":365.6000003814697,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":478,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":478,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":843.6000003814697,"responseStart":0,"secureConnectionStart":0},{"duration":365.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bv2/820016/12ta74/2380add21a9a1006587582385952de73/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":478.4000005722046,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":478.4000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":843.9000005722046,"responseStart":0,"secureConnectionStart":0},{"duration":373.8999996185303,"initiatorType":"script","name":"https://jira.mariadb.org/s/e9b27a47da5fb0f74a35acd57e9847fb-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":478.6000003814697,"connectEnd":478.6000003814697,"connectStart":478.6000003814697,"domainLookupEnd":478.6000003814697,"domainLookupStart":478.6000003814697,"fetchStart":478.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":478.6000003814697,"responseEnd":852.5,"responseStart":852.5,"secureConnectionStart":478.6000003814697},{"duration":409.29999923706055,"initiatorType":"script","name":"https://jira.mariadb.org/s/c32eb0da7ad9831253f8397e6cc26afd-CDN/lu2bv2/820016/12ta74/2380add21a9a1006587582385952de73/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":479.20000076293945,"connectEnd":479.20000076293945,"connectStart":479.20000076293945,"domainLookupEnd":479.20000076293945,"domainLookupStart":479.20000076293945,"fetchStart":479.20000076293945,"redirectEnd":0,"redirectStart":0,"requestStart":479.20000076293945,"responseEnd":888.5,"responseStart":888.5,"secureConnectionStart":479.20000076293945},{"duration":413.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/bc0bcb146314416123c992714ee00ff7-CDN/lu2bv2/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":479.4000005722046,"connectEnd":479.4000005722046,"connectStart":479.4000005722046,"domainLookupEnd":479.4000005722046,"domainLookupStart":479.4000005722046,"fetchStart":479.4000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":479.4000005722046,"responseEnd":892.6000003814697,"responseStart":892.6000003814697,"secureConnectionStart":479.4000005722046},{"duration":413.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":479.6000003814697,"connectEnd":479.6000003814697,"connectStart":479.6000003814697,"domainLookupEnd":479.6000003814697,"domainLookupStart":479.6000003814697,"fetchStart":479.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":479.6000003814697,"responseEnd":893.1000003814697,"responseStart":893.1000003814697,"secureConnectionStart":479.6000003814697},{"duration":413.69999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":479.9000005722046,"connectEnd":479.9000005722046,"connectStart":479.9000005722046,"domainLookupEnd":479.9000005722046,"domainLookupStart":479.9000005722046,"fetchStart":479.9000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":479.9000005722046,"responseEnd":893.6000003814697,"responseStart":893.6000003814697,"secureConnectionStart":479.9000005722046},{"duration":523.7000007629395,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bv2/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":480,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":480,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1003.7000007629395,"responseStart":0,"secureConnectionStart":0},{"duration":414.0999994277954,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":480.20000076293945,"connectEnd":480.20000076293945,"connectStart":480.20000076293945,"domainLookupEnd":480.20000076293945,"domainLookupStart":480.20000076293945,"fetchStart":480.20000076293945,"redirectEnd":0,"redirectStart":0,"requestStart":480.20000076293945,"responseEnd":894.3000001907349,"responseStart":894.3000001907349,"secureConnectionStart":480.20000076293945},{"duration":523.6999998092651,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bv2/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":480.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":480.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1004,"responseStart":0,"secureConnectionStart":0},{"duration":414.4000005722046,"initiatorType":"script","name":"https://jira.mariadb.org/s/719848dd97ebe0663199f49a3936487a-CDN/lu2bv2/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":480.5,"connectEnd":480.5,"connectStart":480.5,"domainLookupEnd":480.5,"domainLookupStart":480.5,"fetchStart":480.5,"redirectEnd":0,"redirectStart":0,"requestStart":480.5,"responseEnd":894.9000005722046,"responseStart":894.9000005722046,"secureConnectionStart":480.5},{"duration":591.6999998092651,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":507.1000003814697,"connectEnd":507.1000003814697,"connectStart":507.1000003814697,"domainLookupEnd":507.1000003814697,"domainLookupStart":507.1000003814697,"fetchStart":507.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":507.1000003814697,"responseEnd":1098.8000001907349,"responseStart":1098.8000001907349,"secureConnectionStart":507.1000003814697},{"duration":1048.1000003814697,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":543.3000001907349,"connectEnd":543.3000001907349,"connectStart":543.3000001907349,"domainLookupEnd":543.3000001907349,"domainLookupStart":543.3000001907349,"fetchStart":543.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":543.3000001907349,"responseEnd":1591.4000005722046,"responseStart":1591.4000005722046,"secureConnectionStart":543.3000001907349},{"duration":102.60000038146973,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1026.1000003814697,"connectEnd":1026.1000003814697,"connectStart":1026.1000003814697,"domainLookupEnd":1026.1000003814697,"domainLookupStart":1026.1000003814697,"fetchStart":1026.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":1026.1000003814697,"responseEnd":1128.7000007629395,"responseStart":1128.7000007629395,"secureConnectionStart":1026.1000003814697},{"duration":306.8999996185303,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2bv2/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/css/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":1310.6000003814697,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1310.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1617.5,"responseStart":0,"secureConnectionStart":0},{"duration":301.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-project.issue.navigator,-jira.view.issue,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":1311.6000003814697,"connectEnd":1311.6000003814697,"connectStart":1311.6000003814697,"domainLookupEnd":1311.6000003814697,"domainLookupStart":1311.6000003814697,"fetchStart":1311.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":1311.6000003814697,"responseEnd":1613.1000003814697,"responseStart":1613.1000003814697,"secureConnectionStart":1311.6000003814697},{"duration":308.1000003814697,"initiatorType":"script","name":"https://jira.mariadb.org/s/53a43b6764f587426c7bb9a150184c00-CDN/lu2bv2/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/js/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":1312.1000003814697,"connectEnd":1312.1000003814697,"connectStart":1312.1000003814697,"domainLookupEnd":1312.1000003814697,"domainLookupStart":1312.1000003814697,"fetchStart":1312.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":1312.1000003814697,"responseEnd":1620.2000007629395,"responseStart":1620.2000007629395,"secureConnectionStart":1312.1000003814697}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":253,"responseStart":470,"responseEnd":543,"domLoading":473,"domInteractive":1633,"domContentLoadedEventStart":1634,"domContentLoadedEventEnd":1687,"domComplete":2231,"loadEventStart":2231,"loadEventEnd":2231,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1593.1000003814697},{"name":"bigPipe.sidebar-id.end","time":1594},{"name":"bigPipe.activity-panel-pipe-id.start","time":1594.2000007629395},{"name":"bigPipe.activity-panel-pipe-id.end","time":1598.4000005722046},{"name":"activityTabFullyLoaded","time":1707.2000007629395}],"measures":[],"correlationId":"8b549692fe1acb","effectiveType":"4g","downlink":9.6,"rtt":0,"serverDuration":137,"dbReadsTimeInMs":17,"dbConnsTimeInMs":25,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
ER_KEY_NOT_FOUND seems to become a generic marker for ONLINE ALTER TABLE.
The problem here is with an added AUTO_INCREMENT (SERIAL) for a field spec, whereas the initial values were 0:
b
1
2
The autoinc value was silently applied under disabled NO_AUTO_VALUE_ON_ZERO mode.
So the value '0' from the online change could not be found.