MDEV-25113 removed the acquisition of buf_pool.flush_list_mutex from buf_page_write_complete(). But, acquiring buf_pool.mutex should not really be necessary except in eviction flushing (request.is_LRU()) or when the block->lock is not available (no uncompressed copy of a ROW_FORMAT=COMPRESSED exists in the buffer pool).
In the common case of checkpoint flushing, we can actually rely on the block->lock to protect us. The only other reason to hold buf_pool.mutex was updating the count of outstanding page writes (buf_pool.n_flush_list()). That counter is actually redundant, because we can refer to write_slots->pending_io_count().
Finally, we would remove pthread_cond_broadcast(&buf_pool.done_flush_list) from buf_page_write_complete(). Only the buf_flush_page_cleaner would call that. To wait for page writes to complete, os_aio_wait_until_no_pending_writes() may be invoked.
Interface change:
New parameter Innodb_buffer_pool_pages_split has been added
{"report":{"fcp":1080.6000003814697,"ttfb":337.6000003814697,"pageVisibility":"visible","entityId":103931,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"0771b58b-7dec-4387-9e1c-10c4c665d8bb","navigationType":0,"readyForUser":1160.6000003814697,"redirectCount":0,"resourceLoadedEnd":695.8000001907349,"resourceLoadedStart":344.80000019073486,"resourceTiming":[{"duration":140.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":344.80000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":344.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":485.30000019073486,"responseStart":0,"secureConnectionStart":0},{"duration":140.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bv2/820016/12ta74/2380add21a9a1006587582385952de73/_/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":345.1000003814697,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":345.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":485.6000003814697,"responseStart":0,"secureConnectionStart":0},{"duration":278.1000003814697,"initiatorType":"script","name":"https://jira.mariadb.org/s/e9b27a47da5fb0f74a35acd57e9847fb-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":345.30000019073486,"connectEnd":345.30000019073486,"connectStart":345.30000019073486,"domainLookupEnd":345.30000019073486,"domainLookupStart":345.30000019073486,"fetchStart":345.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":490.30000019073486,"responseEnd":623.4000005722046,"responseStart":511.6000003814697,"secureConnectionStart":345.30000019073486},{"duration":340.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/c32eb0da7ad9831253f8397e6cc26afd-CDN/lu2bv2/820016/12ta74/2380add21a9a1006587582385952de73/_/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":345.6000003814697,"connectEnd":345.6000003814697,"connectStart":345.6000003814697,"domainLookupEnd":345.6000003814697,"domainLookupStart":345.6000003814697,"fetchStart":345.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":489.9000005722046,"responseEnd":685.8000001907349,"responseStart":502.5,"secureConnectionStart":345.6000003814697},{"duration":164.60000038146973,"initiatorType":"script","name":"https://jira.mariadb.org/s/bc0bcb146314416123c992714ee00ff7-CDN/lu2bv2/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":345.80000019073486,"connectEnd":345.80000019073486,"connectStart":345.80000019073486,"domainLookupEnd":345.80000019073486,"domainLookupStart":345.80000019073486,"fetchStart":345.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":490.70000076293945,"responseEnd":510.4000005722046,"responseStart":506.9000005722046,"secureConnectionStart":345.80000019073486},{"duration":164.60000038146973,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":346,"connectEnd":346,"connectStart":346,"domainLookupEnd":346,"domainLookupStart":346,"fetchStart":346,"redirectEnd":0,"redirectStart":0,"requestStart":491,"responseEnd":510.6000003814697,"responseStart":507.6000003814697,"secureConnectionStart":346},{"duration":168.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":346.4000005722046,"connectEnd":346.4000005722046,"connectStart":346.4000005722046,"domainLookupEnd":346.4000005722046,"domainLookupStart":346.4000005722046,"fetchStart":346.4000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":492.6000003814697,"responseEnd":514.7000007629395,"responseStart":512.5,"secureConnectionStart":346.4000005722046},{"duration":143.80000019073486,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bv2/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":346.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":346.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":490.30000019073486,"responseStart":0,"secureConnectionStart":0},{"duration":170.5,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":346.70000076293945,"connectEnd":346.70000076293945,"connectStart":346.70000076293945,"domainLookupEnd":346.70000076293945,"domainLookupStart":346.70000076293945,"fetchStart":346.70000076293945,"redirectEnd":0,"redirectStart":0,"requestStart":494.1000003814697,"responseEnd":517.2000007629395,"responseStart":515,"secureConnectionStart":346.70000076293945},{"duration":145.4000005722046,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bv2/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":346.80000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":346.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":492.20000076293945,"responseStart":0,"secureConnectionStart":0},{"duration":170.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/719848dd97ebe0663199f49a3936487a-CDN/lu2bv2/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":347,"connectEnd":347,"connectStart":347,"domainLookupEnd":347,"domainLookupStart":347,"fetchStart":347,"redirectEnd":0,"redirectStart":0,"requestStart":494.6000003814697,"responseEnd":517.5,"responseStart":515.7000007629395,"secureConnectionStart":347},{"duration":345.3999996185303,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":349.20000076293945,"connectEnd":349.20000076293945,"connectStart":349.20000076293945,"domainLookupEnd":349.20000076293945,"domainLookupStart":349.20000076293945,"fetchStart":349.20000076293945,"redirectEnd":0,"redirectStart":0,"requestStart":591.9000005722046,"responseEnd":694.6000003814697,"responseStart":690.5,"secureConnectionStart":349.20000076293945},{"duration":346.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":349.30000019073486,"connectEnd":349.30000019073486,"connectStart":349.30000019073486,"domainLookupEnd":349.30000019073486,"domainLookupStart":349.30000019073486,"fetchStart":349.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":681.4000005722046,"responseEnd":695.8000001907349,"responseStart":694.7000007629395,"secureConnectionStart":349.30000019073486},{"duration":240,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":819.9000005722046,"connectEnd":819.9000005722046,"connectStart":819.9000005722046,"domainLookupEnd":819.9000005722046,"domainLookupStart":819.9000005722046,"fetchStart":819.9000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":1004.4000005722046,"responseEnd":1059.9000005722046,"responseStart":1059.1000003814697,"secureConnectionStart":819.9000005722046}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":117,"responseStart":337,"responseEnd":343,"domLoading":341,"domInteractive":1239,"domContentLoadedEventStart":1239,"domContentLoadedEventEnd":1288,"domComplete":2472,"loadEventStart":2472,"loadEventEnd":2473,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1211.4000005722046},{"name":"bigPipe.sidebar-id.end","time":1212.3000001907349},{"name":"bigPipe.activity-panel-pipe-id.start","time":1212.4000005722046},{"name":"bigPipe.activity-panel-pipe-id.end","time":1214.4000005722046},{"name":"activityTabFullyLoaded","time":1305.9000005722046}],"measures":[],"correlationId":"4f5f243441efe2","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":135,"dbReadsTimeInMs":36,"dbConnsTimeInMs":46,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
We are still observing a performance regression after rebasing this on
MDEV-27058. Hence, I think that we must preserve an explicit counter of the number of outstanding page writes. We could protect that counter with buf_dblwr.mutex, which we could acquire also for page writes that skipped the doublewrite buffer. Instead of removing the condition variable buf_pool.done_flush_list, we can replace it with something that pairs with buf_dblwr.mutex.