For a table with a variable-length encoded CHAR column in the PRIMARY KEY, the table cannot be loaded to the InnoDB data dictionary cache after instant DROP or reordering of columns (MDEV-15562):
--source include/have_innodb.inc
|
create table t(a char(5) character set utf8 primary key) engine=innodb;
|
alter table t add b int first;
|
--let $shutdown_timeout=0;
|
--source include/restart_mysqld.inc
|
check table t;
|
drop table t;
|
This will result in the following errors:
10.5 a9846f329935faba560387bab8fd897102e17385
|
check table t;
|
Table Op Msg_type Msg_text
|
test.t check Error Table 'test.t' doesn't exist in engine
|
test.t check status Operation failed
|
drop table t;
|
Warnings:
|
Warning 1932 Table 'test.t' doesn't exist in engine
|
innodb.ia 'innodb' [ fail ] Found warnings/errors in server log file!
|
Test ended at 2019-11-19 21:00:04
|
line
|
2019-11-19 21:00:04 0 [ERROR] InnoDB: Table `test`.`t` contains unrecognizable instant ALTER metadata
|
2019-11-19 21:00:04 3 [ERROR] InnoDB: Table `test`.`t` contains unrecognizable instant ALTER metadata
|
2019-11-19 21:00:04 3 [ERROR] InnoDB: Table `test`.`t` contains unrecognizable instant ALTER metadata
|
2019-11-19 21:00:04 3 [ERROR] InnoDB: Table `test`.`t` does not exist in the InnoDB internal data dictionary though MariaDB is trying to drop it. Have you copied the .frm file of the table to the MariaDB database directory from another database? Please refer to https://mariadb.com/kb/en/innodb-troubleshooting/ for how to resolve the issue.
|
The cause is that for the metadata record, we are unnecessarily writing a nonempty dummy value for the PRIMARY KEY column, even though it uses variable-length encoding. This breaks the following assumption in btr_cur_instant_init_low():
if (!trx_id_offset) {
|
/* The PRIMARY KEY contains variable-length columns.
|
For the metadata record, variable-length columns are
|
always written with zero length. The DB_TRX_ID will
|
start right after any fixed-length columns. */
|
for (uint i = index->n_uniq; i--; ) {
|
trx_id_offset += index->fields[i].fixed_len;
|
}
|
}
|
The CHAR(5) column uses a variable-length encoding in ROW_FORMAT≠REDUNDANT, occupying 5*mbminlen‥5*mbmaxlen bytes (in this case, repeat(' ',5)).
We should both stop allocating the unnecessary bytes, and adjust the above code so that the suboptimal metadata records can be parsed.
{"report":{"fcp":1826.3000001907349,"ttfb":581.5,"pageVisibility":"visible","entityId":80561,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"6226d41c-ca9d-4f75-b0f0-8ef3ae2e3fd7","navigationType":0,"readyForUser":1911.5999994277954,"redirectCount":0,"resourceLoadedEnd":2063.199999809265,"resourceLoadedStart":586.8999996185303,"resourceTiming":[{"duration":724.9000005722046,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":586.8999996185303,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":586.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1311.8000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":726.2000007629395,"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":587.0999994277954,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":587.0999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1313.3000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":787.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":587.3000001907349,"connectEnd":587.3000001907349,"connectStart":587.3000001907349,"domainLookupEnd":587.3000001907349,"domainLookupStart":587.3000001907349,"fetchStart":587.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":587.3000001907349,"responseEnd":1374.8000001907349,"responseStart":1374.8000001907349,"secureConnectionStart":587.3000001907349},{"duration":833.5,"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":587.3999996185303,"connectEnd":587.3999996185303,"connectStart":587.3999996185303,"domainLookupEnd":587.3999996185303,"domainLookupStart":587.3999996185303,"fetchStart":587.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":587.3999996185303,"responseEnd":1420.8999996185303,"responseStart":1420.8999996185303,"secureConnectionStart":587.3999996185303},{"duration":837.1000003814697,"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":587.6999998092651,"connectEnd":587.6999998092651,"connectStart":587.6999998092651,"domainLookupEnd":587.6999998092651,"domainLookupStart":587.6999998092651,"fetchStart":587.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":587.6999998092651,"responseEnd":1424.8000001907349,"responseStart":1424.8000001907349,"secureConnectionStart":587.6999998092651},{"duration":837.3000001907349,"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":587.8999996185303,"connectEnd":587.8999996185303,"connectStart":587.8999996185303,"domainLookupEnd":587.8999996185303,"domainLookupStart":587.8999996185303,"fetchStart":587.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":587.8999996185303,"responseEnd":1425.1999998092651,"responseStart":1425.1999998092651,"secureConnectionStart":587.8999996185303},{"duration":837.5,"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":588.0999994277954,"connectEnd":588.0999994277954,"connectStart":588.0999994277954,"domainLookupEnd":588.0999994277954,"domainLookupStart":588.0999994277954,"fetchStart":588.0999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":588.0999994277954,"responseEnd":1425.5999994277954,"responseStart":1425.5999994277954,"secureConnectionStart":588.0999994277954},{"duration":927.8999996185303,"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":588.3000001907349,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":588.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1516.1999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":837.5,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":588.3999996185303,"connectEnd":588.3999996185303,"connectStart":588.3999996185303,"domainLookupEnd":588.3999996185303,"domainLookupStart":588.3999996185303,"fetchStart":588.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":588.3999996185303,"responseEnd":1425.8999996185303,"responseStart":1425.8999996185303,"secureConnectionStart":588.3999996185303},{"duration":927.7000007629395,"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":588.5999994277954,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":588.5999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1516.3000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":837.8999996185303,"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":588.6999998092651,"connectEnd":588.6999998092651,"connectStart":588.6999998092651,"domainLookupEnd":588.6999998092651,"domainLookupStart":588.6999998092651,"fetchStart":588.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":588.6999998092651,"responseEnd":1426.5999994277954,"responseStart":1426.5999994277954,"secureConnectionStart":588.6999998092651},{"duration":1300,"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":594.1999998092651,"connectEnd":594.1999998092651,"connectStart":594.1999998092651,"domainLookupEnd":594.1999998092651,"domainLookupStart":594.1999998092651,"fetchStart":594.1999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":594.1999998092651,"responseEnd":1894.1999998092651,"responseStart":1894.1999998092651,"secureConnectionStart":594.1999998092651},{"duration":1468.8999996185303,"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":594.3000001907349,"connectEnd":594.3000001907349,"connectStart":594.3000001907349,"domainLookupEnd":594.3000001907349,"domainLookupStart":594.3000001907349,"fetchStart":594.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":594.3000001907349,"responseEnd":2063.199999809265,"responseStart":2063.199999809265,"secureConnectionStart":594.3000001907349},{"duration":373.6000003814697,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1527.6999998092651,"connectEnd":1527.6999998092651,"connectStart":1527.6999998092651,"domainLookupEnd":1527.6999998092651,"domainLookupStart":1527.6999998092651,"fetchStart":1527.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":1527.6999998092651,"responseEnd":1901.3000001907349,"responseStart":1901.3000001907349,"secureConnectionStart":1527.6999998092651},{"duration":307.69999980926514,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1820.3000001907349,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1820.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":2128,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":406,"responseStart":582,"responseEnd":587,"domLoading":585,"domInteractive":2084,"domContentLoadedEventStart":2084,"domContentLoadedEventEnd":2125,"domComplete":2753,"loadEventStart":2753,"loadEventEnd":2755,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":2065},{"name":"bigPipe.sidebar-id.end","time":2065.8999996185303},{"name":"bigPipe.activity-panel-pipe-id.start","time":2066.0999994277954},{"name":"bigPipe.activity-panel-pipe-id.end","time":2068.3999996185303},{"name":"activityTabFullyLoaded","time":2131.699999809265}],"measures":[],"correlationId":"c777045fd39850","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":108,"dbReadsTimeInMs":17,"dbConnsTimeInMs":28,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}