Type:
Bug
Priority:
Major
Resolution:
Fixed
Affects Version/s:
10.2(EOL) , (14) 10.3(EOL) , 10.4(EOL) , 10.5 , 10.6 , 10.7(EOL) , 10.8(EOL) , 10.9(EOL) , 10.10(EOL) , 10.11 , 11.0(EOL) , 11.1(EOL) , 11.2(EOL) , 11.3(EOL) , 11.4
The implementation of innodb_undo_log_truncate=ON in trx_purge_truncate_history() is interfering with log checkpoint and page write performance.
Before MDEV-13564 , we used the MySQL 5.7 implementation, which would force a full flush of the entire buffer pool and a sharp log checkpoint. In MDEV-13564 we changed it so that only the pages of the being-truncated undo tablespace would be removed from the buffer pool, but no log checkpoint would be needed.
There is a less intrusive, lazy approach: We can actually let the 'garbage' undo log pages remain in the buffer pool, just like we do on DROP TABLE or DROP INDEX or when freeing pages in any operation: Simply, if the newest modification to a page (FIL_PAGE_LSN ) is older than the LSN of the latest tablespace rebuild, we will discard the page, just like in MDEV-15528 we do for pages whose underlying file page has been freed. With this approach, there is no need for trx_purge_truncate_history() to traverse the buffer pool.
For the similar case of shrinking the InnoDB system tablespace (MDEV-14795 ), there would not be a complete tablespace rebuild (like there is with innodb_undo_log_truncate=ON ), so we must only discard pages that are beyond the end of the current tablespace size; their FIL_PAGE_LSN must be older than the latest LSN of shrinking the FSP_SIZE . I think that we can do that by relaxing the logic around invoking fil_invalid_page_access_msg() in fil_space_t::io() .
{"report":{"fcp":1340.5,"ttfb":507.09999990463257,"pageVisibility":"visible","entityId":127057,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"e07de905-981f-4c61-94f9-68911e211671","navigationType":0,"readyForUser":1441.6999998092651,"redirectCount":0,"resourceLoadedEnd":1614.6999998092651,"resourceLoadedStart":512.2999997138977,"resourceTiming":[{"duration":244.09999990463257,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":512.2999997138977,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":512.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":756.3999996185303,"responseStart":0,"secureConnectionStart":0},{"duration":244.09999990463257,"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":512.6999998092651,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":512.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":756.7999997138977,"responseStart":0,"secureConnectionStart":0},{"duration":247.2000002861023,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":512.8999996185303,"connectEnd":512.8999996185303,"connectStart":512.8999996185303,"domainLookupEnd":512.8999996185303,"domainLookupStart":512.8999996185303,"fetchStart":512.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":512.8999996185303,"responseEnd":760.0999999046326,"responseStart":760.0999999046326,"secureConnectionStart":512.8999996185303},{"duration":344.59999990463257,"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":513.0999999046326,"connectEnd":513.0999999046326,"connectStart":513.0999999046326,"domainLookupEnd":513.0999999046326,"domainLookupStart":513.0999999046326,"fetchStart":513.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":513.0999999046326,"responseEnd":857.6999998092651,"responseStart":857.6999998092651,"secureConnectionStart":513.0999999046326},{"duration":349.80000019073486,"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":513.2999997138977,"connectEnd":513.2999997138977,"connectStart":513.2999997138977,"domainLookupEnd":513.2999997138977,"domainLookupStart":513.2999997138977,"fetchStart":513.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":513.2999997138977,"responseEnd":863.0999999046326,"responseStart":863.0999999046326,"secureConnectionStart":513.2999997138977},{"duration":350.2999997138977,"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":513.5,"connectEnd":513.5,"connectStart":513.5,"domainLookupEnd":513.5,"domainLookupStart":513.5,"fetchStart":513.5,"redirectEnd":0,"redirectStart":0,"requestStart":513.5,"responseEnd":863.7999997138977,"responseStart":863.7999997138977,"secureConnectionStart":513.5},{"duration":350.69999980926514,"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":513.6999998092651,"connectEnd":513.6999998092651,"connectStart":513.6999998092651,"domainLookupEnd":513.6999998092651,"domainLookupStart":513.6999998092651,"fetchStart":513.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":513.6999998092651,"responseEnd":864.3999996185303,"responseStart":864.3999996185303,"secureConnectionStart":513.6999998092651},{"duration":401.09999990463257,"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":513.7999997138977,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":513.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":914.8999996185303,"responseStart":0,"secureConnectionStart":0},{"duration":350.7999997138977,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":514.0999999046326,"connectEnd":514.0999999046326,"connectStart":514.0999999046326,"domainLookupEnd":514.0999999046326,"domainLookupStart":514.0999999046326,"fetchStart":514.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":514.0999999046326,"responseEnd":864.8999996185303,"responseStart":864.8999996185303,"secureConnectionStart":514.0999999046326},{"duration":396.19999980926514,"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":519.0999999046326,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":519.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":915.2999997138977,"responseStart":0,"secureConnectionStart":0},{"duration":346.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":519.3999996185303,"connectEnd":519.3999996185303,"connectStart":519.3999996185303,"domainLookupEnd":519.3999996185303,"domainLookupStart":519.3999996185303,"fetchStart":519.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":519.3999996185303,"responseEnd":865.5,"responseStart":865.3999996185303,"secureConnectionStart":519.3999996185303},{"duration":525.3000001907349,"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":520.7999997138977,"connectEnd":520.7999997138977,"connectStart":520.7999997138977,"domainLookupEnd":520.7999997138977,"domainLookupStart":520.7999997138977,"fetchStart":520.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":520.7999997138977,"responseEnd":1046.0999999046326,"responseStart":1046,"secureConnectionStart":520.7999997138977},{"duration":1072.5999999046326,"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":521,"connectEnd":521,"connectStart":521,"domainLookupEnd":521,"domainLookupStart":521,"fetchStart":521,"redirectEnd":0,"redirectStart":0,"requestStart":521,"responseEnd":1593.5999999046326,"responseStart":1593.5999999046326,"secureConnectionStart":521},{"duration":157.2999997138977,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":974.5,"connectEnd":974.5,"connectStart":974.5,"domainLookupEnd":974.5,"domainLookupStart":974.5,"fetchStart":974.5,"redirectEnd":0,"redirectStart":0,"requestStart":974.5,"responseEnd":1131.7999997138977,"responseStart":1131.7999997138977,"secureConnectionStart":974.5},{"duration":331.7999997138977,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/css/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":1262.5999999046326,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1262.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1594.3999996185303,"responseStart":0,"secureConnectionStart":0},{"duration":351.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-project.issue.navigator,-jira.view.issue,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":1263.5,"connectEnd":1263.5,"connectStart":1263.5,"domainLookupEnd":1263.5,"domainLookupStart":1263.5,"fetchStart":1263.5,"redirectEnd":0,"redirectStart":0,"requestStart":1263.5,"responseEnd":1614.6999998092651,"responseStart":1614.6999998092651,"secureConnectionStart":1263.5},{"duration":383.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/097ae97cb8fbec7d6ea4bbb1f26955b9-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/js/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":1263.8999996185303,"connectEnd":1263.8999996185303,"connectStart":1263.8999996185303,"domainLookupEnd":1263.8999996185303,"domainLookupStart":1263.8999996185303,"fetchStart":1263.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":1263.8999996185303,"responseEnd":1647.3999996185303,"responseStart":1647.3999996185303,"secureConnectionStart":1263.8999996185303}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":339,"responseStart":507,"responseEnd":521,"domLoading":511,"domInteractive":1625,"domContentLoadedEventStart":1625,"domContentLoadedEventEnd":1672,"domComplete":2172,"loadEventStart":2172,"loadEventEnd":2173,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1595.5},{"name":"bigPipe.sidebar-id.end","time":1596.3999996185303},{"name":"bigPipe.activity-panel-pipe-id.start","time":1596.5999999046326},{"name":"bigPipe.activity-panel-pipe-id.end","time":1597.8999996185303},{"name":"activityTabFullyLoaded","time":1697.6999998092651}],"measures":[],"correlationId":"ab4a1610855eda","effectiveType":"4g","downlink":9.1,"rtt":0,"serverDuration":114,"dbReadsTimeInMs":18,"dbConnsTimeInMs":28,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
I realized that if we do not acquire exclusive latches on all affected pages before the function fil_truncate_prepare() is invoked, then we would reintroduce the corruption bug
MDEV-32757. This is because buf_flush_page_cleaner() would start skipping any writes to the undo tablespace and could advance the log checkpoint before the undo tablespace truncation has finished.In
MDEV-25491(MariaDB Server 10.6) the function fil_truncate_prepare() was removed, which simplifies things. I think that we should target 10.6 and not 10.5.