Our servers running MariaDB 10.1.17 in a galera cluster experienced a crash relating to the index merge sort_union optimization. The error caused all three of ou servers crash because the query, after failing on the first server due to the crash, was passed to the next server causing it to crash. I have disable the optimization using `optimizer_switch="index_merge_sort_union=off"` since the error continues to occur without it.
The crash occurs when the following query is run:
SELECT SQL_NO_CACHE contact_id FROM users_assignment FORCE INDEX (user_id,company_id) WHERE user_id = '57291' OR (user_id IN(55838,55839,56998,57260,57291,60227,121997,137571,173600,219233,306480,354991,358594,376261,398572,447223,472009,646282,932548,993011,1004609,1021262,1177117,1234288,1283121,1288749,1337771,57291) AND role_id = '1194') OR company_id = '2321'
|
I have attached the relevant log excerpts from the servers as well as some output from running mysqld in gdb and a SQL file that creates a table with data against which running the sample query above crashes.
EXPLAIN EXTENDED of the query above:
+------+-------------+----------------------------+-------------+--------------------+--------------------+---------+------+------+----------+---------------------------------------------------+
|
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
|
+------+-------------+----------------------------+-------------+--------------------+--------------------+---------+------+------+----------+---------------------------------------------------+
|
| 1 | SIMPLE | users_assignment_brad_test | index_merge | user_id,company_id | user_id,company_id | 4,4 | NULL | 8193 | 100.00 | Using sort_union(user_id,company_id); Using where |
|
+------+-------------+----------------------------+-------------+--------------------+--------------------+---------+------+------+----------+---------------------------------------------------+
|
{"report":{"fcp":1274.3000001907349,"ttfb":196,"pageVisibility":"visible","entityId":58287,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"0887a828-bfae-41ef-8442-c6e62c1e9334","navigationType":0,"readyForUser":1405.6999998092651,"redirectCount":0,"resourceLoadedEnd":1416.6000003814697,"resourceLoadedStart":201.69999980926514,"resourceTiming":[{"duration":463.80000019073486,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":201.69999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":201.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":665.5,"responseStart":0,"secureConnectionStart":0},{"duration":463.80000019073486,"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":202,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":202,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":665.8000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":471.69999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":202.10000038146973,"connectEnd":202.10000038146973,"connectStart":202.10000038146973,"domainLookupEnd":202.10000038146973,"domainLookupStart":202.10000038146973,"fetchStart":202.10000038146973,"redirectEnd":0,"redirectStart":0,"requestStart":202.10000038146973,"responseEnd":673.8000001907349,"responseStart":673.8000001907349,"secureConnectionStart":202.10000038146973},{"duration":510.19999980926514,"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":202.30000019073486,"connectEnd":202.30000019073486,"connectStart":202.30000019073486,"domainLookupEnd":202.30000019073486,"domainLookupStart":202.30000019073486,"fetchStart":202.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":202.30000019073486,"responseEnd":712.5,"responseStart":712.5,"secureConnectionStart":202.30000019073486},{"duration":551.3999996185303,"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":202.5,"connectEnd":202.5,"connectStart":202.5,"domainLookupEnd":202.5,"domainLookupStart":202.5,"fetchStart":202.5,"redirectEnd":0,"redirectStart":0,"requestStart":202.5,"responseEnd":753.8999996185303,"responseStart":753.8999996185303,"secureConnectionStart":202.5},{"duration":558.8000001907349,"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":202.69999980926514,"connectEnd":202.69999980926514,"connectStart":202.69999980926514,"domainLookupEnd":202.69999980926514,"domainLookupStart":202.69999980926514,"fetchStart":202.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":202.69999980926514,"responseEnd":761.5,"responseStart":761.5,"secureConnectionStart":202.69999980926514},{"duration":560.2000007629395,"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":203.39999961853027,"connectEnd":203.39999961853027,"connectStart":203.39999961853027,"domainLookupEnd":203.39999961853027,"domainLookupStart":203.39999961853027,"fetchStart":203.39999961853027,"redirectEnd":0,"redirectStart":0,"requestStart":203.39999961853027,"responseEnd":763.6000003814697,"responseStart":763.6000003814697,"secureConnectionStart":203.39999961853027},{"duration":634.7999992370605,"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":203.60000038146973,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":203.60000038146973,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":838.3999996185303,"responseStart":0,"secureConnectionStart":0},{"duration":564.6999998092651,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":203.80000019073486,"connectEnd":203.80000019073486,"connectStart":203.80000019073486,"domainLookupEnd":203.80000019073486,"domainLookupStart":203.80000019073486,"fetchStart":203.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":203.80000019073486,"responseEnd":768.5,"responseStart":768.5,"secureConnectionStart":203.80000019073486},{"duration":634.5,"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":204,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":204,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":838.5,"responseStart":0,"secureConnectionStart":0},{"duration":565,"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":204.10000038146973,"connectEnd":204.10000038146973,"connectStart":204.10000038146973,"domainLookupEnd":204.10000038146973,"domainLookupStart":204.10000038146973,"fetchStart":204.10000038146973,"redirectEnd":0,"redirectStart":0,"requestStart":204.10000038146973,"responseEnd":769.1000003814697,"responseStart":769.1000003814697,"secureConnectionStart":204.10000038146973},{"duration":788.5,"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":204.89999961853027,"connectEnd":204.89999961853027,"connectStart":204.89999961853027,"domainLookupEnd":204.89999961853027,"domainLookupStart":204.89999961853027,"fetchStart":204.89999961853027,"redirectEnd":0,"redirectStart":0,"requestStart":204.89999961853027,"responseEnd":993.3999996185303,"responseStart":993.3999996185303,"secureConnectionStart":204.89999961853027},{"duration":1211.6000003814697,"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":205,"connectEnd":205,"connectStart":205,"domainLookupEnd":205,"domainLookupStart":205,"fetchStart":205,"redirectEnd":0,"redirectStart":0,"requestStart":205,"responseEnd":1416.6000003814697,"responseStart":1416.6000003814697,"secureConnectionStart":205},{"duration":127.10000038146973,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":866.8999996185303,"connectEnd":866.8999996185303,"connectStart":866.8999996185303,"domainLookupEnd":866.8999996185303,"domainLookupStart":866.8999996185303,"fetchStart":866.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":866.8999996185303,"responseEnd":994,"responseStart":994,"secureConnectionStart":866.8999996185303}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":46,"responseStart":196,"responseEnd":197,"domLoading":199,"domInteractive":1466,"domContentLoadedEventStart":1466,"domContentLoadedEventEnd":1508,"domComplete":2712,"loadEventStart":2712,"loadEventEnd":2714,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1451.8999996185303},{"name":"bigPipe.sidebar-id.end","time":1452.6000003814697},{"name":"bigPipe.activity-panel-pipe-id.start","time":1452.8000001907349},{"name":"bigPipe.activity-panel-pipe-id.end","time":1456.8000001907349},{"name":"activityTabFullyLoaded","time":1521}],"measures":[],"correlationId":"f02ddf37822d2d","effectiveType":"4g","downlink":9.4,"rtt":0,"serverDuration":89,"dbReadsTimeInMs":9,"dbConnsTimeInMs":16,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}