Table corruption or Assertion `bitmap_is_set(&(m_part_info->read_partitions), part_id)' failed upon multi-update on a versioned partitioned table
--source include/have_partition.inc
|
|
CREATE TABLE t1 (a INT);
|
INSERT INTO t1 VALUES (0),(1);
|
|
CREATE TABLE t2 (b INT) WITH SYSTEM VERSIONING PARTITION BY system_time INTERVAL 1 WEEK (PARTITION p1 HISTORY, PARTITION pn CURRENT);
|
INSERT INTO t2 VALUES (0),(2);
|
|
UPDATE t1 LEFT JOIN t2 ON a > b SET b = 2 ORDER BY b;
|
|
# Cleanup
|
DROP TABLE t1, t2;
|
10.3 2842c369 debug
|
mysqld: /data/src/10.3/sql/ha_partition.cc:5199: virtual int ha_partition::rnd_pos(uchar*, uchar*): Assertion `bitmap_is_set(&(m_part_info->read_partitions), part_id)' failed.
|
190906 16:25:25 [ERROR] mysqld got signal 6 ;
|
|
#7 0x00007fa4abf42f12 in __GI___assert_fail (assertion=0x564bc5871a90 "bitmap_is_set(&(m_part_info->read_partitions), part_id)", file=0x564bc5870688 "/data/src/10.3/sql/ha_partition.cc", line=5199, function=0x564bc5874c00 <ha_partition::rnd_pos(unsigned char*, unsigned char*)::__PRETTY_FUNCTION__> "virtual int ha_partition::rnd_pos(uchar*, uchar*)") at assert.c:101
|
#8 0x0000564bc54025c2 in ha_partition::rnd_pos (this=0x7fa494182458, buf=0x7fa494184ff8 "\375\002", pos=0x7fa49403c159 "") at /data/src/10.3/sql/ha_partition.cc:5199
|
#9 0x0000564bc4bac460 in handler::ha_rnd_pos (this=0x7fa494182458, buf=0x7fa494184ff8 "\375\002", pos=0x7fa49403c159 "") at /data/src/10.3/sql/handler.cc:2872
|
#10 0x0000564bc49926f4 in multi_update::do_updates (this=0x7fa4940144e8) at /data/src/10.3/sql/sql_update.cc:2669
|
#11 0x0000564bc4992ffa in multi_update::send_eof (this=0x7fa4940144e8) at /data/src/10.3/sql/sql_update.cc:2832
|
#12 0x0000564bc49004f1 in do_select (join=0x7fa4940145c0, procedure=0x0) at /data/src/10.3/sql/sql_select.cc:19100
|
#13 0x0000564bc48d716f in JOIN::exec_inner (this=0x7fa4940145c0) at /data/src/10.3/sql/sql_select.cc:4044
|
#14 0x0000564bc48d6534 in JOIN::exec (this=0x7fa4940145c0) at /data/src/10.3/sql/sql_select.cc:3838
|
#15 0x0000564bc48d7853 in mysql_select (thd=0x7fa494000b00, tables=0x7fa494012930, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x7fa494014400, group=0x0, having=0x0, proc_param=0x0, select_options=1342177408, result=0x7fa4940144e8, unit=0x7fa4940049d0, select_lex=0x7fa494005150) at /data/src/10.3/sql/sql_select.cc:4243
|
#16 0x0000564bc498f44e in mysql_multi_update (thd=0x7fa494000b00, table_list=0x7fa494012930, fields=0x7fa494005278, values=0x7fa494005780, conds=0x0, options=0, handle_duplicates=DUP_ERROR, ignore=false, unit=0x7fa4940049d0, select_lex=0x7fa494005150, result=0x7fa4a6140fd0) at /data/src/10.3/sql/sql_update.cc:1789
|
#17 0x0000564bc4888b91 in mysql_execute_command (thd=0x7fa494000b00) at /data/src/10.3/sql/sql_parse.cc:4366
|
#18 0x0000564bc48949ff in mysql_parse (thd=0x7fa494000b00, rawbuf=0x7fa494012818 "UPDATE t1 LEFT JOIN t2 ON a > b SET b = 2 ORDER BY b", length=52, parser_state=0x7fa4a61415e0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7830
|
#19 0x0000564bc48812fd in dispatch_command (command=COM_QUERY, thd=0x7fa494000b00, packet=0x7fa494008c71 "UPDATE t1 LEFT JOIN t2 ON a > b SET b = 2 ORDER BY b", packet_length=52, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1856
|
#20 0x0000564bc487fc24 in do_command (thd=0x7fa494000b00) at /data/src/10.3/sql/sql_parse.cc:1401
|
#21 0x0000564bc49f8b94 in do_handle_one_connection (connect=0x564bc742c130) at /data/src/10.3/sql/sql_connect.cc:1403
|
#22 0x0000564bc49f88f6 in handle_one_connection (arg=0x564bc742c130) at /data/src/10.3/sql/sql_connect.cc:1308
|
#23 0x0000564bc53db060 in pfs_spawn_thread (arg=0x564bc74470b0) at /data/src/10.3/storage/perfschema/pfs.cc:1862
|
#24 0x00007fa4adab74a4 in start_thread (arg=0x7fa4a6142700) at pthread_create.c:456
|
#25 0x00007fa4abfffd0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
|
Reproducible with at least MyISAM, InnoDB, Aria.
Non-debug builds don't crash, but produce corruption-like messages, different for different engine.
MyISAM: ER_KEY_NOT_FOUND
|
mysqltest: At line 9: query 'UPDATE t1 LEFT JOIN t2 ON a > b SET b = 2 ORDER BY b' failed: 1032: Can't find record in 't2'
|
InnoDB: ER_NOT_KEYFILE
|
mysqltest: At line 9: query 'UPDATE t1 LEFT JOIN t2 ON a > b SET b = 2 ORDER BY b' failed: 1034: Index for table 't2' is corrupt; try to repair it
|
Aria: ER_GET_ERRNO
|
mysqltest: At line 9: query 'UPDATE t1 LEFT JOIN t2 ON a > b SET b = 2 ORDER BY b' failed: 1030: Got error 176 "Read page with wrong checksum" from storage engine Aria
|
{"report":{"fcp":1598.3000001907349,"ttfb":290.20000076293945,"pageVisibility":"visible","entityId":78777,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"57d8d938-df3c-493c-88f4-faff5a529e35","navigationType":0,"readyForUser":1747.1000003814697,"redirectCount":0,"resourceLoadedEnd":1858.6000003814697,"resourceLoadedStart":295.6000003814697,"resourceTiming":[{"duration":535.3000001907349,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":295.6000003814697,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":295.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":830.9000005722046,"responseStart":0,"secureConnectionStart":0},{"duration":535.4000005722046,"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":296,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":296,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":831.4000005722046,"responseStart":0,"secureConnectionStart":0},{"duration":606.0999994277954,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":296.20000076293945,"connectEnd":296.20000076293945,"connectStart":296.20000076293945,"domainLookupEnd":296.20000076293945,"domainLookupStart":296.20000076293945,"fetchStart":296.20000076293945,"redirectEnd":0,"redirectStart":0,"requestStart":296.20000076293945,"responseEnd":902.3000001907349,"responseStart":902.3000001907349,"secureConnectionStart":296.20000076293945},{"duration":767.3000001907349,"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":296.30000019073486,"connectEnd":296.30000019073486,"connectStart":296.30000019073486,"domainLookupEnd":296.30000019073486,"domainLookupStart":296.30000019073486,"fetchStart":296.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":296.30000019073486,"responseEnd":1063.6000003814697,"responseStart":1063.5,"secureConnectionStart":296.30000019073486},{"duration":770.6000003814697,"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":296.6000003814697,"connectEnd":296.6000003814697,"connectStart":296.6000003814697,"domainLookupEnd":296.6000003814697,"domainLookupStart":296.6000003814697,"fetchStart":296.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":296.6000003814697,"responseEnd":1067.2000007629395,"responseStart":1067.2000007629395,"secureConnectionStart":296.6000003814697},{"duration":771,"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":296.9000005722046,"connectEnd":296.9000005722046,"connectStart":296.9000005722046,"domainLookupEnd":296.9000005722046,"domainLookupStart":296.9000005722046,"fetchStart":296.9000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":296.9000005722046,"responseEnd":1067.9000005722046,"responseStart":1067.9000005722046,"secureConnectionStart":296.9000005722046},{"duration":771.1999998092651,"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":297.1000003814697,"connectEnd":297.1000003814697,"connectStart":297.1000003814697,"domainLookupEnd":297.1000003814697,"domainLookupStart":297.1000003814697,"fetchStart":297.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":297.1000003814697,"responseEnd":1068.3000001907349,"responseStart":1068.3000001907349,"secureConnectionStart":297.1000003814697},{"duration":838.1999998092651,"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":297.20000076293945,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":297.20000076293945,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1135.4000005722046,"responseStart":0,"secureConnectionStart":0},{"duration":771.5,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":297.4000005722046,"connectEnd":297.4000005722046,"connectStart":297.4000005722046,"domainLookupEnd":297.4000005722046,"domainLookupStart":297.4000005722046,"fetchStart":297.4000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":297.4000005722046,"responseEnd":1068.9000005722046,"responseStart":1068.9000005722046,"secureConnectionStart":297.4000005722046},{"duration":838,"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":297.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":297.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1135.5,"responseStart":0,"secureConnectionStart":0},{"duration":772.3999996185303,"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":297.70000076293945,"connectEnd":297.70000076293945,"connectStart":297.70000076293945,"domainLookupEnd":297.70000076293945,"domainLookupStart":297.70000076293945,"fetchStart":297.70000076293945,"redirectEnd":0,"redirectStart":0,"requestStart":297.70000076293945,"responseEnd":1070.1000003814697,"responseStart":1070,"secureConnectionStart":297.70000076293945},{"duration":1017.0999994277954,"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":307.20000076293945,"connectEnd":307.20000076293945,"connectStart":307.20000076293945,"domainLookupEnd":307.20000076293945,"domainLookupStart":307.20000076293945,"fetchStart":307.20000076293945,"redirectEnd":0,"redirectStart":0,"requestStart":307.20000076293945,"responseEnd":1324.3000001907349,"responseStart":1324.3000001907349,"secureConnectionStart":307.20000076293945},{"duration":1435.1999998092651,"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":307.30000019073486,"connectEnd":307.30000019073486,"connectStart":307.30000019073486,"domainLookupEnd":307.30000019073486,"domainLookupStart":307.30000019073486,"fetchStart":307.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":307.30000019073486,"responseEnd":1742.5,"responseStart":1742.5,"secureConnectionStart":307.30000019073486},{"duration":164.39999961853027,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1160.6000003814697,"connectEnd":1160.6000003814697,"connectStart":1160.6000003814697,"domainLookupEnd":1160.6000003814697,"domainLookupStart":1160.6000003814697,"fetchStart":1160.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":1160.6000003814697,"responseEnd":1325,"responseStart":1325,"secureConnectionStart":1160.6000003814697},{"duration":312.1000003814697,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/css/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":1489.1000003814697,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1489.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1801.2000007629395,"responseStart":0,"secureConnectionStart":0},{"duration":365.6000003814697,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-project.issue.navigator,-jira.view.issue,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":1490.6000003814697,"connectEnd":1490.6000003814697,"connectStart":1490.6000003814697,"domainLookupEnd":1490.6000003814697,"domainLookupStart":1490.6000003814697,"fetchStart":1490.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":1490.6000003814697,"responseEnd":1856.2000007629395,"responseStart":1856.2000007629395,"secureConnectionStart":1490.6000003814697},{"duration":294.79999923706055,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1590.2000007629395,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1590.2000007629395,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1885,"responseStart":0,"secureConnectionStart":0},{"duration":367.6000003814697,"initiatorType":"script","name":"https://jira.mariadb.org/s/097ae97cb8fbec7d6ea4bbb1f26955b9-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/js/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":1491,"connectEnd":1491,"connectStart":1491,"domainLookupEnd":1491,"domainLookupStart":1491,"fetchStart":1491,"redirectEnd":0,"redirectStart":0,"requestStart":1491,"responseEnd":1858.6000003814697,"responseStart":1858.6000003814697,"secureConnectionStart":1491}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":105,"responseStart":290,"responseEnd":302,"domLoading":294,"domInteractive":1889,"domContentLoadedEventStart":1889,"domContentLoadedEventEnd":1981,"domComplete":2331,"loadEventStart":2331,"loadEventEnd":2332,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1827.9000005722046},{"name":"bigPipe.sidebar-id.end","time":1828.8000001907349},{"name":"bigPipe.activity-panel-pipe-id.start","time":1829},{"name":"bigPipe.activity-panel-pipe-id.end","time":1831.3000001907349},{"name":"activityTabFullyLoaded","time":2019.5}],"measures":[],"correlationId":"9a500031606fcc","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":116,"dbReadsTimeInMs":19,"dbConnsTimeInMs":29,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Cause
Join tmp table inserts null row because of OUTER JOIN, that's expected. Since multi_update::prepare2() converted Item_temptable_rowid into Item_field (
MDEV-14551) multi_update::send_data() accesses join tmp record directly and treats it as a normal row ignoring null status of ref field. NULL ref field is then treated as normal in multi_update::do_updates() which tries to position updated table by reference 0.Fix
Don't add row into multi-update tmp table in case of null ref field. Join tmp table does not have null_row status at this time (as well as STATUS_NULL_ROW), but it has all null fields (including ref field).
Anlysis