err.log
[ERROR] Slave SQL: Could not execute Delete_rows_v1 event on table aaa.p; Cannot delete or update a parent row: a foreign key constraint fails (`aaa`.`f`, CONSTRAINT `f_ibfk_1` FOREIGN KEY (`f_id`) REFERENCES `p` (`id`)), Error_code: 1451; handler error HA_ERR_ROW_IS_REFERENCED; the event's master log FIRST, end_log_pos 108, Internal MariaDB error code: 1451
|
2018-03-16 14:33:39 140457990018816 [Warning] WSREP: RBR event 3 Delete_rows_v1 apply warning: 152, 128
|
2018-03-16 14:33:39 140457990018816 [Warning] WSREP: Failed to apply app buffer: seqno: 128, status: 1
|
at galera/src/trx_handle.cpp:apply():351
|
Reproduce
wsrep_slave_threads>1
CREATE TABLE `p` (
|
`id` int(11) NOT NULL,
|
`a` varchar(33) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
PRIMARY KEY (`id`)
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ;
|
|
CREATE TABLE `f` (
|
`id` int(11) NOT NULL,
|
`f_id` int(11) DEFAULT NULL,
|
KEY `f_id` (`f_id`),
|
CONSTRAINT `f_ibfk_1` FOREIGN KEY (`f_id`) REFERENCES `p` (`id`)
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ;
|
|
insert into p select 1,'aaa';
|
|
insert into f select 1,1;
|
|
#Repeatedly execute the following SQL until you generate thousands of data
|
insert into f select a.id + b.a,a.f_id from f a join (select max(id) as a from f b) b on 1=1;
|
|
select count(*) from f;
|
+----------+
|
| count(*) |
|
+----------+
|
| 131072 |
|
+----------+
|
|
#Slave node, no matter wsrep_slave_fk_checks is on or off.
|
show variables like 'wsrep_slave_fk_checks';
|
+-----------------------+-------+
|
| Variable_name | Value |
|
+-----------------------+-------+
|
| wsrep_slave_fk_checks | ON |
|
+-----------------------+-------+
|
|
#Master (Write) node
|
delete from f;delete from p;
|
|
#Slave node down and got errors
|
2018-03-16 14:33:39 140457990018816 [ERROR] Slave SQL: Could not execute Delete_rows_v1 event on table aaa.p; Cannot delete or update a parent row: a foreign key constraint fails (`aaa`.`f`, CONSTRAINT `f_ibfk_1` FOREIGN KEY (`f_id`) REFERENCES `p` (`id`)), Error_code: 1451; handler error HA_ERR_ROW_IS_REFERENCED; the event's master log FIRST, end_log_pos 108, Internal MariaDB error code: 1451
|
2018-03-16 14:33:39 140457990018816 [Warning] WSREP: RBR event 3 Delete_rows_v1 apply warning: 152, 128
|
2018-03-16 14:33:39 140457990018816 [Warning] WSREP: Failed to apply app buffer: seqno: 128, status: 1
|
at galera/src/trx_handle.cpp:apply():351
|
Retrying 2th time
|
2018-03-16 14:33:39 140457990018816 [ERROR] Slave SQL: Could not execute Delete_rows_v1 event on table aaa.p; Cannot delete or update a parent row: a foreign key constraint fails (`aaa`.`f`, CONSTRAINT `f_ibfk_1` FOREIGN KEY (`f_id`) REFERENCES `p` (`id`)), Error_code: 1451; handler error HA_ERR_ROW_IS_REFERENCED; the event's master log FIRST, end_log_pos 108, Internal MariaDB error code: 1451
|
2018-03-16 14:33:39 140457990018816 [Warning] WSREP: RBR event 3 Delete_rows_v1 apply warning: 152, 128
|
2018-03-16 14:33:39 140457990018816 [Warning] WSREP: Failed to apply app buffer: seqno: 128, status: 1
|
at galera/src/trx_handle.cpp:apply():351
|
Retrying 3th time
|
2018-03-16 14:33:39 140457990018816 [ERROR] Slave SQL: Could not execute Delete_rows_v1 event on table aaa.p; Cannot delete or update a parent row: a foreign key constraint fails (`aaa`.`f`, CONSTRAINT `f_ibfk_1` FOREIGN KEY (`f_id`) REFERENCES `p` (`id`)), Error_code: 1451; handler error HA_ERR_ROW_IS_REFERENCED; the event's master log FIRST, end_log_pos 108, Internal MariaDB error code: 1451
|
2018-03-16 14:33:39 140457990018816 [Warning] WSREP: RBR event 3 Delete_rows_v1 apply warning: 152, 128
|
2018-03-16 14:33:39 140457990018816 [Warning] WSREP: Failed to apply app buffer: seqno: 128, status: 1
|
at galera/src/trx_handle.cpp:apply():351
|
Retrying 4th time
|
2018-03-16 14:33:39 140457990018816 [ERROR] Slave SQL: Could not execute Delete_rows_v1 event on table aaa.p; Cannot delete or update a parent row: a foreign key constraint fails (`aaa`.`f`, CONSTRAINT `f_ibfk_1` FOREIGN KEY (`f_id`) REFERENCES `p` (`id`)), Error_code: 1451; handler error HA_ERR_ROW_IS_REFERENCED; the event's master log FIRST, end_log_pos 108, Internal MariaDB error code: 1451
|
2018-03-16 14:33:39 140457990018816 [Warning] WSREP: RBR event 3 Delete_rows_v1 apply warning: 152, 128
|
2018-03-16 14:33:39 140457990018816 [ERROR] WSREP: Failed to apply trx: source: 849e805c-1dd2-11e8-aa79-eb31f2b81368 version: 3 local: 0 state: APPLYING flags: 1 conn_id: 87 trx_id: 12277 seqnos (l: 33, g: 128, s: 127, d: 126, ts: 1358419270394303)
|
2018-03-16 14:33:39 140457990018816 [ERROR] WSREP: Failed to apply trx 128 4 times
|
2018-03-16 14:33:39 140457990018816 [ERROR] WSREP: Node consistency compromised, aborting...
|
|
#Slave processlist
|
#Write set 127 is "delete from f;"
|
#Write set 128 is "delete from p;"
|
#Slave concurrently apply the two sql
|
!image-2018-03-21-10-45-36-084.png|thumbnail!
|
This error didn't reproduce on MariaDB 10.2.7 with wsrep_slave_threads>1
{"report":{"fcp":848.8999999761581,"ttfb":181.59999990463257,"pageVisibility":"visible","entityId":66411,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":32,"apdex":0.5,"journeyId":"18f4eff4-4987-483c-a3c6-70e2d3a749b1","navigationType":0,"readyForUser":1018.3999999761581,"redirectCount":0,"resourceLoadedEnd":1052,"resourceLoadedStart":186.59999990463257,"resourceTiming":[{"duration":222.40000009536743,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":186.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":186.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":409,"responseStart":0,"secureConnectionStart":0},{"duration":222.10000002384186,"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":186.89999997615814,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":186.89999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":409,"responseStart":0,"secureConnectionStart":0},{"duration":230.70000004768372,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":187.09999990463257,"connectEnd":187.09999990463257,"connectStart":187.09999990463257,"domainLookupEnd":187.09999990463257,"domainLookupStart":187.09999990463257,"fetchStart":187.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":187.09999990463257,"responseEnd":417.7999999523163,"responseStart":417.7999999523163,"secureConnectionStart":187.09999990463257},{"duration":255.30000007152557,"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":187.09999990463257,"connectEnd":187.09999990463257,"connectStart":187.09999990463257,"domainLookupEnd":187.09999990463257,"domainLookupStart":187.09999990463257,"fetchStart":187.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":187.09999990463257,"responseEnd":442.39999997615814,"responseStart":442.39999997615814,"secureConnectionStart":187.09999990463257},{"duration":258.7000000476837,"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":187.29999995231628,"connectEnd":187.29999995231628,"connectStart":187.29999995231628,"domainLookupEnd":187.29999995231628,"domainLookupStart":187.29999995231628,"fetchStart":187.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":187.29999995231628,"responseEnd":446,"responseStart":446,"secureConnectionStart":187.29999995231628},{"duration":259.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":187.39999997615814,"connectEnd":187.39999997615814,"connectStart":187.39999997615814,"domainLookupEnd":187.39999997615814,"domainLookupStart":187.39999997615814,"fetchStart":187.39999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":187.39999997615814,"responseEnd":446.5,"responseStart":446.5,"secureConnectionStart":187.39999997615814},{"duration":259.59999990463257,"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":187.5,"connectEnd":187.5,"connectStart":187.5,"domainLookupEnd":187.5,"domainLookupStart":187.5,"fetchStart":187.5,"redirectEnd":0,"redirectStart":0,"requestStart":187.5,"responseEnd":447.09999990463257,"responseStart":447.09999990463257,"secureConnectionStart":187.5},{"duration":259.90000009536743,"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":187.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":187.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":447.5,"responseStart":0,"secureConnectionStart":0},{"duration":259.89999997615814,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":187.69999992847443,"connectEnd":187.69999992847443,"connectStart":187.69999992847443,"domainLookupEnd":187.69999992847443,"domainLookupStart":187.69999992847443,"fetchStart":187.69999992847443,"redirectEnd":0,"redirectStart":0,"requestStart":187.69999992847443,"responseEnd":447.59999990463257,"responseStart":447.5,"secureConnectionStart":187.69999992847443},{"duration":260.2000000476837,"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":187.79999995231628,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":187.79999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":448,"responseStart":0,"secureConnectionStart":0},{"duration":260.1999999284744,"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":187.89999997615814,"connectEnd":187.89999997615814,"connectStart":187.89999997615814,"domainLookupEnd":187.89999997615814,"domainLookupStart":187.89999997615814,"fetchStart":187.89999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":187.89999997615814,"responseEnd":448.09999990463257,"responseStart":448.09999990463257,"secureConnectionStart":187.89999997615814},{"duration":556.3999999761581,"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":203.69999992847443,"connectEnd":203.69999992847443,"connectStart":203.69999992847443,"domainLookupEnd":203.69999992847443,"domainLookupStart":203.69999992847443,"fetchStart":203.69999992847443,"redirectEnd":0,"redirectStart":0,"requestStart":203.69999992847443,"responseEnd":760.0999999046326,"responseStart":760.0999999046326,"secureConnectionStart":203.69999992847443},{"duration":848.3000000715256,"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":203.69999992847443,"connectEnd":203.69999992847443,"connectStart":203.69999992847443,"domainLookupEnd":203.69999992847443,"domainLookupStart":203.69999992847443,"fetchStart":203.69999992847443,"redirectEnd":0,"redirectStart":0,"requestStart":203.69999992847443,"responseEnd":1052,"responseStart":1052,"secureConnectionStart":203.69999992847443},{"duration":259.7000000476837,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":649.1999999284744,"connectEnd":649.1999999284744,"connectStart":649.1999999284744,"domainLookupEnd":649.1999999284744,"domainLookupStart":649.1999999284744,"fetchStart":649.1999999284744,"redirectEnd":0,"redirectStart":0,"requestStart":649.1999999284744,"responseEnd":908.8999999761581,"responseStart":908.8999999761581,"secureConnectionStart":649.1999999284744},{"duration":257,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":826.8999999761581,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":826.8999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1083.8999999761581,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":26,"responseStart":182,"responseEnd":204,"domLoading":185,"domInteractive":1080,"domContentLoadedEventStart":1080,"domContentLoadedEventEnd":1120,"domComplete":1999,"loadEventStart":1999,"loadEventEnd":2001,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1057.1999999284744},{"name":"bigPipe.sidebar-id.end","time":1057.8999999761581},{"name":"bigPipe.activity-panel-pipe-id.start","time":1058.0999999046326},{"name":"bigPipe.activity-panel-pipe-id.end","time":1060.5},{"name":"activityTabFullyLoaded","time":1130.5999999046326}],"measures":[],"correlationId":"6076f051efd502","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":86,"dbReadsTimeInMs":16,"dbConnsTimeInMs":24,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}