MariaDB 10.2.2 imported MySQL 5.7.9, which introduced separate log files, for server startup to determine if any tables or undo tablespace need "truncate fixup".
There is no logic in Mariabackup to deal with this.
A cleaner solution would be to remove the separate log files and to make the InnoDB redo log self-contained with respect to the truncate operations. This would likely require writing a new redo log record type MLOG_FILE_CREATE that would cause the file to be initialized from the scratch, followed by some page-level redo log records that would initialize the page contents.
This would also remove the need for a redo log checkpoint during the truncate operations.
MDEV-13563 proposes a Mariabackup option that could be used to prevent TRUNCATE TABLE from occurring during backups. It would not prevent undo tablespace truncation from happening.
{"report":{"fcp":893.1000000238419,"ttfb":348.1999999284744,"pageVisibility":"visible","entityId":62739,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"3162a330-431d-4d41-9e1b-2f0da7b8d1b5","navigationType":0,"readyForUser":985.6999999284744,"redirectCount":0,"resourceLoadedEnd":452.60000002384186,"resourceLoadedStart":355.2999999523163,"resourceTiming":[{"duration":4.200000047683716,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":355.2999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":355.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":359.5,"responseStart":0,"secureConnectionStart":0},{"duration":4.199999928474426,"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":355.60000002384186,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":355.60000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":359.7999999523163,"responseStart":0,"secureConnectionStart":0},{"duration":88.39999997615814,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":355.7999999523163,"connectEnd":355.7999999523163,"connectStart":355.7999999523163,"domainLookupEnd":355.7999999523163,"domainLookupStart":355.7999999523163,"fetchStart":355.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":363.89999997615814,"responseEnd":444.1999999284744,"responseStart":400.89999997615814,"secureConnectionStart":355.7999999523163},{"duration":96.60000002384186,"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":356,"connectEnd":356,"connectStart":356,"domainLookupEnd":356,"domainLookupStart":356,"fetchStart":356,"redirectEnd":0,"redirectStart":0,"requestStart":364.10000002384186,"responseEnd":452.60000002384186,"responseStart":397.6999999284744,"secureConnectionStart":356},{"duration":40.09999990463257,"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":356.10000002384186,"connectEnd":356.10000002384186,"connectStart":356.10000002384186,"domainLookupEnd":356.10000002384186,"domainLookupStart":356.10000002384186,"fetchStart":356.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":364.60000002384186,"responseEnd":396.1999999284744,"responseStart":395.39999997615814,"secureConnectionStart":356.10000002384186},{"duration":52.60000002384186,"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":356.39999997615814,"connectEnd":356.39999997615814,"connectStart":356.39999997615814,"domainLookupEnd":356.39999997615814,"domainLookupStart":356.39999997615814,"fetchStart":356.39999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":366.60000002384186,"responseEnd":409,"responseStart":408.39999997615814,"secureConnectionStart":356.39999997615814},{"duration":53.199999928474426,"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":356.5,"connectEnd":356.5,"connectStart":356.5,"domainLookupEnd":356.5,"domainLookupStart":356.5,"fetchStart":356.5,"redirectEnd":0,"redirectStart":0,"requestStart":367.39999997615814,"responseEnd":409.6999999284744,"responseStart":409.1999999284744,"secureConnectionStart":356.5},{"duration":9.299999952316284,"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":356.60000002384186,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":356.60000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":365.89999997615814,"responseStart":0,"secureConnectionStart":0},{"duration":86,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":356.89999997615814,"connectEnd":356.89999997615814,"connectStart":356.89999997615814,"domainLookupEnd":356.89999997615814,"domainLookupStart":356.89999997615814,"fetchStart":356.89999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":368.60000002384186,"responseEnd":442.89999997615814,"responseStart":442.2999999523163,"secureConnectionStart":356.89999997615814},{"duration":11,"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":357,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":357,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":368,"responseStart":0,"secureConnectionStart":0},{"duration":62.90000009536743,"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":357.1999999284744,"connectEnd":357.1999999284744,"connectStart":357.1999999284744,"domainLookupEnd":357.1999999284744,"domainLookupStart":357.1999999284744,"fetchStart":357.1999999284744,"redirectEnd":0,"redirectStart":0,"requestStart":371.10000002384186,"responseEnd":420.10000002384186,"responseStart":419.1999999284744,"secureConnectionStart":357.1999999284744},{"duration":18.600000023841858,"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":378.2999999523163,"connectEnd":381.39999997615814,"connectStart":381.39999997615814,"domainLookupEnd":381.39999997615814,"domainLookupStart":381.39999997615814,"fetchStart":378.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":381.60000002384186,"responseEnd":396.89999997615814,"responseStart":393.7999999523163,"secureConnectionStart":381.39999997615814},{"duration":22.600000023841858,"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":392.1999999284744,"connectEnd":392.1999999284744,"connectStart":392.1999999284744,"domainLookupEnd":392.1999999284744,"domainLookupStart":392.1999999284744,"fetchStart":392.1999999284744,"redirectEnd":0,"redirectStart":0,"requestStart":398.5,"responseEnd":414.7999999523163,"responseStart":412.60000002384186,"secureConnectionStart":392.1999999284744},{"duration":178.80000007152557,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":650.7999999523163,"connectEnd":650.7999999523163,"connectStart":650.7999999523163,"domainLookupEnd":650.7999999523163,"domainLookupStart":650.7999999523163,"fetchStart":650.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":792.7999999523163,"responseEnd":829.6000000238419,"responseStart":828.7999999523163,"secureConnectionStart":650.7999999523163},{"duration":176.20000004768372,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":866.8999999761581,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":866.8999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1043.1000000238419,"responseStart":0,"secureConnectionStart":0},{"duration":59.39999997615814,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":883.7999999523163,"connectEnd":883.7999999523163,"connectStart":883.7999999523163,"domainLookupEnd":883.7999999523163,"domainLookupStart":883.7999999523163,"fetchStart":883.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":911.1999999284744,"responseEnd":943.1999999284744,"responseStart":942.5,"secureConnectionStart":883.7999999523163},{"duration":91.89999997615814,"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":1045.5,"connectEnd":1045.5,"connectStart":1045.5,"domainLookupEnd":1045.5,"domainLookupStart":1045.5,"fetchStart":1045.5,"redirectEnd":0,"redirectStart":0,"requestStart":1123.5,"responseEnd":1137.3999999761581,"responseStart":1136.6000000238419,"secureConnectionStart":1045.5}],"fetchStart":0,"domainLookupStart":19,"domainLookupEnd":48,"connectStart":48,"connectEnd":71,"secureConnectionStart":58,"requestStart":71,"responseStart":348,"responseEnd":392,"domLoading":351,"domInteractive":1107,"domContentLoadedEventStart":1107,"domContentLoadedEventEnd":1173,"domComplete":1479,"loadEventStart":1479,"loadEventEnd":1479,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1050.5},{"name":"bigPipe.sidebar-id.end","time":1051.2999999523163},{"name":"bigPipe.activity-panel-pipe-id.start","time":1051.3999999761581},{"name":"bigPipe.activity-panel-pipe-id.end","time":1058.1999999284744},{"name":"activityTabFullyLoaded","time":1208.3999999761581}],"measures":[],"correlationId":"d6760fcaa259b","effectiveType":"4g","downlink":9.1,"rtt":0,"serverDuration":189,"dbReadsTimeInMs":51,"dbConnsTimeInMs":64,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
monty mentioned that a customer would like to have non-locking TRUNCATE TABLE: Old transactions that are reading from the table would continue to see the table contents. The TRUNCATE action would basically rename the old table to an internal #sql name so that
MDEV-14585can take care of crash recovery and create an empty table. The table would be dropped when the last reader closes the old table handle.This could be refined further by implementing a multi-versioned data dictionary cache (which is work mostly outside InnoDB). In that case, old transactions would continue to see the table contents as it was before the TRUNCATE, even when the first access to the table is after the TRUNCATE was executed. (Write transactions would always refer to the newest table definition.)