This was originally reported by Roel as MySQL Bug #89087 Assertion `key->flags & 1' failed.
CREATE TABLE t1(c1 INT) ENGINE=InnoDB;
|
ALTER TABLE t1 ADD CONSTRAINT UNIQUE KEY i1(c1);
|
ALTER TABLE t1 CHANGE c1 c1 INT NOT NULL,ADD KEY(c1);
|
DROP TABLE t1;
|
There is a fix for this in MySQL 8.0.11, but I think that we should fix this differently in MariaDB, and starting from the first potentially affected version (10.0). I was not able to repeat a failure on 10.0 even after adding a debug assertion.
For 10.2, the minimal fix should be as follows:
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
|
index 02a8428cdc9..20bac687ccf 100644
|
--- a/storage/innobase/handler/handler0alter.cc
|
+++ b/storage/innobase/handler/handler0alter.cc
|
@@ -2597,10 +2597,8 @@ innobase_create_key_defs(
|
DBUG_ASSERT(got_default_clust);
|
DBUG_ASSERT(altered_table->s->primary_key
|
== 0);
|
- primary_key_number = 0;
|
- } else {
|
- primary_key_number = *add;
|
}
|
+ primary_key_number = altered_table->s->primary_key;
|
} else if (got_default_clust) {
|
/* Create the GEN_CLUST_INDEX */
|
index_def_t* index = indexdef++;
|
{"report":{"fcp":1046.0999999046326,"ttfb":211.5,"pageVisibility":"visible","entityId":66955,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"5a15f286-3d36-4017-8f6e-09c33064f750","navigationType":0,"readyForUser":1125.6999999284744,"redirectCount":0,"resourceLoadedEnd":824.5,"resourceLoadedStart":217.5,"resourceTiming":[{"duration":323.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":217.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":217.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":541,"responseStart":0,"secureConnectionStart":0},{"duration":323.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":217.79999995231628,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":217.79999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":541.2999999523163,"responseStart":0,"secureConnectionStart":0},{"duration":337.39999997615814,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":218,"connectEnd":218,"connectStart":218,"domainLookupEnd":218,"domainLookupStart":218,"fetchStart":218,"redirectEnd":0,"redirectStart":0,"requestStart":218,"responseEnd":555.3999999761581,"responseStart":555.3999999761581,"secureConnectionStart":218},{"duration":423.7000000476837,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":218.09999990463257,"connectEnd":218.09999990463257,"connectStart":218.09999990463257,"domainLookupEnd":218.09999990463257,"domainLookupStart":218.09999990463257,"fetchStart":218.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":218.09999990463257,"responseEnd":641.7999999523163,"responseStart":641.7999999523163,"secureConnectionStart":218.09999990463257},{"duration":427.60000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":218.39999997615814,"connectEnd":218.39999997615814,"connectStart":218.39999997615814,"domainLookupEnd":218.39999997615814,"domainLookupStart":218.39999997615814,"fetchStart":218.39999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":218.39999997615814,"responseEnd":646,"responseStart":646,"secureConnectionStart":218.39999997615814},{"duration":428,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":218.59999990463257,"connectEnd":218.59999990463257,"connectStart":218.59999990463257,"domainLookupEnd":218.59999990463257,"domainLookupStart":218.59999990463257,"fetchStart":218.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":218.59999990463257,"responseEnd":646.5999999046326,"responseStart":646.5999999046326,"secureConnectionStart":218.59999990463257},{"duration":428.10000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":218.79999995231628,"connectEnd":218.79999995231628,"connectStart":218.79999995231628,"domainLookupEnd":218.79999995231628,"domainLookupStart":218.79999995231628,"fetchStart":218.79999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":218.79999995231628,"responseEnd":646.8999999761581,"responseStart":646.8999999761581,"secureConnectionStart":218.79999995231628},{"duration":490.39999997615814,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":219,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":219,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":709.3999999761581,"responseStart":0,"secureConnectionStart":0},{"duration":428.3000000715256,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":219.09999990463257,"connectEnd":219.09999990463257,"connectStart":219.09999990463257,"domainLookupEnd":219.09999990463257,"domainLookupStart":219.09999990463257,"fetchStart":219.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":219.09999990463257,"responseEnd":647.3999999761581,"responseStart":647.3999999761581,"secureConnectionStart":219.09999990463257},{"duration":490.39999997615814,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/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":219.29999995231628,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":219.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":709.6999999284744,"responseStart":0,"secureConnectionStart":0},{"duration":429.39999997615814,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/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":219.39999997615814,"connectEnd":219.39999997615814,"connectStart":219.39999997615814,"domainLookupEnd":219.39999997615814,"domainLookupStart":219.39999997615814,"fetchStart":219.39999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":219.39999997615814,"responseEnd":648.7999999523163,"responseStart":648.7999999523163,"secureConnectionStart":219.39999997615814},{"duration":516.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":220.19999992847443,"connectEnd":220.19999992847443,"connectStart":220.19999992847443,"domainLookupEnd":220.19999992847443,"domainLookupStart":220.19999992847443,"fetchStart":220.19999992847443,"redirectEnd":0,"redirectStart":0,"requestStart":220.19999992847443,"responseEnd":736.6999999284744,"responseStart":736.6999999284744,"secureConnectionStart":220.19999992847443},{"duration":604.2000000476837,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":220.29999995231628,"connectEnd":220.29999995231628,"connectStart":220.29999995231628,"domainLookupEnd":220.29999995231628,"domainLookupStart":220.29999995231628,"fetchStart":220.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":220.29999995231628,"responseEnd":824.5,"responseStart":824.5,"secureConnectionStart":220.29999995231628},{"duration":84.10000002384186,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":742.8999999761581,"connectEnd":742.8999999761581,"connectStart":742.8999999761581,"domainLookupEnd":742.8999999761581,"domainLookupStart":742.8999999761581,"fetchStart":742.8999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":742.8999999761581,"responseEnd":827,"responseStart":827,"secureConnectionStart":742.8999999761581}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":56,"responseStart":211,"responseEnd":215,"domLoading":215,"domInteractive":1184,"domContentLoadedEventStart":1184,"domContentLoadedEventEnd":1239,"domComplete":2223,"loadEventStart":2223,"loadEventEnd":2224,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1163.2999999523163},{"name":"bigPipe.sidebar-id.end","time":1164.0999999046326},{"name":"bigPipe.activity-panel-pipe-id.start","time":1164.1999999284744},{"name":"bigPipe.activity-panel-pipe-id.end","time":1166.8999999761581},{"name":"activityTabFullyLoaded","time":1247.7999999523163}],"measures":[],"correlationId":"6a293471ca778b","effectiveType":"4g","downlink":9.1,"rtt":0,"serverDuration":93,"dbReadsTimeInMs":11,"dbConnsTimeInMs":20,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}