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":988.5,"ttfb":193.60000002384186,"pageVisibility":"visible","entityId":86958,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"6d2996fc-a174-45e8-9ed0-ca1f9a6bc5e6","navigationType":0,"readyForUser":1063.7000000476837,"redirectCount":0,"resourceLoadedEnd":717.3000000715256,"resourceLoadedStart":201,"resourceTiming":[{"duration":19.600000023841858,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":201,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":201,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":220.60000002384186,"responseStart":0,"secureConnectionStart":0},{"duration":19.699999928474426,"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":201.20000004768372,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":201.20000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":220.89999997615814,"responseStart":0,"secureConnectionStart":0},{"duration":378,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":201.39999997615814,"connectEnd":201.39999997615814,"connectStart":201.39999997615814,"domainLookupEnd":201.39999997615814,"domainLookupStart":201.39999997615814,"fetchStart":201.39999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":225,"responseEnd":579.3999999761581,"responseStart":346.7000000476837,"secureConnectionStart":201.39999997615814},{"duration":515.9000000953674,"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":201.39999997615814,"connectEnd":201.39999997615814,"connectStart":201.39999997615814,"domainLookupEnd":201.39999997615814,"domainLookupStart":201.39999997615814,"fetchStart":201.39999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":225.20000004768372,"responseEnd":717.3000000715256,"responseStart":396.10000002384186,"secureConnectionStart":201.39999997615814},{"duration":149.60000002384186,"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":201.5,"connectEnd":201.5,"connectStart":201.5,"domainLookupEnd":201.5,"domainLookupStart":201.5,"fetchStart":201.5,"redirectEnd":0,"redirectStart":0,"requestStart":225.60000002384186,"responseEnd":351.10000002384186,"responseStart":348.10000002384186,"secureConnectionStart":201.5},{"duration":158.20000004768372,"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":201.60000002384186,"connectEnd":201.60000002384186,"connectStart":201.60000002384186,"domainLookupEnd":201.60000002384186,"domainLookupStart":201.60000002384186,"fetchStart":201.60000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":225.60000002384186,"responseEnd":359.8000000715256,"responseStart":357.39999997615814,"secureConnectionStart":201.60000002384186},{"duration":163.39999997615814,"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":201.70000004768372,"connectEnd":201.70000004768372,"connectStart":201.70000004768372,"domainLookupEnd":201.70000004768372,"domainLookupStart":201.70000004768372,"fetchStart":201.70000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":226.20000004768372,"responseEnd":365.10000002384186,"responseStart":360,"secureConnectionStart":201.70000004768372},{"duration":24.299999952316284,"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":201.80000007152557,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":201.80000007152557,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":226.10000002384186,"responseStart":0,"secureConnectionStart":0},{"duration":163.5,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":201.89999997615814,"connectEnd":201.89999997615814,"connectStart":201.89999997615814,"domainLookupEnd":201.89999997615814,"domainLookupStart":201.89999997615814,"fetchStart":201.89999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":228.5,"responseEnd":365.39999997615814,"responseStart":361.3000000715256,"secureConnectionStart":201.89999997615814},{"duration":25.100000023841858,"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":202,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":202,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":227.10000002384186,"responseStart":0,"secureConnectionStart":0},{"duration":163.60000002384186,"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":202.10000002384186,"connectEnd":202.10000002384186,"connectStart":202.10000002384186,"domainLookupEnd":202.10000002384186,"domainLookupStart":202.10000002384186,"fetchStart":202.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":229.39999997615814,"responseEnd":365.7000000476837,"responseStart":362.89999997615814,"secureConnectionStart":202.10000002384186},{"duration":457.10000002384186,"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":202.89999997615814,"connectEnd":202.89999997615814,"connectStart":202.89999997615814,"domainLookupEnd":202.89999997615814,"domainLookupStart":202.89999997615814,"fetchStart":202.89999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":237,"responseEnd":660,"responseStart":652.5,"secureConnectionStart":202.89999997615814},{"duration":457.60000002384186,"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":202.89999997615814,"connectEnd":202.89999997615814,"connectStart":202.89999997615814,"domainLookupEnd":202.89999997615814,"domainLookupStart":202.89999997615814,"fetchStart":202.89999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":240.39999997615814,"responseEnd":660.5,"responseStart":655.2000000476837,"secureConnectionStart":202.89999997615814},{"duration":118,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":726.7000000476837,"connectEnd":726.7000000476837,"connectStart":726.7000000476837,"domainLookupEnd":726.7000000476837,"domainLookupStart":726.7000000476837,"fetchStart":726.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":809.1000000238419,"responseEnd":844.7000000476837,"responseStart":843.7000000476837,"secureConnectionStart":726.7000000476837},{"duration":188.70000004768372,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":939.1000000238419,"connectEnd":939.1000000238419,"connectStart":939.1000000238419,"domainLookupEnd":939.1000000238419,"domainLookupStart":939.1000000238419,"fetchStart":939.1000000238419,"redirectEnd":0,"redirectStart":0,"requestStart":1095,"responseEnd":1127.8000000715256,"responseStart":1124.6000000238419,"secureConnectionStart":939.1000000238419},{"duration":128,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":976.7000000476837,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":976.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1104.7000000476837,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":24,"responseStart":194,"responseEnd":199,"domLoading":197,"domInteractive":1167,"domContentLoadedEventStart":1167,"domContentLoadedEventEnd":1216,"domComplete":1597,"loadEventStart":1597,"loadEventEnd":1598,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1140},{"name":"bigPipe.sidebar-id.end","time":1140.8999999761581},{"name":"bigPipe.activity-panel-pipe-id.start","time":1141},{"name":"bigPipe.activity-panel-pipe-id.end","time":1142.8000000715256},{"name":"activityTabFullyLoaded","time":1233.3000000715256}],"measures":[],"correlationId":"1fa48bbcc77926","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":101,"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