Type:
Bug
Priority:
Blocker
Resolution:
Fixed
Affects Version/s:
N/A
Environment:
GNU/Linux with mmap() based redo log on /dev/shm
When MDEV-27774 replaced log_sys.mutex with log_sys.latch , it introduced a race condition in mtr_t::do_write() :
if (!ex)
{
log_sys.latch.rd_unlock();
log_sys.latch.wr_lock(SRW_LOCK_CALL);
if (UNIV_LIKELY(!m_user_space->max_lsn))
name_write();
std::pair<lsn_t,mtr_t::page_flush_ahead> p{finish_write(len, true )};
log_sys.latch.wr_unlock();
log_sys.latch.rd_lock(SRW_LOCK_CALL);
return p;
}
It is not safe to release the exclusive log_sys.latch between finish_write() and ReleaseBlocks . Because we have no portable operation that would downgrade the latch from exclusive to shared, we must retain that exclusive latch until the end of the critical section in mtr_t::commit() .
I debugged an rr replay trace of this:
ssh pluto
rr replay /data/results/1647008467/TBR-1420/dev/shm/rqg/1647008467/53/1/rr/latest-trace
continue
watch -l log_sys.last_checkpoint_lsn.m._M_i
watch -l buf_pool.flush_list.count
reverse-continue
reverse-continue
reverse-continue
thread apply 24 backtrace
From the end of the start, we have Thread 3 hitting an assertion failure:
mysqld: /data/Server/bb-10.9-MDEV-26603-async-redo-writeB/storage/innobase/buf/buf0flu.cc:1877: bool log_checkpoint_low(lsn_t, lsn_t): Assertion `oldest_lsn > log_sys.last_checkpoint_lsn' failed.
Before that, we had Thread 24 inserting the unexpectedly old block to buf_pool.flush_list , and before that, Thread 3 updating the checkpoint LSN to the too new value.
is caused by
MDEV-27774
Reduce scalability bottlenecks in mtr_t::commit()
Closed
{"report":{"fcp":1095.2999999523163,"ttfb":183.5,"pageVisibility":"visible","entityId":108754,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"a76e6907-f764-47c1-981c-6149732b846e","navigationType":0,"readyForUser":1172.2999999523163,"redirectCount":0,"resourceLoadedEnd":1365.0999999046326,"resourceLoadedStart":191.79999995231628,"resourceTiming":[{"duration":379.59999990463257,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":191.79999995231628,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":191.79999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":571.3999998569489,"responseStart":0,"secureConnectionStart":0},{"duration":379.5,"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":192.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":192.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":571.5999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":391,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":192.09999990463257,"connectEnd":192.09999990463257,"connectStart":192.09999990463257,"domainLookupEnd":192.09999990463257,"domainLookupStart":192.09999990463257,"fetchStart":192.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":192.09999990463257,"responseEnd":583.0999999046326,"responseStart":583.0999999046326,"secureConnectionStart":192.09999990463257},{"duration":425.30000019073486,"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":192.19999980926514,"connectEnd":192.19999980926514,"connectStart":192.19999980926514,"domainLookupEnd":192.19999980926514,"domainLookupStart":192.19999980926514,"fetchStart":192.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":192.19999980926514,"responseEnd":617.5,"responseStart":617.5,"secureConnectionStart":192.19999980926514},{"duration":421.40000009536743,"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":192.19999980926514,"connectEnd":192.19999980926514,"connectStart":192.19999980926514,"domainLookupEnd":192.19999980926514,"domainLookupStart":192.19999980926514,"fetchStart":192.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":192.19999980926514,"responseEnd":613.5999999046326,"responseStart":613.5999999046326,"secureConnectionStart":192.19999980926514},{"duration":425.59999990463257,"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":192.29999995231628,"connectEnd":192.29999995231628,"connectStart":192.29999995231628,"domainLookupEnd":192.29999995231628,"domainLookupStart":192.29999995231628,"fetchStart":192.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":192.29999995231628,"responseEnd":617.8999998569489,"responseStart":617.8999998569489,"secureConnectionStart":192.29999995231628},{"duration":425.7999999523163,"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":192.5,"connectEnd":192.5,"connectStart":192.5,"domainLookupEnd":192.5,"domainLookupStart":192.5,"fetchStart":192.5,"redirectEnd":0,"redirectStart":0,"requestStart":192.5,"responseEnd":618.2999999523163,"responseStart":618.2999999523163,"secureConnectionStart":192.5},{"duration":426.2000000476837,"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":192.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":192.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":618.7999999523163,"responseStart":0,"secureConnectionStart":0},{"duration":426.10000014305115,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":192.69999980926514,"connectEnd":192.69999980926514,"connectStart":192.69999980926514,"domainLookupEnd":192.69999980926514,"domainLookupStart":192.69999980926514,"fetchStart":192.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":192.69999980926514,"responseEnd":618.7999999523163,"responseStart":618.7999999523163,"secureConnectionStart":192.69999980926514},{"duration":426.2999999523163,"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":192.79999995231628,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":192.79999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":619.0999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":426.5,"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":192.89999985694885,"connectEnd":192.89999985694885,"connectStart":192.89999985694885,"domainLookupEnd":192.89999985694885,"domainLookupStart":192.89999985694885,"fetchStart":192.89999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":192.89999985694885,"responseEnd":619.3999998569489,"responseStart":619.3999998569489,"secureConnectionStart":192.89999985694885},{"duration":623.5999999046326,"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":193.5,"connectEnd":193.5,"connectStart":193.5,"domainLookupEnd":193.5,"domainLookupStart":193.5,"fetchStart":193.5,"redirectEnd":0,"redirectStart":0,"requestStart":193.5,"responseEnd":817.0999999046326,"responseStart":817.0999999046326,"secureConnectionStart":193.5},{"duration":1171.5,"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":193.59999990463257,"connectEnd":193.59999990463257,"connectStart":193.59999990463257,"domainLookupEnd":193.59999990463257,"domainLookupStart":193.59999990463257,"fetchStart":193.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":193.59999990463257,"responseEnd":1365.0999999046326,"responseStart":1365.0999999046326,"secureConnectionStart":193.59999990463257},{"duration":539.6000001430511,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":824.3999998569489,"connectEnd":824.3999998569489,"connectStart":824.3999998569489,"domainLookupEnd":824.3999998569489,"domainLookupStart":824.3999998569489,"fetchStart":824.3999998569489,"redirectEnd":0,"redirectStart":0,"requestStart":824.3999998569489,"responseEnd":1364,"responseStart":1364,"secureConnectionStart":824.3999998569489}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":47,"responseStart":183,"responseEnd":187,"domLoading":190,"domInteractive":1388,"domContentLoadedEventStart":1388,"domContentLoadedEventEnd":1423,"domComplete":2465,"loadEventStart":2465,"loadEventEnd":2466,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1371.8999998569489},{"name":"bigPipe.sidebar-id.end","time":1372.7999999523163},{"name":"bigPipe.activity-panel-pipe-id.start","time":1373.0999999046326},{"name":"bigPipe.activity-panel-pipe-id.end","time":1375.5999999046326},{"name":"activityTabFullyLoaded","time":1430.3999998569489}],"measures":[],"correlationId":"cc14389be89e9e","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":76,"dbReadsTimeInMs":9,"dbConnsTimeInMs":16,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}