Type:
Task
Priority:
Major
Resolution:
Won't Do
Sprint:
10.2.1-3, 10.2.1-4, 10.2.1-5
tc_acquire_table and tc_release_table are critical sections of table cache. Among other things, they update TABLE::in_use:
tc_acquire_table - table->in_use= current_thd
tc_release_table - table->in_use= 0
Normally table->in_use is only accessed/modified by thread that owns this table instance, which means access to this variable doesn't really need to be synchronized.
There are a few exception though when foreign threads may read this variable:
TABLE_SHARE::visit_subgraph() (MDL deadlock detector): called after marking table(s) old and purging unused table instances, thus tc_acquire_table() must never change in_use (because there is nothing to acquire); tc_release_table() must be fixed not to change in_use while table is in all_tables list. Otherwise no synchronization needed.
kill_delayed_threads_for_table(): mostly same as for TABLE_SHARE::visit_subgraph().
list_open_tables(): no synchronization needed, unsafe access is acceptable.
print_cached_tables() (debug only): synchronization needed.
check_unused() (debug only): remove this function, it was supposed to check unused_tables, which was eliminated by MDEV-5388 .
tdc_remove_table() (debug only): no extra synchronization needed, protected by exclusive MDL.
There are a few options how we can synchronize access to this variable:
mutex (can be complex, MDL deadlock detecter needs recursive lock)
rwlock
atomic spinlock (requires much less memory than mutex/rwlock)
{"report":{"fcp":890.6000001430511,"ttfb":241.40000009536743,"pageVisibility":"visible","entityId":28446,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"3ebc10a9-c353-4b9a-bb38-b836cb2bbb9d","navigationType":0,"readyForUser":950.1000001430511,"redirectCount":0,"resourceLoadedEnd":508.7000000476837,"resourceLoadedStart":247,"resourceTiming":[{"duration":17.700000047683716,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":247,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":247,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":264.7000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":18.40000009536743,"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":247.20000004768372,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":247.20000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":265.60000014305115,"responseStart":0,"secureConnectionStart":0},{"duration":184.89999985694885,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":247.30000019073486,"connectEnd":247.30000019073486,"connectStart":247.30000019073486,"domainLookupEnd":247.30000019073486,"domainLookupStart":247.30000019073486,"fetchStart":247.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":267.7000000476837,"responseEnd":432.2000000476837,"responseStart":280.2000000476837,"secureConnectionStart":247.30000019073486},{"duration":261.2999999523163,"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":247.40000009536743,"connectEnd":247.40000009536743,"connectStart":247.40000009536743,"domainLookupEnd":247.40000009536743,"domainLookupStart":247.40000009536743,"fetchStart":247.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":270.90000009536743,"responseEnd":508.7000000476837,"responseStart":288.10000014305115,"secureConnectionStart":247.40000009536743},{"duration":20.700000047683716,"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":247.60000014305115,"connectEnd":247.60000014305115,"connectStart":247.60000014305115,"domainLookupEnd":247.60000014305115,"domainLookupStart":247.60000014305115,"fetchStart":247.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":247.60000014305115,"responseEnd":268.30000019073486,"responseStart":268.30000019073486,"secureConnectionStart":247.60000014305115},{"duration":21.799999952316284,"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":247.60000014305115,"connectEnd":247.60000014305115,"connectStart":247.60000014305115,"domainLookupEnd":247.60000014305115,"domainLookupStart":247.60000014305115,"fetchStart":247.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":247.60000014305115,"responseEnd":269.40000009536743,"responseStart":269.30000019073486,"secureConnectionStart":247.60000014305115},{"duration":50.5,"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":247.70000004768372,"connectEnd":247.70000004768372,"connectStart":247.70000004768372,"domainLookupEnd":247.70000004768372,"domainLookupStart":247.70000004768372,"fetchStart":247.70000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":272.40000009536743,"responseEnd":298.2000000476837,"responseStart":296.30000019073486,"secureConnectionStart":247.70000004768372},{"duration":23,"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":247.80000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":247.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":270.80000019073486,"responseStart":0,"secureConnectionStart":0},{"duration":50.59999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":247.90000009536743,"connectEnd":247.90000009536743,"connectStart":247.90000009536743,"domainLookupEnd":247.90000009536743,"domainLookupStart":247.90000009536743,"fetchStart":247.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":272.7000000476837,"responseEnd":298.5,"responseStart":297,"secureConnectionStart":247.90000009536743},{"duration":24.200000047683716,"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":248.10000014305115,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":248.10000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":272.30000019073486,"responseStart":0,"secureConnectionStart":0},{"duration":54.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":248.20000004768372,"connectEnd":248.20000004768372,"connectStart":248.20000004768372,"domainLookupEnd":248.20000004768372,"domainLookupStart":248.20000004768372,"fetchStart":248.20000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":274.2000000476837,"responseEnd":302.7000000476837,"responseStart":301.7000000476837,"secureConnectionStart":248.20000004768372},{"duration":40.19999980926514,"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":253.80000019073486,"connectEnd":253.80000019073486,"connectStart":253.80000019073486,"domainLookupEnd":253.80000019073486,"domainLookupStart":253.80000019073486,"fetchStart":253.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":253.80000019073486,"responseEnd":294,"responseStart":294,"secureConnectionStart":253.80000019073486},{"duration":61.59999990463257,"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":253.90000009536743,"connectEnd":253.90000009536743,"connectStart":253.90000009536743,"domainLookupEnd":253.90000009536743,"domainLookupStart":253.90000009536743,"fetchStart":253.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":253.90000009536743,"responseEnd":315.5,"responseStart":315.5,"secureConnectionStart":253.90000009536743},{"duration":201.79999995231628,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":636.3000001907349,"connectEnd":636.3000001907349,"connectStart":636.3000001907349,"domainLookupEnd":636.3000001907349,"domainLookupStart":636.3000001907349,"fetchStart":636.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":805.3000001907349,"responseEnd":838.1000001430511,"responseStart":837.2000000476837,"secureConnectionStart":636.3000001907349}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":39,"responseStart":241,"responseEnd":246,"domLoading":245,"domInteractive":1004,"domContentLoadedEventStart":1004,"domContentLoadedEventEnd":1046,"domComplete":1790,"loadEventStart":1790,"loadEventEnd":1791,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":984.7000000476837},{"name":"bigPipe.sidebar-id.end","time":985.5},{"name":"bigPipe.activity-panel-pipe-id.start","time":985.6000001430511},{"name":"bigPipe.activity-panel-pipe-id.end","time":988.4000000953674},{"name":"activityTabFullyLoaded","time":1058}],"measures":[],"correlationId":"5667368d61bca6","effectiveType":"4g","downlink":9.7,"rtt":0,"serverDuration":129,"dbReadsTimeInMs":17,"dbConnsTimeInMs":25,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}