Note: In the test case below, the contents of the table after UPDATE FOR PORTION is already wrong, see MDEV-22414 for it. I am not sure whether the following assertion is related to it, though.
CREATE TABLE t1 (id INT AUTO_INCREMENT, s TIMESTAMP, e TIMESTAMP, PERIOD FOR p(s,e), PRIMARY KEY(id)) WITH SYSTEM VERSIONING;
|
INSERT INTO t1 VALUES (1,'2001-09-12','2029-05-26');
|
UPDATE t1 FOR PORTION OF p FROM '2004-12-20' TO '2022-07-09' SET id = 0;
|
UPDATE t1 SET id = 4;
|
|
# Cleanup
|
DROP TABLE t1;
|
10.4 38f6c47f
|
mysqld: /data/src/10.4/sql/handler.cc:6408: int handler::ha_external_lock(THD*, int): Assertion `next_insert_id == 0' failed.
|
200514 20:18:52 [ERROR] mysqld got signal 6 ;
|
|
#7 0x00007f69cabfbf12 in __GI___assert_fail (assertion=0x55b18f08b287 "next_insert_id == 0", file=0x55b18f0892a9 "/data/src/10.4/sql/handler.cc", line=6408, function=0x55b18f08da40 <handler::ha_external_lock(THD*, int)::__PRETTY_FUNCTION__> "int handler::ha_external_lock(THD*, int)") at assert.c:101
|
#8 0x000055b18e54f1ed in handler::ha_external_lock (this=0x7f69b41335d8, thd=0x7f69b4000af0, lock_type=2) at /data/src/10.4/sql/handler.cc:6408
|
#9 0x000055b18e682c00 in unlock_external (thd=0x7f69b4000af0, table=0x7f69b4013cc0, count=1) at /data/src/10.4/sql/lock.cc:710
|
#10 0x000055b18e681fff in mysql_unlock_tables (thd=0x7f69b4000af0, sql_lock=0x7f69b4013c90, free_lock=false) at /data/src/10.4/sql/lock.cc:431
|
#11 0x000055b18e681f56 in mysql_unlock_tables (thd=0x7f69b4000af0, sql_lock=0x7f69b4013c90) at /data/src/10.4/sql/lock.cc:417
|
#12 0x000055b18e142d52 in close_thread_tables (thd=0x7f69b4000af0) at /data/src/10.4/sql/sql_base.cc:1012
|
#13 0x000055b18e1f1cd8 in mysql_execute_command (thd=0x7f69b4000af0) at /data/src/10.4/sql/sql_parse.cc:6167
|
#14 0x000055b18e1f6b4d in mysql_parse (thd=0x7f69b4000af0, rawbuf=0x7f69b4013198 "UPDATE t1 SET id = 4", length=20, parser_state=0x7f69c4da5570, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7900
|
#15 0x000055b18e1e30fd in dispatch_command (command=COM_QUERY, thd=0x7f69b4000af0, packet=0x7f69b4136221 "UPDATE t1 SET id = 4", packet_length=20, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842
|
#16 0x000055b18e1e189f in do_command (thd=0x7f69b4000af0) at /data/src/10.4/sql/sql_parse.cc:1360
|
#17 0x000055b18e369458 in do_handle_one_connection (connect=0x55b191b53cf0) at /data/src/10.4/sql/sql_connect.cc:1412
|
#18 0x000055b18e3691a7 in handle_one_connection (arg=0x55b191b53cf0) at /data/src/10.4/sql/sql_connect.cc:1316
|
#19 0x000055b18ed6946b in pfs_spawn_thread (arg=0x55b191b6fbf0) at /data/src/10.4/storage/perfschema/pfs.cc:1869
|
#20 0x00007f69ccb844a4 in start_thread (arg=0x7f69c4da6700) at pthread_create.c:456
|
#21 0x00007f69cacb8d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
|
Reproducible on 10.4-10.5 with at least MyISAM and InnoDB.
The test case is not applicable to 10.3.
Non-debug build doesn't crash or produce anything obviously unexpected upon the last UPDATE, but wrong contents caused by MDEV-22414 is present there as well.
{"report":{"fcp":1193.5,"ttfb":319.40000009536743,"pageVisibility":"visible","entityId":86958,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":32,"apdex":0.5,"journeyId":"0fe324f7-b0ea-4fd4-9a66-941f2db9bad1","navigationType":0,"readyForUser":1194.5999999046326,"redirectCount":0,"resourceLoadedEnd":808,"resourceLoadedStart":325.59999990463257,"resourceTiming":[{"duration":115.7000002861023,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":325.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":325.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":441.30000019073486,"responseStart":0,"secureConnectionStart":0},{"duration":116.69999980926514,"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":325.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":325.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":442.59999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":325,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":326.09999990463257,"connectEnd":326.09999990463257,"connectStart":326.09999990463257,"domainLookupEnd":326.09999990463257,"domainLookupStart":326.09999990463257,"fetchStart":326.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":447.7000002861023,"responseEnd":651.0999999046326,"responseStart":460.09999990463257,"secureConnectionStart":326.09999990463257},{"duration":451.7999997138977,"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":326.30000019073486,"connectEnd":326.30000019073486,"connectStart":326.30000019073486,"domainLookupEnd":326.30000019073486,"domainLookupStart":326.30000019073486,"fetchStart":326.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":448,"responseEnd":778.0999999046326,"responseStart":461.40000009536743,"secureConnectionStart":326.30000019073486},{"duration":143.90000009536743,"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":326.5,"connectEnd":326.5,"connectStart":326.5,"domainLookupEnd":326.5,"domainLookupStart":326.5,"fetchStart":326.5,"redirectEnd":0,"redirectStart":0,"requestStart":453.59999990463257,"responseEnd":470.40000009536743,"responseStart":469.09999990463257,"secureConnectionStart":326.5},{"duration":145.69999980926514,"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":326.7000002861023,"connectEnd":326.7000002861023,"connectStart":326.7000002861023,"domainLookupEnd":326.7000002861023,"domainLookupStart":326.7000002861023,"fetchStart":326.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":454.59999990463257,"responseEnd":472.40000009536743,"responseStart":470.7000002861023,"secureConnectionStart":326.7000002861023},{"duration":145.80000019073486,"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":326.90000009536743,"connectEnd":326.90000009536743,"connectStart":326.90000009536743,"domainLookupEnd":326.90000009536743,"domainLookupStart":326.90000009536743,"fetchStart":326.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":455.40000009536743,"responseEnd":472.7000002861023,"responseStart":471.2000002861023,"secureConnectionStart":326.90000009536743},{"duration":127.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":327.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":327.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":454.40000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":152.90000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":327.30000019073486,"connectEnd":327.30000019073486,"connectStart":327.30000019073486,"domainLookupEnd":327.30000019073486,"domainLookupStart":327.30000019073486,"fetchStart":327.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":462.80000019073486,"responseEnd":480.2000002861023,"responseStart":479.09999990463257,"secureConnectionStart":327.30000019073486},{"duration":132.2000002861023,"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":327.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":327.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":459.7000002861023,"responseStart":0,"secureConnectionStart":0},{"duration":165,"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":327.7000002861023,"connectEnd":327.7000002861023,"connectStart":327.7000002861023,"domainLookupEnd":327.7000002861023,"domainLookupStart":327.7000002861023,"fetchStart":327.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":467.30000019073486,"responseEnd":492.7000002861023,"responseStart":491.09999990463257,"secureConnectionStart":327.7000002861023},{"duration":478,"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":328.59999990463257,"connectEnd":328.59999990463257,"connectStart":328.59999990463257,"domainLookupEnd":328.59999990463257,"domainLookupStart":328.59999990463257,"fetchStart":328.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":593.4000000953674,"responseEnd":806.5999999046326,"responseStart":796.9000000953674,"secureConnectionStart":328.59999990463257},{"duration":479.2999997138977,"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":328.7000002861023,"connectEnd":328.7000002861023,"connectStart":328.7000002861023,"domainLookupEnd":328.7000002861023,"domainLookupStart":328.7000002861023,"fetchStart":328.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":683.0999999046326,"responseEnd":808,"responseStart":800.5999999046326,"secureConnectionStart":328.7000002861023},{"duration":158.30000019073486,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":790.4000000953674,"connectEnd":790.4000000953674,"connectStart":790.4000000953674,"domainLookupEnd":790.4000000953674,"domainLookupStart":790.4000000953674,"fetchStart":790.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":915.0999999046326,"responseEnd":948.7000002861023,"responseStart":947.9000000953674,"secureConnectionStart":790.4000000953674}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":128,"responseStart":319,"responseEnd":322,"domLoading":323,"domInteractive":1365,"domContentLoadedEventStart":1365,"domContentLoadedEventEnd":1430,"domComplete":2288,"loadEventStart":2288,"loadEventEnd":2289,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1265.3000001907349},{"name":"bigPipe.sidebar-id.end","time":1266.3000001907349},{"name":"bigPipe.activity-panel-pipe-id.start","time":1266.4000000953674},{"name":"bigPipe.activity-panel-pipe-id.end","time":1268.2000002861023},{"name":"activityTabFullyLoaded","time":1460.5}],"measures":[],"correlationId":"dae754cdf4332f","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":100,"dbReadsTimeInMs":13,"dbConnsTimeInMs":21,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Also without application periods, reproducible on 10.3 as well:
LOCK TABLES t1 WRITE;
UNLOCK TABLES;
# Cleanup
10.3 4e503aec
mysqld: /data/src/10.3/sql/handler.cc:6365: int handler::ha_external_lock(THD*, int): Assertion `next_insert_id == 0' failed.
210123 18:34:16 [ERROR] mysqld got signal 6 ;
#7 0x00007f346d687f36 in __GI___assert_fail (assertion=0x5590eff760e2 "next_insert_id == 0", file=0x5590eff7357e "/data/src/10.3/sql/handler.cc", line=6365, function=0x5590eff760f8 "int handler::ha_external_lock(THD*, int)") at assert.c:101
#8 0x00005590ef4cfc55 in handler::ha_external_lock (this=0x7f3450005028, thd=0x7f344c000d90, lock_type=2) at /data/src/10.3/sql/handler.cc:6365
#9 0x00005590ef60152e in unlock_external (thd=0x7f344c000d90, table=0x7f344c0aeea0, count=1) at /data/src/10.3/sql/lock.cc:708
#10 0x00005590ef600906 in mysql_unlock_tables (thd=0x7f344c000d90, sql_lock=0x7f344c0aee70, free_lock=true) at /data/src/10.3/sql/lock.cc:429
#11 0x00005590ef600859 in mysql_unlock_tables (thd=0x7f344c000d90, sql_lock=0x7f344c0aee70) at /data/src/10.3/sql/lock.cc:413
#12 0x00005590ef0fa207 in close_thread_tables (thd=0x7f344c000d90) at /data/src/10.3/sql/sql_base.cc:854
#13 0x00005590ef0fd652 in Locked_tables_list::unlock_locked_tables (this=0x7f344c004aa0, thd=0x7f344c000d90) at /data/src/10.3/sql/sql_base.cc:2293
#14 0x00005590ef19ad68 in mysql_execute_command (thd=0x7f344c000d90) at /data/src/10.3/sql/sql_parse.cc:4940
#15 0x00005590ef1a4b88 in mysql_parse (thd=0x7f344c000d90, rawbuf=0x7f344c012ab8 "UNLOCK TABLES", length=13, parser_state=0x7f34680945c0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7840
#16 0x00005590ef1912ec in dispatch_command (command=COM_QUERY, thd=0x7f344c000d90, packet=0x7f344c008f11 "UNLOCK TABLES", packet_length=13, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1852
#17 0x00005590ef18fc8c in do_command (thd=0x7f344c000d90) at /data/src/10.3/sql/sql_parse.cc:1398
#18 0x00005590ef30e295 in do_handle_one_connection (connect=0x5590f3002070) at /data/src/10.3/sql/sql_connect.cc:1403
#19 0x00005590ef30dff1 in handle_one_connection (arg=0x5590f3002070) at /data/src/10.3/sql/sql_connect.cc:1308
#20 0x00005590efcd9eb3 in pfs_spawn_thread (arg=0x5590f2fe5440) at /data/src/10.3/storage/perfschema/pfs.cc:1869
#21 0x00007f346db97609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#22 0x00007f346d773293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95