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":1176.3999999761581,"ttfb":339.60000002384186,"pageVisibility":"visible","entityId":28446,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"ed55f9e6-4ce0-4f00-ac72-f976855e8881","navigationType":0,"readyForUser":1248.5,"redirectCount":0,"resourceLoadedEnd":1194.2999999523163,"resourceLoadedStart":344.39999997615814,"resourceTiming":[{"duration":148.60000002384186,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":344.39999997615814,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":344.39999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":493,"responseStart":0,"secureConnectionStart":0},{"duration":148.39999997615814,"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":344.7000000476837,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":344.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":493.10000002384186,"responseStart":0,"secureConnectionStart":0},{"duration":157.29999995231628,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":344.7000000476837,"connectEnd":344.7000000476837,"connectStart":344.7000000476837,"domainLookupEnd":344.7000000476837,"domainLookupStart":344.7000000476837,"fetchStart":344.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":344.7000000476837,"responseEnd":502,"responseStart":502,"secureConnectionStart":344.7000000476837},{"duration":474.2000000476837,"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":344.7999999523163,"connectEnd":344.7999999523163,"connectStart":344.7999999523163,"domainLookupEnd":344.7999999523163,"domainLookupStart":344.7999999523163,"fetchStart":344.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":344.7999999523163,"responseEnd":819,"responseStart":819,"secureConnectionStart":344.7999999523163},{"duration":477.8000000715256,"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":344.89999997615814,"connectEnd":344.89999997615814,"connectStart":344.89999997615814,"domainLookupEnd":344.89999997615814,"domainLookupStart":344.89999997615814,"fetchStart":344.89999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":344.89999997615814,"responseEnd":822.7000000476837,"responseStart":822.7000000476837,"secureConnectionStart":344.89999997615814},{"duration":478.10000002384186,"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":345.10000002384186,"connectEnd":345.10000002384186,"connectStart":345.10000002384186,"domainLookupEnd":345.10000002384186,"domainLookupStart":345.10000002384186,"fetchStart":345.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":345.10000002384186,"responseEnd":823.2000000476837,"responseStart":823.2000000476837,"secureConnectionStart":345.10000002384186},{"duration":478.39999997615814,"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":345.10000002384186,"connectEnd":345.10000002384186,"connectStart":345.10000002384186,"domainLookupEnd":345.10000002384186,"domainLookupStart":345.10000002384186,"fetchStart":345.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":345.10000002384186,"responseEnd":823.5,"responseStart":823.5,"secureConnectionStart":345.10000002384186},{"duration":478.6999999284744,"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":345.2000000476837,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":345.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":823.8999999761581,"responseStart":0,"secureConnectionStart":0},{"duration":478.60000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":345.2999999523163,"connectEnd":345.2999999523163,"connectStart":345.2999999523163,"domainLookupEnd":345.2999999523163,"domainLookupStart":345.2999999523163,"fetchStart":345.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":345.2999999523163,"responseEnd":823.8999999761581,"responseStart":823.7999999523163,"secureConnectionStart":345.2999999523163},{"duration":478.7999999523163,"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":345.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":345.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":824.2999999523163,"responseStart":0,"secureConnectionStart":0},{"duration":478.7999999523163,"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":345.60000002384186,"connectEnd":345.60000002384186,"connectStart":345.60000002384186,"domainLookupEnd":345.60000002384186,"domainLookupStart":345.60000002384186,"fetchStart":345.60000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":345.60000002384186,"responseEnd":824.3999999761581,"responseStart":824.3999999761581,"secureConnectionStart":345.60000002384186},{"duration":630.5,"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":361.10000002384186,"connectEnd":361.10000002384186,"connectStart":361.10000002384186,"domainLookupEnd":361.10000002384186,"domainLookupStart":361.10000002384186,"fetchStart":361.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":361.10000002384186,"responseEnd":991.6000000238419,"responseStart":991.6000000238419,"secureConnectionStart":361.10000002384186},{"duration":820.2999999523163,"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":374,"connectEnd":374,"connectStart":374,"domainLookupEnd":374,"domainLookupStart":374,"fetchStart":374,"redirectEnd":0,"redirectStart":0,"requestStart":374,"responseEnd":1194.2999999523163,"responseStart":1194.2999999523163,"secureConnectionStart":374},{"duration":343.5,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":647,"connectEnd":647,"connectStart":647,"domainLookupEnd":647,"domainLookupStart":647,"fetchStart":647,"redirectEnd":0,"redirectStart":0,"requestStart":647,"responseEnd":990.5,"responseStart":990.5,"secureConnectionStart":647},{"duration":222.30000007152557,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-project.issue.navigator,-jira.view.issue,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":1083.7999999523163,"connectEnd":1083.7999999523163,"connectStart":1083.7999999523163,"domainLookupEnd":1083.7999999523163,"domainLookupStart":1083.7999999523163,"fetchStart":1083.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":1083.7999999523163,"responseEnd":1306.1000000238419,"responseStart":1306.1000000238419,"secureConnectionStart":1083.7999999523163}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":124,"responseStart":340,"responseEnd":374,"domLoading":343,"domInteractive":1300,"domContentLoadedEventStart":1300,"domContentLoadedEventEnd":1339,"domComplete":2135,"loadEventStart":2135,"loadEventEnd":2136,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1283},{"name":"bigPipe.sidebar-id.end","time":1283.7999999523163},{"name":"bigPipe.activity-panel-pipe-id.start","time":1283.8999999761581},{"name":"bigPipe.activity-panel-pipe-id.end","time":1286.2999999523163},{"name":"activityTabFullyLoaded","time":1349.5}],"measures":[],"correlationId":"4ba93251f65a25","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":142,"dbReadsTimeInMs":15,"dbConnsTimeInMs":25,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}