InnoDB implements various levels of "fast shutdown", from the slowest when all logs are applied to data, to the crash-like, which causes a full recovery run on the next start.
The default is 1, "fast". But this works best if the server of exactly the same version is used for the next start.
On upgrades the slow shutdown is the safest. Redo log format used to change between versions in the past and it has happened that after the upgrade the server was not able to start (or, worse, corrupted the data).
In fact, it's generally safer to use a slow shutdown when the server is uninstalled. RPM/DEB before-uninstall (preun, prerm) scriptlet should always use the slowest and safest shutdown method.
Implementation ideas:
set global @@innodb_fast_shutdown=0
SHUTDOWN SLOW
SIGTERM for normal shutdown, SIGQUIT for slow (and SIGKILL for fast )
Attachments
Issue Links
is duplicated by
MDEV-33364pre-uninstall scriptlets should use slow innodb shutdown for upgrades
Closed
relates to
MDEV-23755safety for upgrades (innodb) and packaging
Our documentation is unclear here. We used to state innodb_fast_shutdown=0 as a requirement when upgrading, but this was removed on marko's suggestion (MDEV-23755). monty has added the suggestion that fast_shutdown=0 is 'recommended' back in the docs in one location, but overall the docs don't now give a clear guideline to users. Basically, we currently state 1 is OK, but recommended is 0, which I wouldn't know what to do with.
Ian Gilfillan
added a comment - Our documentation is unclear here. We used to state innodb_fast_shutdown=0 as a requirement when upgrading, but this was removed on marko 's suggestion ( MDEV-23755 ). monty has added the suggestion that fast_shutdown=0 is 'recommended' back in the docs in one location, but overall the docs don't now give a clear guideline to users. Basically, we currently state 1 is OK, but recommended is 0, which I wouldn't know what to do with.
For some time, it was somewhat unclear whether it is safe to upgrade to MariaDB Server 10.3 from earlier versions after a normal shutdown. It was possible to get into trouble by playing with innodb_force_recovery=3 (MDEV-13269). Finally, in MDEV-15912 a check for that was implemented: InnoDB would refuse to start if it recovers any incomplete transactions that contain nonempty insert undo logs.
Recently, there were some upgrade issues related to MDEV-29694, which could be worked around by executing a slow shutdown. These bugs have been fixed.
I do not think that we should generally recommend innodb_fast_shutdown=0. In the past, a support customer got data corruption due to MDEV-29905 (in combination with MDEV-29984 or MDEV-30009).
Marko Mäkelä
added a comment - For some time, it was somewhat unclear whether it is safe to upgrade to MariaDB Server 10.3 from earlier versions after a normal shutdown. It was possible to get into trouble by playing with innodb_force_recovery=3 ( MDEV-13269 ). Finally, in MDEV-15912 a check for that was implemented: InnoDB would refuse to start if it recovers any incomplete transactions that contain nonempty insert undo logs.
Recently, there were some upgrade issues related to MDEV-29694 , which could be worked around by executing a slow shutdown. These bugs have been fixed.
I do not think that we should generally recommend innodb_fast_shutdown=0 . In the past, a support customer got data corruption due to MDEV-29905 (in combination with MDEV-29984 or MDEV-30009 ).
You would not want to shrink the ib_logfile0 to its minimum size if there are any further writes to do, because it would cause excessive amount of page flushing.
Marko Mäkelä
added a comment - If the motivation is to save space in the data directory, then it could make sense to execute the following before shutting down InnoDB:
SET GLOBAL innodb_undo_log_truncate= ON , innodb_max_purge_lag_wait=0, innodb_log_file_size=4194304;
You would not want to shrink the ib_logfile0 to its minimum size if there are any further writes to do, because it would cause excessive amount of page flushing.
People
Unassigned
Sergei Golubchik
Votes:
0Vote for this issue
Watchers:
4Start watching this issue
Dates
Created:
Updated:
Git Integration
Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.
{"report":{"fcp":830.5,"ttfb":228.10000014305115,"pageVisibility":"visible","entityId":119769,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"2e1d7d74-45ca-4090-b2eb-b62ebe1e3fc7","navigationType":0,"readyForUser":930,"redirectCount":0,"resourceLoadedEnd":567.2000000476837,"resourceLoadedStart":237.5,"resourceTiming":[{"duration":7.900000095367432,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":237.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":237.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":245.40000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":7.799999952316284,"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":237.80000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":237.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":245.60000014305115,"responseStart":0,"secureConnectionStart":0},{"duration":199.59999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":237.90000009536743,"connectEnd":237.90000009536743,"connectStart":237.90000009536743,"domainLookupEnd":237.90000009536743,"domainLookupStart":237.90000009536743,"fetchStart":237.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":248.80000019073486,"responseEnd":437.5,"responseStart":276,"secureConnectionStart":237.90000009536743},{"duration":328.59999990463257,"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":238.60000014305115,"connectEnd":238.60000014305115,"connectStart":238.60000014305115,"domainLookupEnd":238.60000014305115,"domainLookupStart":238.60000014305115,"fetchStart":238.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":249,"responseEnd":567.2000000476837,"responseStart":288.60000014305115,"secureConnectionStart":238.60000014305115},{"duration":45,"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":238.70000004768372,"connectEnd":238.70000004768372,"connectStart":238.70000004768372,"domainLookupEnd":238.70000004768372,"domainLookupStart":238.70000004768372,"fetchStart":238.70000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":249.20000004768372,"responseEnd":283.7000000476837,"responseStart":278.90000009536743,"secureConnectionStart":238.70000004768372},{"duration":46,"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":238.80000019073486,"connectEnd":238.80000019073486,"connectStart":238.80000019073486,"domainLookupEnd":238.80000019073486,"domainLookupStart":238.80000019073486,"fetchStart":238.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":249.60000014305115,"responseEnd":284.80000019073486,"responseStart":279.90000009536743,"secureConnectionStart":238.80000019073486},{"duration":46.299999952316284,"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":238.90000009536743,"connectEnd":238.90000009536743,"connectStart":238.90000009536743,"domainLookupEnd":238.90000009536743,"domainLookupStart":238.90000009536743,"fetchStart":238.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":250.80000019073486,"responseEnd":285.2000000476837,"responseStart":280.7000000476837,"secureConnectionStart":238.90000009536743},{"duration":10.900000095367432,"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":239,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":239,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":249.90000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":46.299999952316284,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":239.10000014305115,"connectEnd":239.10000014305115,"connectStart":239.10000014305115,"domainLookupEnd":239.10000014305115,"domainLookupStart":239.10000014305115,"fetchStart":239.10000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":253,"responseEnd":285.40000009536743,"responseStart":281.7000000476837,"secureConnectionStart":239.10000014305115},{"duration":12.199999809265137,"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":239.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":239.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":251.5,"responseStart":0,"secureConnectionStart":0},{"duration":48.89999985694885,"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":239.30000019073486,"connectEnd":239.30000019073486,"connectStart":239.30000019073486,"domainLookupEnd":239.30000019073486,"domainLookupStart":239.30000019073486,"fetchStart":239.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":257.60000014305115,"responseEnd":288.2000000476837,"responseStart":283.90000009536743,"secureConnectionStart":239.30000019073486},{"duration":295.80000019073486,"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":241,"connectEnd":241,"connectStart":241,"domainLookupEnd":241,"domainLookupStart":241,"fetchStart":241,"redirectEnd":0,"redirectStart":0,"requestStart":278.7000000476837,"responseEnd":536.8000001907349,"responseStart":530.4000000953674,"secureConnectionStart":241},{"duration":294.2000000476837,"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":243.20000004768372,"connectEnd":243.20000004768372,"connectStart":243.20000004768372,"domainLookupEnd":243.20000004768372,"domainLookupStart":243.20000004768372,"fetchStart":243.20000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":283.40000009536743,"responseEnd":537.4000000953674,"responseStart":531.7000000476837,"secureConnectionStart":243.20000004768372},{"duration":91.90000009536743,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":583.5,"connectEnd":583.5,"connectStart":583.5,"domainLookupEnd":583.5,"domainLookupStart":583.5,"fetchStart":583.5,"redirectEnd":0,"redirectStart":0,"requestStart":641.8000001907349,"responseEnd":675.4000000953674,"responseStart":674.1000001430511,"secureConnectionStart":583.5},{"duration":166.20000004768372,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":785.6000001430511,"connectEnd":785.6000001430511,"connectStart":785.6000001430511,"domainLookupEnd":785.6000001430511,"domainLookupStart":785.6000001430511,"fetchStart":785.6000001430511,"redirectEnd":0,"redirectStart":0,"requestStart":918.3000001907349,"responseEnd":951.8000001907349,"responseStart":951.2000000476837,"secureConnectionStart":785.6000001430511},{"duration":97.10000014305115,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":821.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":821.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":918.6000001430511,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":65,"responseStart":228,"responseEnd":243,"domLoading":232,"domInteractive":990,"domContentLoadedEventStart":990,"domContentLoadedEventEnd":1037,"domComplete":1429,"loadEventStart":1429,"loadEventEnd":1430,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":965.2000000476837},{"name":"bigPipe.sidebar-id.end","time":966.1000001430511},{"name":"bigPipe.activity-panel-pipe-id.start","time":966.3000001907349},{"name":"bigPipe.activity-panel-pipe-id.end","time":967.9000000953674},{"name":"activityTabFullyLoaded","time":1055.6000001430511}],"measures":[],"correlationId":"f5ce1fd37dd14d","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":105,"dbReadsTimeInMs":36,"dbConnsTimeInMs":46,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Contradicting advice:
MDEV-23755