Problem for the first case is that while inserting the row, InnoDB does insert into referencing index(a) first and try to do referenced index(b) last. While inserting the referencing index(a), InnoDB tries to find the matching row in referenced index(b) and fails.
But in 2nd case, InnoDB does insert into referenced index (b) first and later to the referencing index(a). So insert is successful in 2nd case.
This issue can be solved by deferring the foreign key constraint later after completing the row insert.
Attachments
Issue Links
relates to
MDEV-26096Constraints: support deferred constraints [WAS: Make the Unique index ONLY evaluate immediately before the commit (NOT after each UPDATE)]
Open
MDEV-36112Deadlock Issue with Foreign Key Constraints on concurrent execution
The implementation of this should include the test case of MDEV-36112 and ensure that the deadlock is no longer reproducible.
Marko Mäkelä
added a comment - The implementation of this should include the test case of MDEV-36112 and ensure that the deadlock is no longer reproducible.
People
Thirunarayanan Balathandayuthapani
Thirunarayanan Balathandayuthapani
Votes:
0Vote for this issue
Watchers:
2Start watching this issue
Dates
Created:
Updated:
Git Integration
Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.
{"report":{"fcp":6605.099999904633,"ttfb":5839.099999904633,"pageVisibility":"visible","entityId":132581,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0,"journeyId":"e538727c-8cdf-44d4-b7e8-bcf02458ac00","navigationType":0,"readyForUser":6724.599999904633,"redirectCount":0,"resourceLoadedEnd":6327.300000190735,"resourceLoadedStart":5846.5,"resourceTiming":[{"duration":133,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":5846.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":5846.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":5979.5,"responseStart":0,"secureConnectionStart":0},{"duration":133.2999997138977,"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":5846.800000190735,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":5846.800000190735,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":5980.099999904633,"responseStart":0,"secureConnectionStart":0},{"duration":317,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":5847,"connectEnd":5982.599999904633,"connectStart":5982.599999904633,"domainLookupEnd":5982.599999904633,"domainLookupStart":5982.599999904633,"fetchStart":5847,"redirectEnd":0,"redirectStart":0,"requestStart":5982.800000190735,"responseEnd":6164,"responseStart":6001.900000095367,"secureConnectionStart":5982.599999904633},{"duration":464.3999996185303,"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":5847.200000286102,"connectEnd":5847.200000286102,"connectStart":5847.200000286102,"domainLookupEnd":5847.200000286102,"domainLookupStart":5847.200000286102,"fetchStart":5847.200000286102,"redirectEnd":0,"redirectStart":0,"requestStart":5983.800000190735,"responseEnd":6311.599999904633,"responseStart":5998.099999904633,"secureConnectionStart":5847.200000286102},{"duration":150.5,"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":5847.400000095367,"connectEnd":5847.400000095367,"connectStart":5847.400000095367,"domainLookupEnd":5847.400000095367,"domainLookupStart":5847.400000095367,"fetchStart":5847.400000095367,"redirectEnd":0,"redirectStart":0,"requestStart":5985,"responseEnd":5997.900000095367,"responseStart":5996.800000190735,"secureConnectionStart":5847.400000095367},{"duration":162.5,"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":5847.5,"connectEnd":5847.5,"connectStart":5847.5,"domainLookupEnd":5847.5,"domainLookupStart":5847.5,"fetchStart":5847.5,"redirectEnd":0,"redirectStart":0,"requestStart":5986.900000095367,"responseEnd":6010,"responseStart":6009,"secureConnectionStart":5847.5},{"duration":163.2999997138977,"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":5847.800000190735,"connectEnd":5847.800000190735,"connectStart":5847.800000190735,"domainLookupEnd":5847.800000190735,"domainLookupStart":5847.800000190735,"fetchStart":5847.800000190735,"redirectEnd":0,"redirectStart":0,"requestStart":5987.300000190735,"responseEnd":6011.099999904633,"responseStart":6010.099999904633,"secureConnectionStart":5847.800000190735},{"duration":139.30000019073486,"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":5847.900000095367,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":5847.900000095367,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":5987.200000286102,"responseStart":0,"secureConnectionStart":0},{"duration":167.60000038146973,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":5848.099999904633,"connectEnd":5848.099999904633,"connectStart":5848.099999904633,"domainLookupEnd":5848.099999904633,"domainLookupStart":5848.099999904633,"fetchStart":5848.099999904633,"redirectEnd":0,"redirectStart":0,"requestStart":5990.099999904633,"responseEnd":6015.700000286102,"responseStart":6014.599999904633,"secureConnectionStart":5848.099999904633},{"duration":140.40000009536743,"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":5848.300000190735,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":5848.300000190735,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":5988.700000286102,"responseStart":0,"secureConnectionStart":0},{"duration":173.19999980926514,"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":5848.400000095367,"connectEnd":5848.400000095367,"connectStart":5848.400000095367,"domainLookupEnd":5848.400000095367,"domainLookupStart":5848.400000095367,"fetchStart":5848.400000095367,"redirectEnd":0,"redirectStart":0,"requestStart":5995.800000190735,"responseEnd":6021.599999904633,"responseStart":6015.900000095367,"secureConnectionStart":5848.400000095367},{"duration":469.80000019073486,"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":5855.599999904633,"connectEnd":5855.599999904633,"connectStart":5855.599999904633,"domainLookupEnd":5855.599999904633,"domainLookupStart":5855.599999904633,"fetchStart":5855.599999904633,"redirectEnd":0,"redirectStart":0,"requestStart":6156.700000286102,"responseEnd":6325.400000095367,"responseStart":6319.5,"secureConnectionStart":5855.599999904633},{"duration":471.40000009536743,"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":5855.900000095367,"connectEnd":5855.900000095367,"connectStart":5855.900000095367,"domainLookupEnd":5855.900000095367,"domainLookupStart":5855.900000095367,"fetchStart":5855.900000095367,"redirectEnd":0,"redirectStart":0,"requestStart":6270.099999904633,"responseEnd":6327.300000190735,"responseStart":6323.800000190735,"secureConnectionStart":5855.900000095367},{"duration":200.59999990463257,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":6293.700000286102,"connectEnd":6293.700000286102,"connectStart":6293.700000286102,"domainLookupEnd":6293.700000286102,"domainLookupStart":6293.700000286102,"fetchStart":6293.700000286102,"redirectEnd":0,"redirectStart":0,"requestStart":6459.300000190735,"responseEnd":6494.300000190735,"responseStart":6493.5,"secureConnectionStart":6293.700000286102},{"duration":164.80000019073486,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":6557,"connectEnd":6557,"connectStart":6557,"domainLookupEnd":6557,"domainLookupStart":6557,"fetchStart":6557,"redirectEnd":0,"redirectStart":0,"requestStart":6686.099999904633,"responseEnd":6721.800000190735,"responseStart":6720.599999904633,"secureConnectionStart":6557}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":5320,"responseStart":5839,"responseEnd":5856,"domLoading":5843,"domInteractive":6783,"domContentLoadedEventStart":6783,"domContentLoadedEventEnd":6832,"domComplete":7635,"loadEventStart":7635,"loadEventEnd":7635,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":6763.200000286102},{"name":"bigPipe.sidebar-id.end","time":6763.900000095367},{"name":"bigPipe.activity-panel-pipe-id.start","time":6764.200000286102},{"name":"bigPipe.activity-panel-pipe-id.end","time":6764.900000095367},{"name":"activityTabFullyLoaded","time":6849}],"measures":[],"correlationId":"d86c84ae8783f9","effectiveType":"4g","downlink":9.8,"rtt":0,"serverDuration":90,"dbReadsTimeInMs":11,"dbConnsTimeInMs":19,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
The implementation of this should include the test case of
MDEV-36112and ensure that the deadlock is no longer reproducible.