The InnoDB insert buffer was upgraded in MySQL 5.5 into a change buffer that also covers delete-mark and delete (purge) operations.
There is an important constraint for delete operations: a B-tree leaf page must not become empty unless the entire tree becomes empty, consisting of an empty root page. Because change buffer merges only occur on a single leaf page at a time (until MDEV-11634 might improve the situation), delete operations must not be buffered if it is possible that the last record of the page could be deleted. (In that case, we would refuse to use the change buffer, and if we really delete the last record, we would shrink the index tree.)
The function ibuf_get_volume_buffered_hash() is part of our insurance that the page would not become empty. It is supposed to map each buffered INSERT or DELETE_MARK record payload into a hash value. We will only count each such record as a distinct key if there is no hash collision. DELETE operations will always decrement the predicted number fo records in the page.
Due to a bug in the function, we would actually compute the hash value not only on the record payload, but also on some following bytes, in case the record contains NULL values. In MySQL Bug #61104, we have some examples of this dating back to 2012:
mysql-5.5.24
120709 22:26:32 [Note] /usr/sbin/mysqld: ready for connections.
0: len 32; hex 3237333838313830383038303830383038303830383038303830383046344232; asc 2738818080808080808080808080F4B2;;
1: SQL NULL;
2: len 8; hex 80000000f90ea91f; asc ;;
Note: the SQL NULL in the output is part of the DELETE operation that was not supposed to be buffered. It proves that the secondary index in question allows NULL values, and hence it is possible that there were preceding buffered INSERT or DELETE_MARK records for the page that might have contained NULL values for some of the secondary key columns.
With a corrected and simplified hash function (also, using CRC-32C in the hash value calculation instead of the slower and worse ut_fold_binary()), the problem is no longer repeatable:
/** Determine if a change buffer record has been encountered already.
@param rec change buffer record in the MySQL 5.5 format
@param hash hash table of encountered records
@param size number of elements in hash
@retval true if a distinct record
@retval false if this may be duplicating an earlier record */
Sorry, the fixVersion was wrong, and I corrected it now. I remember that the fix was finished near the time when the bunch of releases in May 2020 were being prepared. We also decided to omit the fix from the very last 5.5 release.
Marko Mäkelä
added a comment - Sorry, the fixVersion was wrong, and I corrected it now. I remember that the fix was finished near the time when the bunch of releases in May 2020 were being prepared. We also decided to omit the fix from the very last 5.5 release.
We are seeing this bug happening again on 10.4.18.
We obviously cannot know whether this corruption was present before on those hosts or not (we upgraded them from 10.1 to 10.4.X and lately to 10.4.18). I am seeing the errors after upgrading to 10.4.18 and then restarting the daemon.
Manuel Arostegui
added a comment - We are seeing this bug happening again on 10.4.18.
We obviously cannot know whether this corruption was present before on those hosts or not (we upgraded them from 10.1 to 10.4.X and lately to 10.4.18). I am seeing the errors after upgrading to 10.4.18 and then restarting the daemon.
People
Marko Mäkelä
Marko Mäkelä
Votes:
0Vote for this issue
Watchers:
2Start 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":1080.2999997138977,"ttfb":385.09999990463257,"pageVisibility":"visible","entityId":86609,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"58c3f127-a5c5-4e58-a8b9-44d2e2d51520","navigationType":0,"readyForUser":1169.5999999046326,"redirectCount":0,"resourceLoadedEnd":742.0999999046326,"resourceLoadedStart":395.19999980926514,"resourceTiming":[{"duration":31.300000190734863,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":395.19999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":395.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":426.5,"responseStart":0,"secureConnectionStart":0},{"duration":31.40000009536743,"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":395.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":395.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":427,"responseStart":0,"secureConnectionStart":0},{"duration":206.40000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":395.7999997138977,"connectEnd":395.7999997138977,"connectStart":395.7999997138977,"domainLookupEnd":395.7999997138977,"domainLookupStart":395.7999997138977,"fetchStart":395.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":429.5,"responseEnd":602.1999998092651,"responseStart":449.5,"secureConnectionStart":395.7999997138977},{"duration":345.7000002861023,"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":396.3999996185303,"connectEnd":396.3999996185303,"connectStart":396.3999996185303,"domainLookupEnd":396.3999996185303,"domainLookupStart":396.3999996185303,"fetchStart":396.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":431.09999990463257,"responseEnd":742.0999999046326,"responseStart":453.2999997138977,"secureConnectionStart":396.3999996185303},{"duration":60,"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":396.59999990463257,"connectEnd":396.59999990463257,"connectStart":396.59999990463257,"domainLookupEnd":396.59999990463257,"domainLookupStart":396.59999990463257,"fetchStart":396.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":432.7999997138977,"responseEnd":456.59999990463257,"responseStart":454.3999996185303,"secureConnectionStart":396.59999990463257},{"duration":56.30000019073486,"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":396.69999980926514,"connectEnd":396.69999980926514,"connectStart":396.69999980926514,"domainLookupEnd":396.69999980926514,"domainLookupStart":396.69999980926514,"fetchStart":396.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":432.59999990463257,"responseEnd":453,"responseStart":450.09999990463257,"secureConnectionStart":396.69999980926514},{"duration":61.40000009536743,"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":396.8999996185303,"connectEnd":396.8999996185303,"connectStart":396.8999996185303,"domainLookupEnd":396.8999996185303,"domainLookupStart":396.8999996185303,"fetchStart":396.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":433.8999996185303,"responseEnd":458.2999997138977,"responseStart":457.19999980926514,"secureConnectionStart":396.8999996185303},{"duration":35.5,"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":397.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":397.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":432.59999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":65.7000002861023,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":397.2999997138977,"connectEnd":397.2999997138977,"connectStart":397.2999997138977,"domainLookupEnd":397.2999997138977,"domainLookupStart":397.2999997138977,"fetchStart":397.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":435.7999997138977,"responseEnd":463,"responseStart":460.69999980926514,"secureConnectionStart":397.2999997138977},{"duration":36.5,"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":397.3999996185303,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":397.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":433.8999996185303,"responseStart":0,"secureConnectionStart":0},{"duration":66.2999997138977,"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":397.59999990463257,"connectEnd":397.59999990463257,"connectStart":397.59999990463257,"domainLookupEnd":397.59999990463257,"domainLookupStart":397.59999990463257,"fetchStart":397.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":436.19999980926514,"responseEnd":463.8999996185303,"responseStart":461.19999980926514,"secureConnectionStart":397.59999990463257},{"duration":312.40000009536743,"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":426.3999996185303,"connectEnd":426.3999996185303,"connectStart":426.3999996185303,"domainLookupEnd":426.3999996185303,"domainLookupStart":426.3999996185303,"fetchStart":426.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":503.09999990463257,"responseEnd":738.7999997138977,"responseStart":733.6999998092651,"secureConnectionStart":426.3999996185303},{"duration":310.80000019073486,"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":428.3999996185303,"connectEnd":428.3999996185303,"connectStart":428.3999996185303,"domainLookupEnd":428.3999996185303,"domainLookupStart":428.3999996185303,"fetchStart":428.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":512.2999997138977,"responseEnd":739.1999998092651,"responseStart":734.2999997138977,"secureConnectionStart":428.3999996185303},{"duration":95.5,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":759.0999999046326,"connectEnd":759.0999999046326,"connectStart":759.0999999046326,"domainLookupEnd":759.0999999046326,"domainLookupStart":759.0999999046326,"fetchStart":759.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":817.5999999046326,"responseEnd":854.5999999046326,"responseStart":854.0999999046326,"secureConnectionStart":759.0999999046326}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":175,"responseStart":385,"responseEnd":428,"domLoading":389,"domInteractive":1232,"domContentLoadedEventStart":1232,"domContentLoadedEventEnd":1280,"domComplete":1804,"loadEventStart":1804,"loadEventEnd":1804,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1210.2999997138977},{"name":"bigPipe.sidebar-id.end","time":1211.0999999046326},{"name":"bigPipe.activity-panel-pipe-id.start","time":1211.2999997138977},{"name":"bigPipe.activity-panel-pipe-id.end","time":1212.5999999046326},{"name":"activityTabFullyLoaded","time":1299.1999998092651}],"measures":[],"correlationId":"187e97438c0469","effectiveType":"4g","downlink":9.3,"rtt":0,"serverDuration":124,"dbReadsTimeInMs":13,"dbConnsTimeInMs":23,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
This keeps happening with 10.4.13, see: https://jira.mariadb.org/browse/MDEV-22373