Type:
Bug
Priority:
Major
Resolution:
Duplicate
Affects Version/s:
10.2(EOL) , 10.3(EOL) , 10.4(EOL) , 10.5 , 10.6
Output of a slightly extended MTR test for MDEV-26131
MTR output | mysql.err output
SET SESSION sql_mode = 'NO_ENGINE_SUBSTITUTION' ;
SET DEFAULT_STORAGE_ENGINE= 'InnoDB' ;
USE test ;
CREATE TABLE `t1` (
`col_varchar_255` varchar(255),
`col_int` int,
`col_text` text) ENGINE=innodb ;
FLUSH TABLES t1 FOR EXPORT ;
UNLOCK TABLES ;
CREATE TABLE imp_t1 LIKE t1 ;
ALTER TABLE imp_t1 ADD KEY idx ( col_text(13) ) ;
'copy ibd file around'
---- Before DISCARD TABLESPACE Thu Jul 22 09:19:01 PDT 2021
ALTER TABLE imp_t1 DISCARD TABLESPACE ;
---- Before IMPORT TABLESPACE Thu Jul 22 09:19:11 PDT 2021
ALTER TABLE imp_t1 IMPORT TABLESPACE ; 2021-07-22 9:19:11 4 [ERROR] InnoDB: Operating system error number 2 in a file operation.
2021-07-22 9:19:11 4 [ERROR] InnoDB: The error means the system cannot find the path specified.
ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB 2021-07-22 9:19:11 4 [ERROR] InnoDB: Trying to import a tablespace, but could not open the tablespace file ./test/imp_t1.ibd
'copy ibd file around'
---- Before IMPORT TABLESPACE Thu Jul 22 09:19:21 PDT 2021
ALTER TABLE imp_t1 IMPORT TABLESPACE ; 2021-07-22 9:19:21 4 [Note] InnoDB: Sync to disk
2021-07-22 9:19:21 4 [Note] InnoDB: Sync to disk - done!
2021-07-22 9:19:21 4 [Warning] InnoDB: Table `test`.`imp_t1` should have 2 indexes but the tablespace has 1 indexes
Q: Its obvious that the table `imp_t1` and the content of the ibd file do not fit together.
Why not just rollback any modification done for the IMPORT and emit an error message?
It is to be feared that there might be more inconsistencies and they can also lead to
server crashes (MDEV-26148, MDEV-26141) or crippled table content (MDEV-26155).
2021-07-22 9:19:21 4 [Note] InnoDB: Phase I - Update all pages
2021-07-22 9:19:21 4 [Note] InnoDB: Sync to disk
2021-07-22 9:19:21 4 [Note] InnoDB: Sync to disk - done!
2021-07-22 9:19:21 4 [Warning] InnoDB: Skip adjustment of root pages for index `idx`.
2021-07-22 9:19:21 4 [Note] InnoDB: Phase III - Flush changes to disk
2021-07-22 9:19:21 4 [Note] InnoDB: Phase IV - Flush complete
2021-07-22 9:19:21 4 [ERROR] InnoDB: Index `idx` of table `test`.`imp_t1` is corrupted
2021-07-22 9:19:21 4 [Note] InnoDB: Load corrupted index `idx` of table `test`.`imp_t1`
Q: Ok, we are keen to do whatever good we can.
But why the attempt to load an index which is already known to be corrupt?
2021-07-22 9:19:21 4 [ERROR] InnoDB: Trying to load index `idx` for table `test`.`imp_t1`, but the index tree has been freed!
Ok, some failure within the code.
2021-07-22 9:19:21 4 [Warning] InnoDB: Failed to load table `test`.`imp_t1`:Data structure corruption
ERROR HY000: Lost connection to server during query
DROP TABLE t1, imp_t1 ;
It is at least thinkable to
- store information about the table layout within the ibd file
- compare that information with the layout of the target table
and than detect really all inconsistencies.
Some rather simple system would than just deny the operation and avoid by that crashes, mangling of data like today.
And some extreme sophisticated system might be even capable to work around minor inconsistencies
like source column is INT and target column is BIGINT.
But as long as we do not have such features aborting the statement execution as soon as we are faced with the
first inconsistency is better.
relates to
MDEV-26131
SEGV in ha_innobase::discard_or_import_tablespace
Closed
{"report":{"fcp":1724.9000005722046,"ttfb":792.6000003814697,"pageVisibility":"visible","entityId":101463,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"ce2a6ab9-a4ea-49bf-9a08-642f95b88dea","navigationType":0,"readyForUser":1812.5,"redirectCount":0,"resourceLoadedEnd":2103.699999809265,"resourceLoadedStart":801.3000001907349,"resourceTiming":[{"duration":446.3999996185303,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":801.3000001907349,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":801.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1247.6999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":446.3999996185303,"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":801.6000003814697,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":801.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1248,"responseStart":0,"secureConnectionStart":0},{"duration":471.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/e9b27a47da5fb0f74a35acd57e9847fb-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":801.9000005722046,"connectEnd":801.9000005722046,"connectStart":801.9000005722046,"domainLookupEnd":801.9000005722046,"domainLookupStart":801.9000005722046,"fetchStart":801.9000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":801.9000005722046,"responseEnd":1273.4000005722046,"responseStart":1273.4000005722046,"secureConnectionStart":801.9000005722046},{"duration":553,"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":802.5,"connectEnd":802.5,"connectStart":802.5,"domainLookupEnd":802.5,"domainLookupStart":802.5,"fetchStart":802.5,"redirectEnd":0,"redirectStart":0,"requestStart":802.5,"responseEnd":1355.5,"responseStart":1355.5,"secureConnectionStart":802.5},{"duration":556.3000001907349,"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":802.6999998092651,"connectEnd":802.6999998092651,"connectStart":802.6999998092651,"domainLookupEnd":802.6999998092651,"domainLookupStart":802.6999998092651,"fetchStart":802.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":802.6999998092651,"responseEnd":1359,"responseStart":1359,"secureConnectionStart":802.6999998092651},{"duration":556.6999998092651,"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":802.9000005722046,"connectEnd":802.9000005722046,"connectStart":802.9000005722046,"domainLookupEnd":802.9000005722046,"domainLookupStart":802.9000005722046,"fetchStart":802.9000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":802.9000005722046,"responseEnd":1359.6000003814697,"responseStart":1359.6000003814697,"secureConnectionStart":802.9000005722046},{"duration":557,"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":803.1000003814697,"connectEnd":803.1000003814697,"connectStart":803.1000003814697,"domainLookupEnd":803.1000003814697,"domainLookupStart":803.1000003814697,"fetchStart":803.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":803.1000003814697,"responseEnd":1360.1000003814697,"responseStart":1360.1000003814697,"secureConnectionStart":803.1000003814697},{"duration":612.9000005722046,"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":803.1999998092651,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":803.1999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1416.1000003814697,"responseStart":0,"secureConnectionStart":0},{"duration":557.1999998092651,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":803.4000005722046,"connectEnd":803.4000005722046,"connectStart":803.4000005722046,"domainLookupEnd":803.4000005722046,"domainLookupStart":803.4000005722046,"fetchStart":803.4000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":803.4000005722046,"responseEnd":1360.6000003814697,"responseStart":1360.5,"secureConnectionStart":803.4000005722046},{"duration":612.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":803.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":803.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1416.1999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":557.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":803.6999998092651,"connectEnd":803.6999998092651,"connectStart":803.6999998092651,"domainLookupEnd":803.6999998092651,"domainLookupStart":803.6999998092651,"fetchStart":803.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":803.6999998092651,"responseEnd":1361.1000003814697,"responseStart":1361.1000003814697,"secureConnectionStart":803.6999998092651},{"duration":1293,"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":810.3000001907349,"connectEnd":810.3000001907349,"connectStart":810.3000001907349,"domainLookupEnd":810.3000001907349,"domainLookupStart":810.3000001907349,"fetchStart":810.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":810.3000001907349,"responseEnd":2103.300000190735,"responseStart":2103.300000190735,"secureConnectionStart":810.3000001907349},{"duration":1290.2999992370605,"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":813.4000005722046,"connectEnd":813.4000005722046,"connectStart":813.4000005722046,"domainLookupEnd":813.4000005722046,"domainLookupStart":813.4000005722046,"fetchStart":813.4000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":813.4000005722046,"responseEnd":2103.699999809265,"responseStart":2103.699999809265,"secureConnectionStart":813.4000005722046},{"duration":440.4000005722046,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1427.5,"connectEnd":1427.5,"connectStart":1427.5,"domainLookupEnd":1427.5,"domainLookupStart":1427.5,"fetchStart":1427.5,"redirectEnd":0,"redirectStart":0,"requestStart":1427.5,"responseEnd":1867.9000005722046,"responseStart":1867.9000005722046,"secureConnectionStart":1427.5}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":227,"responseStart":792,"responseEnd":813,"domLoading":795,"domInteractive":2124,"domContentLoadedEventStart":2124,"domContentLoadedEventEnd":2167,"domComplete":3383,"loadEventStart":3383,"loadEventEnd":3385,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":2109.199999809265},{"name":"bigPipe.sidebar-id.end","time":2110},{"name":"bigPipe.activity-panel-pipe-id.start","time":2110.199999809265},{"name":"bigPipe.activity-panel-pipe-id.end","time":2112.699999809265},{"name":"activityTabFullyLoaded","time":2177}],"measures":[],"correlationId":"1062f82bc2e5e5","effectiveType":"4g","downlink":9.2,"rtt":0,"serverDuration":494,"dbReadsTimeInMs":13,"dbConnsTimeInMs":22,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}