My attempt at introducing a log_sys.last_checkpoint_last_lsn field did not work. It could incorrectly cause log_checkpoint() to be skipped, if all log had been durably written during a previous flushing batch, but some pages had not been flushed. We should also memorize the previous end_lsn for that to work. This was revealed by the test innodb.innodb_bug34300.
A simpler fix is to just check if the previous checkpoint only wrote a FILE_CHECKPOINT record, and skip the checkpoint in that case only. And skip it even if the record spanned two 512-byte log blocks. This fix was already implemented in MDEV-14425 for 10.8 and later.
Marko Mäkelä
added a comment - My attempt at introducing a log_sys.last_checkpoint_last_lsn field did not work. It could incorrectly cause log_checkpoint() to be skipped, if all log had been durably written during a previous flushing batch, but some pages had not been flushed. We should also memorize the previous end_lsn for that to work. This was revealed by the test innodb.innodb_bug34300 .
A simpler fix is to just check if the previous checkpoint only wrote a FILE_CHECKPOINT record, and skip the checkpoint in that case only. And skip it even if the record spanned two 512-byte log blocks. This fix was already implemented in MDEV-14425 for 10.8 and later.
In the core dump, we had age=28, and the oldest_lsn field (which was equal to the latest checkpoint LSN) was 0x3a2d811. That is, (oldest_lsn&511)==0x11, which is only 3 bytes after the start of the log block payload area (0x0c). In other words, without the fix, we would have written a redundant FILE_CHECKPOINT record.
Redundant FILE_CHECKPOINT records will still be written if during the previous checkpoint, any FILE_MODIFY} records were written.
Marko Mäkelä
added a comment - I verified the fix with the following patch applied on top of it:
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
index 00d96935461..c63f850cc36 100644
--- a/storage/innobase/buf/buf0flu.cc
+++ b/storage/innobase/buf/buf0flu.cc
@@ -1790,6 +1790,7 @@ static bool log_checkpoint_low(lsn_t oldest_lsn, lsn_t end_lsn)
Perform an extra checkpoint at shutdown. */;
else
{
+ ut_ad(!age || age == SIZE_OF_FILE_CHECKPOINT);
/* Do nothing, because nothing was logged (other than a
FILE_CHECKPOINT record) since the previous checkpoint. */
mysql_mutex_unlock(&log_sys.mutex);
This added assertion would eventually fail during the following execution:
./mtr --mysqld=--skip-innodb-file-per-table --parallel=auto --repeat=1000 innodb.innodb_bug30423{,,,,,,,,,,,,,,,,,,}
In the core dump, we had age=28 , and the oldest_lsn field (which was equal to the latest checkpoint LSN) was 0x3a2d811 . That is, (oldest_lsn&511)==0x11 , which is only 3 bytes after the start of the log block payload area ( 0x0c ). In other words, without the fix, we would have written a redundant FILE_CHECKPOINT record.
Redundant FILE_CHECKPOINT records will still be written if during the previous checkpoint, any FILE_MODIFY } records were written.
People
Marko Mäkelä
Marko Mäkelä
Votes:
0Vote for this issue
Watchers:
1Start 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":1166,"ttfb":254.09999990463257,"pageVisibility":"visible","entityId":109257,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"851f1827-9522-4608-8420-fad302a01dfa","navigationType":0,"readyForUser":1269.4000000953674,"redirectCount":0,"resourceLoadedEnd":1048.8000001907349,"resourceLoadedStart":273.30000019073486,"resourceTiming":[{"duration":82.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":273.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":273.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":355.80000019073486,"responseStart":0,"secureConnectionStart":0},{"duration":82.5,"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":273.7000002861023,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":273.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":356.2000002861023,"responseStart":0,"secureConnectionStart":0},{"duration":245.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":273.90000009536743,"connectEnd":273.90000009536743,"connectStart":273.90000009536743,"domainLookupEnd":273.90000009536743,"domainLookupStart":273.90000009536743,"fetchStart":273.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":372.80000019073486,"responseEnd":519.2000002861023,"responseStart":386.5,"secureConnectionStart":273.90000009536743},{"duration":538.3000001907349,"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":274.59999990463257,"connectEnd":274.59999990463257,"connectStart":274.59999990463257,"domainLookupEnd":274.59999990463257,"domainLookupStart":274.59999990463257,"fetchStart":274.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":375.40000009536743,"responseEnd":812.9000000953674,"responseStart":393,"secureConnectionStart":274.59999990463257},{"duration":123.40000009536743,"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":274.90000009536743,"connectEnd":274.90000009536743,"connectStart":274.90000009536743,"domainLookupEnd":274.90000009536743,"domainLookupStart":274.90000009536743,"fetchStart":274.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":376.5,"responseEnd":398.30000019073486,"responseStart":394.59999990463257,"secureConnectionStart":274.90000009536743},{"duration":131.09999990463257,"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":275,"connectEnd":275,"connectStart":275,"domainLookupEnd":275,"domainLookupStart":275,"fetchStart":275,"redirectEnd":0,"redirectStart":0,"requestStart":379,"responseEnd":406.09999990463257,"responseStart":399.7000002861023,"secureConnectionStart":275},{"duration":131.5,"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":275.2000002861023,"connectEnd":275.2000002861023,"connectStart":275.2000002861023,"domainLookupEnd":275.2000002861023,"domainLookupStart":275.2000002861023,"fetchStart":275.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":379.2000002861023,"responseEnd":406.7000002861023,"responseStart":402.40000009536743,"secureConnectionStart":275.2000002861023},{"duration":97.19999980926514,"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":275.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":275.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":372.5,"responseStart":0,"secureConnectionStart":0},{"duration":130.7000002861023,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":275.59999990463257,"connectEnd":275.59999990463257,"connectStart":275.59999990463257,"domainLookupEnd":275.59999990463257,"domainLookupStart":275.59999990463257,"fetchStart":275.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":379.40000009536743,"responseEnd":406.30000019073486,"responseStart":400.80000019073486,"secureConnectionStart":275.59999990463257},{"duration":97.7999997138977,"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":275.7000002861023,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":275.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":373.5,"responseStart":0,"secureConnectionStart":0},{"duration":130.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":275.90000009536743,"connectEnd":275.90000009536743,"connectStart":275.90000009536743,"domainLookupEnd":275.90000009536743,"domainLookupStart":275.90000009536743,"fetchStart":275.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":379.5,"responseEnd":406.80000019073486,"responseStart":403.7000002861023,"secureConnectionStart":275.90000009536743},{"duration":594.1999998092651,"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":281.90000009536743,"connectEnd":281.90000009536743,"connectStart":281.90000009536743,"domainLookupEnd":281.90000009536743,"domainLookupStart":281.90000009536743,"fetchStart":281.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":632.3000001907349,"responseEnd":876.0999999046326,"responseStart":866.7000002861023,"secureConnectionStart":281.90000009536743},{"duration":766.9000000953674,"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":281.90000009536743,"connectEnd":281.90000009536743,"connectStart":281.90000009536743,"domainLookupEnd":281.90000009536743,"domainLookupStart":281.90000009536743,"fetchStart":281.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":1036.5999999046326,"responseEnd":1048.8000001907349,"responseStart":1047.9000000953674,"secureConnectionStart":281.90000009536743},{"duration":382.69999980926514,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":688.9000000953674,"connectEnd":688.9000000953674,"connectStart":688.9000000953674,"domainLookupEnd":688.9000000953674,"domainLookupStart":688.9000000953674,"fetchStart":688.9000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":1037.8000001907349,"responseEnd":1071.5999999046326,"responseStart":1070.8000001907349,"secureConnectionStart":688.9000000953674}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":44,"responseStart":254,"responseEnd":280,"domLoading":264,"domInteractive":1435,"domContentLoadedEventStart":1435,"domContentLoadedEventEnd":1504,"domComplete":2337,"loadEventStart":2337,"loadEventEnd":2337,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1374.9000000953674},{"name":"bigPipe.sidebar-id.end","time":1376.0999999046326},{"name":"bigPipe.activity-panel-pipe-id.start","time":1376.3000001907349},{"name":"bigPipe.activity-panel-pipe-id.end","time":1378},{"name":"activityTabFullyLoaded","time":1519.4000000953674}],"measures":[],"correlationId":"121f2d1aa3f3eb","effectiveType":"4g","downlink":9.3,"rtt":0,"serverDuration":99,"dbReadsTimeInMs":14,"dbConnsTimeInMs":23,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
My attempt at introducing a log_sys.last_checkpoint_last_lsn field did not work. It could incorrectly cause log_checkpoint() to be skipped, if all log had been durably written during a previous flushing batch, but some pages had not been flushed. We should also memorize the previous end_lsn for that to work. This was revealed by the test innodb.innodb_bug34300.
A simpler fix is to just check if the previous checkpoint only wrote a FILE_CHECKPOINT record, and skip the checkpoint in that case only. And skip it even if the record spanned two 512-byte log blocks. This fix was already implemented in
MDEV-14425for 10.8 and later.