CHECK TABLE fails to validate the info_bits of records. Specifically, if you run it on a table that was corrupted due to MDEV-19916, it would fail to notice that the leaf level of the clustered index starts with a record where the 'minimum record mark' of info_bits is set. This can be repeated by running a debug build of MariaDB 10.3.16 and earlier, and then upgrading to a newer non-debug build in the middle of the test:
--source include/have_innodb.inc
--source include/have_debug.inc
--echo #
--echo # MDEV-19916 Corruption after instant ADD/DROP and shrinking the tree
--echo #
CREATETABLE t1 (a INTPRIMARYKEY) ENGINE=InnoDB;
# Create an index tree with 2 levels of node pointer pages.
SET @old_limit = @@innodb_limit_optimistic_insert_debug;
I believe that we should validate the info_bits of each record in the loop of btr_validate_level(). Only the very first record of a level may carry the ‘minimum record’ flag (0x10). That flag must be set on the first record if and only if !page_is_leaf() or index->is_instant().
The delete-mark flag (0x20) is garbage on non-leaf page records. On leaf-page records on 10.3, it must not be in the metadata record (for which the ‘minimum record’ flag is set).
No other info_bits than the two above mentioned 0x30 may ever be set on any record.
For ROW_FORMAT≠REDUNDANT, we should also validate the status_bits.
Marko Mäkelä
added a comment - I believe that we should validate the info_bits of each record in the loop of btr_validate_level() . Only the very first record of a level may carry the ‘minimum record’ flag ( 0x10 ). That flag must be set on the first record if and only if !page_is_leaf() or index->is_instant() .
The delete-mark flag ( 0x20 ) is garbage on non-leaf page records. On leaf-page records on 10.3, it must not be in the metadata record (for which the ‘minimum record’ flag is set).
No other info_bits than the two above mentioned 0x30 may ever be set on any record.
For ROW_FORMAT≠REDUNDANT , we should also validate the status_bits .
Related to this, tables that are in the MDEV-11369 format (instant ADD COLUMN) are supposed to be converted to the canonical format (no hidden metadata record) when the table is empied. However, the MDEV-22867 fix will change this: an emptied table will remain in the non-canonical format if a DROP COLUMN…, DROP INDEX operation is running at the same time. So, at least starting with 10.5, CHECK TABLE should tolerate an empty table that contains a MDEV-11369 hidden metadata record.
Marko Mäkelä
added a comment - Related to this, tables that are in the MDEV-11369 format (instant ADD COLUMN ) are supposed to be converted to the canonical format (no hidden metadata record) when the table is empied. However, the MDEV-22867 fix will change this: an emptied table will remain in the non-canonical format if a DROP COLUMN…, DROP INDEX operation is running at the same time. So, at least starting with 10.5, CHECK TABLE should tolerate an empty table that contains a MDEV-11369 hidden metadata record.
People
Eugene Kosov (Inactive)
Marko Mäkelä
Votes:
0Vote for this issue
Watchers:
6Start 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":1086.7000002861023,"ttfb":175.80000019073486,"pageVisibility":"visible","entityId":81013,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"23fa6c28-65fe-45fe-9a4c-375a687957dc","navigationType":0,"readyForUser":1167.7000002861023,"redirectCount":0,"resourceLoadedEnd":1205.6000003814697,"resourceLoadedStart":181.5,"resourceTiming":[{"duration":137.10000038146973,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":181.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":181.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":318.6000003814697,"responseStart":0,"secureConnectionStart":0},{"duration":137,"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":181.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":181.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":318.90000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":380.40000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":182,"connectEnd":182,"connectStart":182,"domainLookupEnd":182,"domainLookupStart":182,"fetchStart":182,"redirectEnd":0,"redirectStart":0,"requestStart":182,"responseEnd":562.4000000953674,"responseStart":562.4000000953674,"secureConnectionStart":182},{"duration":452.7999997138977,"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":182.2000002861023,"connectEnd":182.2000002861023,"connectStart":182.2000002861023,"domainLookupEnd":182.2000002861023,"domainLookupStart":182.2000002861023,"fetchStart":182.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":182.2000002861023,"responseEnd":635,"responseStart":635,"secureConnectionStart":182.2000002861023},{"duration":456.59999990463257,"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":182.40000009536743,"connectEnd":182.40000009536743,"connectStart":182.40000009536743,"domainLookupEnd":182.40000009536743,"domainLookupStart":182.40000009536743,"fetchStart":182.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":182.40000009536743,"responseEnd":639,"responseStart":639,"secureConnectionStart":182.40000009536743},{"duration":457.5,"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":182.5,"connectEnd":182.5,"connectStart":182.5,"domainLookupEnd":182.5,"domainLookupStart":182.5,"fetchStart":182.5,"redirectEnd":0,"redirectStart":0,"requestStart":182.5,"responseEnd":640,"responseStart":640,"secureConnectionStart":182.5},{"duration":458.19999980926514,"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":182.7000002861023,"connectEnd":182.7000002861023,"connectStart":182.7000002861023,"domainLookupEnd":182.7000002861023,"domainLookupStart":182.7000002861023,"fetchStart":182.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":182.7000002861023,"responseEnd":640.9000000953674,"responseStart":640.9000000953674,"secureConnectionStart":182.7000002861023},{"duration":526.0999999046326,"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":182.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":182.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":709,"responseStart":0,"secureConnectionStart":0},{"duration":458.80000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":183,"connectEnd":183,"connectStart":183,"domainLookupEnd":183,"domainLookupStart":183,"fetchStart":183,"redirectEnd":0,"redirectStart":0,"requestStart":183,"responseEnd":641.8000001907349,"responseStart":641.8000001907349,"secureConnectionStart":183},{"duration":526,"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":183.2000002861023,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":183.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":709.2000002861023,"responseStart":0,"secureConnectionStart":0},{"duration":459.1000003814697,"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":183.5,"connectEnd":183.5,"connectStart":183.5,"domainLookupEnd":183.5,"domainLookupStart":183.5,"fetchStart":183.5,"redirectEnd":0,"redirectStart":0,"requestStart":183.5,"responseEnd":642.6000003814697,"responseStart":642.6000003814697,"secureConnectionStart":183.5},{"duration":680.4000000953674,"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":189.2000002861023,"connectEnd":189.2000002861023,"connectStart":189.2000002861023,"domainLookupEnd":189.2000002861023,"domainLookupStart":189.2000002861023,"fetchStart":189.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":189.2000002861023,"responseEnd":869.6000003814697,"responseStart":869.6000003814697,"secureConnectionStart":189.2000002861023},{"duration":928.4000000953674,"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":190.2000002861023,"connectEnd":190.2000002861023,"connectStart":190.2000002861023,"domainLookupEnd":190.2000002861023,"domainLookupStart":190.2000002861023,"fetchStart":190.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":190.2000002861023,"responseEnd":1118.6000003814697,"responseStart":1118.6000003814697,"secureConnectionStart":190.2000002861023},{"duration":145.7999997138977,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":721.1000003814697,"connectEnd":721.1000003814697,"connectStart":721.1000003814697,"domainLookupEnd":721.1000003814697,"domainLookupStart":721.1000003814697,"fetchStart":721.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":721.1000003814697,"responseEnd":866.9000000953674,"responseStart":866.9000000953674,"secureConnectionStart":721.1000003814697},{"duration":205.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&slack-enabled=true&whisper-enabled=true","startTime":1000.3000001907349,"connectEnd":1000.3000001907349,"connectStart":1000.3000001907349,"domainLookupEnd":1000.3000001907349,"domainLookupStart":1000.3000001907349,"fetchStart":1000.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":1000.3000001907349,"responseEnd":1205.6000003814697,"responseStart":1205.6000003814697,"secureConnectionStart":1000.3000001907349}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":13,"responseStart":176,"responseEnd":190,"domLoading":180,"domInteractive":1227,"domContentLoadedEventStart":1227,"domContentLoadedEventEnd":1269,"domComplete":1762,"loadEventStart":1762,"loadEventEnd":1762,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1213.7000002861023},{"name":"bigPipe.sidebar-id.end","time":1214.6000003814697},{"name":"bigPipe.activity-panel-pipe-id.start","time":1214.7000002861023},{"name":"bigPipe.activity-panel-pipe-id.end","time":1216.2000002861023},{"name":"activityTabFullyLoaded","time":1288.9000000953674}],"measures":[],"correlationId":"b2283a82dc5c74","effectiveType":"4g","downlink":9.4,"rtt":0,"serverDuration":97,"dbReadsTimeInMs":13,"dbConnsTimeInMs":21,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
I believe that we should validate the info_bits of each record in the loop of btr_validate_level(). Only the very first record of a level may carry the ‘minimum record’ flag (0x10). That flag must be set on the first record if and only if !page_is_leaf() or index->is_instant().
The delete-mark flag (0x20) is garbage on non-leaf page records. On leaf-page records on 10.3, it must not be in the metadata record (for which the ‘minimum record’ flag is set).
No other info_bits than the two above mentioned 0x30 may ever be set on any record.
For ROW_FORMAT≠REDUNDANT, we should also validate the status_bits.