It turns out that there are more causes to MDEV-14637 than the too small secondary index record size estimates that were fixed in MySQL 5.7.23.
With the following patch (extracted from MDEV-19514) applied to MySQL 5.7 or MariaDB Server 10.2 or later, the bug is repeatable:
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
|
index 4f9ecf10ec7..ecd90053d68 100644
|
--- a/storage/innobase/buf/buf0buf.cc
|
+++ b/storage/innobase/buf/buf0buf.cc
|
@@ -4617,6 +4617,8 @@ got_block:
|
fix_block->made_dirty_with_no_latch = dirty_with_no_latch;
|
}
|
|
+ rw_lock_x_lock(&block->lock);
|
+ rw_lock_x_unlock(&block->lock);
|
mtr_memo_type_t fix_type;
|
|
switch (rw_latch) {
|
./mtr --big-test --mysqld=--innodb-page-size=4k innodb.innodb_bulk_create_index
|
mysql-5.7.27
|
CURRENT_TEST: innodb.innodb_bulk_create_index
|
mysqltest: In included file ./suite/innodb/include/innodb_bulk_create_index.inc at line 84:
|
included from /mariadb/mysql-server/mysql-test/suite/innodb/t/innodb_bulk_create_index.test at line 41:
|
At line 84: query 'SELECT * FROM t1 WHERE title = 'a3000'' failed: 2013: Lost connection to MySQL server during query
|
…
|
Version: '5.7.27-debug-log' socket: '/dev/shm/5.7/mysql-test/var/tmp/mysqld.1.sock' port: 13000 Source distribution
|
########################################
|
DEADLOCK of threads detected!
|
rw-lock 0x7f188e748968 --Thread 139743545079552 has waited at buf0buf.cc line 4620 for 0 seconds the semaphore:
|
X-lock on RW-latch at 0x7f188e748968 created in file buf0buf.cc line 1460
|
a writer (thread id 139743127922432) has reserved it in mode exclusive
|
number of readers 0, waiters flag 1, lock_word: 0
|
Last time read locked in file row0row.cc line 1075
|
Last time write locked in file /mariadb/mysql-server/storage/innobase/include/mtr0mtr.ic line 153
|
Locked: thread 139743127922432 file mtr0mtr.ic line 153 X-LOCK
|
Locked: thread 139743127922432 file mtr0mtr.ic line 153 X-LOCK
|
rw-lock 0x7f188e72a030 --Thread 139743127922432 has waited at buf0buf.cc line 4620 for 0 seconds the semaphore:
|
X-lock (wait_ex) on RW-latch at 0x7f188e72a030 created in file buf0buf.cc line 1460
|
a writer (thread id 139743127922432) has reserved it in mode wait exclusive
|
number of readers 1, waiters flag 0, lock_word: ffffffffefffffff
|
Last time read locked in file btr0cur.cc line 5736
|
Last time write locked in file /mariadb/mysql-server/storage/innobase/include/mtr0mtr.ic line 117
|
Locked: thread 139743545079552 file btr0cur.cc line 5736 S-LOCK
|
Locked: thread 139743545079552 file btr0cur.cc line 5736 S-LOCK
|
2019-09-10T07:31:49.289423Z 0 [ERROR] [FATAL] InnoDB: ######################################## Deadlock Detected!
|
My original work-around from MDEV-14637 (always acquire the index->lock in X mode for BTR_MODIFY_TREE operations) prevents the crash, but would introduce a very prominent performance regression.
Transition |
Time In Source Status |
Execution Times |
Open |
|
Confirmed |
|
6m 6s
|
1
|
Confirmed |
|
Closed |
|
72d 23h 40m
|
1
|
{"report":{"fcp":1173.4000000953674,"ttfb":328.69999980926514,"pageVisibility":"visible","entityId":78835,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"2d08297d-233a-4b3b-89de-4bdf09bab9b9","navigationType":0,"readyForUser":1277.2999997138977,"redirectCount":0,"resourceLoadedEnd":1867.5,"resourceLoadedStart":334,"resourceTiming":[{"duration":253.90000009536743,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":334,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":334,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":587.9000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":254,"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":334.2999997138977,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":334.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":588.2999997138977,"responseStart":0,"secureConnectionStart":0},{"duration":263.40000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":334.5,"connectEnd":334.5,"connectStart":334.5,"domainLookupEnd":334.5,"domainLookupStart":334.5,"fetchStart":334.5,"redirectEnd":0,"redirectStart":0,"requestStart":334.5,"responseEnd":597.9000000953674,"responseStart":597.9000000953674,"secureConnectionStart":334.5},{"duration":317.2000002861023,"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":334.69999980926514,"connectEnd":334.69999980926514,"connectStart":334.69999980926514,"domainLookupEnd":334.69999980926514,"domainLookupStart":334.69999980926514,"fetchStart":334.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":334.69999980926514,"responseEnd":651.9000000953674,"responseStart":651.9000000953674,"secureConnectionStart":334.69999980926514},{"duration":321.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":334.90000009536743,"connectEnd":334.90000009536743,"connectStart":334.90000009536743,"domainLookupEnd":334.90000009536743,"domainLookupStart":334.90000009536743,"fetchStart":334.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":334.90000009536743,"responseEnd":656.4000000953674,"responseStart":656.4000000953674,"secureConnectionStart":334.90000009536743},{"duration":321.90000009536743,"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":335.09999990463257,"connectEnd":335.09999990463257,"connectStart":335.09999990463257,"domainLookupEnd":335.09999990463257,"domainLookupStart":335.09999990463257,"fetchStart":335.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":335.09999990463257,"responseEnd":657,"responseStart":657,"secureConnectionStart":335.09999990463257},{"duration":322.5,"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":335.2999997138977,"connectEnd":335.2999997138977,"connectStart":335.2999997138977,"domainLookupEnd":335.2999997138977,"domainLookupStart":335.2999997138977,"fetchStart":335.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":335.2999997138977,"responseEnd":657.7999997138977,"responseStart":657.7999997138977,"secureConnectionStart":335.2999997138977},{"duration":422.69999980926514,"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":335.40000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":335.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":758.0999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":322.69999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":335.59999990463257,"connectEnd":335.59999990463257,"connectStart":335.59999990463257,"domainLookupEnd":335.59999990463257,"domainLookupStart":335.59999990463257,"fetchStart":335.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":335.59999990463257,"responseEnd":658.2999997138977,"responseStart":658.2999997138977,"secureConnectionStart":335.59999990463257},{"duration":416,"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":342.40000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":342.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":758.4000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":316.30000019073486,"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":342.59999990463257,"connectEnd":342.59999990463257,"connectStart":342.59999990463257,"domainLookupEnd":342.59999990463257,"domainLookupStart":342.59999990463257,"fetchStart":342.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":342.59999990463257,"responseEnd":658.9000000953674,"responseStart":658.9000000953674,"secureConnectionStart":342.59999990463257},{"duration":1518.7000002861023,"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":348.2999997138977,"connectEnd":348.2999997138977,"connectStart":348.2999997138977,"domainLookupEnd":348.2999997138977,"domainLookupStart":348.2999997138977,"fetchStart":348.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":348.2999997138977,"responseEnd":1867,"responseStart":1867,"secureConnectionStart":348.2999997138977},{"duration":1514.5999999046326,"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":352.90000009536743,"connectEnd":352.90000009536743,"connectStart":352.90000009536743,"domainLookupEnd":352.90000009536743,"domainLookupStart":352.90000009536743,"fetchStart":352.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":352.90000009536743,"responseEnd":1867.5,"responseStart":1867.5,"secureConnectionStart":352.90000009536743},{"duration":328.19999980926514,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":795.0999999046326,"connectEnd":795.0999999046326,"connectStart":795.0999999046326,"domainLookupEnd":795.0999999046326,"domainLookupStart":795.0999999046326,"fetchStart":795.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":795.0999999046326,"responseEnd":1123.2999997138977,"responseStart":1123.2999997138977,"secureConnectionStart":795.0999999046326},{"duration":815.7999997138977,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1118.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1118.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1934.2999997138977,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":168,"responseStart":329,"responseEnd":353,"domLoading":333,"domInteractive":1956,"domContentLoadedEventStart":1956,"domContentLoadedEventEnd":2023,"domComplete":2722,"loadEventStart":2722,"loadEventEnd":2722,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1937.1999998092651},{"name":"bigPipe.sidebar-id.end","time":1938.1999998092651},{"name":"bigPipe.activity-panel-pipe-id.start","time":1938.4000000953674},{"name":"bigPipe.activity-panel-pipe-id.end","time":1939.4000000953674},{"name":"activityTabFullyLoaded","time":2038}],"measures":[],"correlationId":"b8eb87d0bee69c","effectiveType":"4g","downlink":9.6,"rtt":0,"serverDuration":98,"dbReadsTimeInMs":17,"dbConnsTimeInMs":26,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}