When InnoDB is invoking posix_fallocate() to extend data files, it is missing a call to fsync() to update the file system metadata. If file system recovery is needed, the file size could be incorrect.
Furthermore, when the setting innodb_flush_method=O_DIRECT_NO_FSYNC that was introduced in MariaDB 10.0.11 (and MySQL 5.6) is enabled, InnoDB would stop calling fsync() after extending files.
This report is motivated by a MySQL 5.7.25 change Bug#27309336 Backport to 5.7 that restores the fsync() call. We will fix the bug differently; it does not seem to be a good idea to hold the already contentious fil_system->mutex while executing a system call.
Attachments
Issue Links
blocks
MDEV-18338Merge new release of InnoDB 5.7.25 to 10.2
Marko Mäkelä
added a comment - Related to this, there appears to have been a bad merge to MariaDB 10.0.31 and 10.1.24 that caused XtraDB to ignore errors from posix_fallocate() .
> We will fix the bug differently; it does not seem to be a good idea to hold the already contentious fil_system->mutex while executing a system call.
But os_file_flush() inside fil_flush() already called outside of a mutex.
Eugene Kosov (Inactive)
added a comment - > We will fix the bug differently; it does not seem to be a good idea to hold the already contentious fil_system->mutex while executing a system call.
But os_file_flush() inside fil_flush() already called outside of a mutex.
kevg, you are right, the system call in fil_flush() is not covered by a mutex. My mistake.
My solution is not optimal, because in a worst case, it can invoke fsync() twice in a succession: first from os_file_flush() after posix_fallocate() and then possibly from fil_flush(), because in the first call we are not updating the bookkeeping. As always, improvements are welcome.
Marko Mäkelä
added a comment - kevg , you are right, the system call in fil_flush() is not covered by a mutex. My mistake.
My solution is not optimal, because in a worst case, it can invoke fsync() twice in a succession: first from os_file_flush() after posix_fallocate() and then possibly from fil_flush() , because in the first call we are not updating the bookkeeping. As always, improvements are welcome.
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":833.3999999761581,"ttfb":202.19999998807907,"pageVisibility":"visible","entityId":72100,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"c0fa1005-a5ad-4562-be0b-cd557118b825","navigationType":0,"readyForUser":901.3999999761581,"redirectCount":0,"resourceLoadedEnd":1230.5999999642372,"resourceLoadedStart":208.19999998807907,"resourceTiming":[{"duration":130.30000001192093,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":208.19999998807907,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":208.19999998807907,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":338.5,"responseStart":0,"secureConnectionStart":0},{"duration":130.39999997615814,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/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":208.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":208.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":338.89999997615814,"responseStart":0,"secureConnectionStart":0},{"duration":169.30000001192093,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":208.69999998807907,"connectEnd":208.69999998807907,"connectStart":208.69999998807907,"domainLookupEnd":208.69999998807907,"domainLookupStart":208.69999998807907,"fetchStart":208.69999998807907,"redirectEnd":0,"redirectStart":0,"requestStart":208.69999998807907,"responseEnd":378,"responseStart":378,"secureConnectionStart":208.69999998807907},{"duration":243.19999998807907,"initiatorType":"script","name":"https://jira.mariadb.org/s/099b33461394b8015fc36c0a4b96e19f-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/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":208.80000001192093,"connectEnd":208.80000001192093,"connectStart":208.80000001192093,"domainLookupEnd":208.80000001192093,"domainLookupStart":208.80000001192093,"fetchStart":208.80000001192093,"redirectEnd":0,"redirectStart":0,"requestStart":208.80000001192093,"responseEnd":452,"responseStart":452,"secureConnectionStart":208.80000001192093},{"duration":246.60000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/s/94c15bff32baef80f4096a08aceae8bc-CDN/lu2bu7/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":209.0999999642372,"connectEnd":209.0999999642372,"connectStart":209.0999999642372,"domainLookupEnd":209.0999999642372,"domainLookupStart":209.0999999642372,"fetchStart":209.0999999642372,"redirectEnd":0,"redirectStart":0,"requestStart":209.0999999642372,"responseEnd":455.69999998807907,"responseStart":455.69999998807907,"secureConnectionStart":209.0999999642372},{"duration":247.19999998807907,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":209.19999998807907,"connectEnd":209.19999998807907,"connectStart":209.19999998807907,"domainLookupEnd":209.19999998807907,"domainLookupStart":209.19999998807907,"fetchStart":209.19999998807907,"redirectEnd":0,"redirectStart":0,"requestStart":209.19999998807907,"responseEnd":456.39999997615814,"responseStart":456.39999997615814,"secureConnectionStart":209.19999998807907},{"duration":247.30000001192093,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":209.39999997615814,"connectEnd":209.39999997615814,"connectStart":209.39999997615814,"domainLookupEnd":209.39999997615814,"domainLookupStart":209.39999997615814,"fetchStart":209.39999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":209.39999997615814,"responseEnd":456.69999998807907,"responseStart":456.69999998807907,"secureConnectionStart":209.39999997615814},{"duration":311.4000000357628,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bu7/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":209.5999999642372,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":209.5999999642372,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":521,"responseStart":0,"secureConnectionStart":0},{"duration":247.29999995231628,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":209.80000001192093,"connectEnd":209.80000001192093,"connectStart":209.80000001192093,"domainLookupEnd":209.80000001192093,"domainLookupStart":209.80000001192093,"fetchStart":209.80000001192093,"redirectEnd":0,"redirectStart":0,"requestStart":209.80000001192093,"responseEnd":457.0999999642372,"responseStart":457.0999999642372,"secureConnectionStart":209.80000001192093},{"duration":311.30000001192093,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bu7/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":209.89999997615814,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":209.89999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":521.1999999880791,"responseStart":0,"secureConnectionStart":0},{"duration":247.60000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/s/3339d87fa2538a859872f2df449bf8d0-CDN/lu2bu7/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":210.0999999642372,"connectEnd":210.0999999642372,"connectStart":210.0999999642372,"domainLookupEnd":210.0999999642372,"domainLookupStart":210.0999999642372,"fetchStart":210.0999999642372,"redirectEnd":0,"redirectStart":0,"requestStart":210.0999999642372,"responseEnd":457.69999998807907,"responseStart":457.69999998807907,"secureConnectionStart":210.0999999642372},{"duration":556.1999999880791,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":211,"connectEnd":211,"connectStart":211,"domainLookupEnd":211,"domainLookupStart":211,"fetchStart":211,"redirectEnd":0,"redirectStart":0,"requestStart":211,"responseEnd":767.1999999880791,"responseStart":767.1999999880791,"secureConnectionStart":211},{"duration":1011.1000000238419,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":211.0999999642372,"connectEnd":211.0999999642372,"connectStart":211.0999999642372,"domainLookupEnd":211.0999999642372,"domainLookupStart":211.0999999642372,"fetchStart":211.0999999642372,"redirectEnd":0,"redirectStart":0,"requestStart":211.0999999642372,"responseEnd":1222.199999988079,"responseStart":1222.199999988079,"secureConnectionStart":211.0999999642372},{"duration":234.80000001192093,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":532.6999999880791,"connectEnd":532.6999999880791,"connectStart":532.6999999880791,"domainLookupEnd":532.6999999880791,"domainLookupStart":532.6999999880791,"fetchStart":532.6999999880791,"redirectEnd":0,"redirectStart":0,"requestStart":532.6999999880791,"responseEnd":767.5,"responseStart":767.5,"secureConnectionStart":532.6999999880791},{"duration":435.19999998807907,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2bu7/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","startTime":787.6999999880791,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":787.6999999880791,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1222.8999999761581,"responseStart":0,"secureConnectionStart":0},{"duration":434.7999999523163,"initiatorType":"link","name":"https://jira.mariadb.org/s/50bc9be5bfead1a25e72c1a9338c94f6-CDN/lu2bu7/820016/12ta74/e108c7645258ccb43280ed3404e3e949/_/download/contextbatch/css/com.atlassian.jira.plugins.jira-development-integration-plugin:0,-_super,-jira.view.issue,-jira.global,-jira.general,-jira.browse.project,-project.issue.navigator,-atl.general/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":788.3000000119209,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":788.3000000119209,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1223.0999999642372,"responseStart":0,"secureConnectionStart":0},{"duration":434.30000001192093,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/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","startTime":789.1999999880791,"connectEnd":789.1999999880791,"connectStart":789.1999999880791,"domainLookupEnd":789.1999999880791,"domainLookupStart":789.1999999880791,"fetchStart":789.1999999880791,"redirectEnd":0,"redirectStart":0,"requestStart":789.1999999880791,"responseEnd":1223.5,"responseStart":1223.5,"secureConnectionStart":789.1999999880791},{"duration":439.89999997615814,"initiatorType":"script","name":"https://jira.mariadb.org/s/f51ef5507eea4c158f257c66c93b2a3f-CDN/lu2bu7/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","startTime":789.5,"connectEnd":789.5,"connectStart":789.5,"domainLookupEnd":789.5,"domainLookupStart":789.5,"fetchStart":789.5,"redirectEnd":0,"redirectStart":0,"requestStart":789.5,"responseEnd":1229.3999999761581,"responseStart":1229.3999999761581,"secureConnectionStart":789.5},{"duration":440.69999998807907,"initiatorType":"script","name":"https://jira.mariadb.org/s/86ee9bbc76cd1bcd8556fcdcf46241c9-CDN/lu2bu7/820016/12ta74/e108c7645258ccb43280ed3404e3e949/_/download/contextbatch/js/com.atlassian.jira.plugins.jira-development-integration-plugin:0,-_super,-jira.view.issue,-jira.global,-jira.general,-jira.browse.project,-project.issue.navigator,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":789.8999999761581,"connectEnd":789.8999999761581,"connectStart":789.8999999761581,"domainLookupEnd":789.8999999761581,"domainLookupStart":789.8999999761581,"fetchStart":789.8999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":789.8999999761581,"responseEnd":1230.5999999642372,"responseStart":1230.5999999642372,"secureConnectionStart":789.8999999761581},{"duration":414.30000001192093,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":827.6999999880791,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":827.6999999880791,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1242,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":43,"responseStart":202,"responseEnd":206,"domLoading":206,"domInteractive":1247,"domContentLoadedEventStart":1247,"domContentLoadedEventEnd":1285,"domComplete":1935,"loadEventStart":1935,"loadEventEnd":1936,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1227.3999999761581},{"name":"bigPipe.sidebar-id.end","time":1228.199999988079},{"name":"bigPipe.activity-panel-pipe-id.start","time":1228.3999999761581},{"name":"bigPipe.activity-panel-pipe-id.end","time":1229.5},{"name":"activityTabFullyLoaded","time":1301.300000011921}],"measures":[],"correlationId":"77bcf3c062dd74","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":102,"dbReadsTimeInMs":14,"dbConnsTimeInMs":23,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Related to this, there appears to have been a bad merge to MariaDB 10.0.31 and 10.1.24 that caused XtraDB to ignore errors from posix_fallocate().