#8 0x000055944571b007 in btr_cur_upd_rec_in_place (rec=0x7fe115d200b0 "\200", index=0x7fe0dc19f7f0, offsets=0x7fe115565390, update=0x7fe0dc09a740, block=0x7fe11582cde0, mtr=0x7fe1155655f0) at /data/src/10.5/storage/innobase/btr/btr0cur.cc:4139
#9 0x000055944571c276 in btr_cur_update_in_place (flags=0, cursor=0x7fe115565290, offsets=0x7fe115565390, update=0x7fe0dc09a740, cmpl_info=0, thr=0x7fe0dc068518, trx_id=36, mtr=0x7fe1155655f0) at /data/src/10.5/storage/innobase/btr/btr0cur.cc:4315
#10 0x000055944571dd47 in btr_cur_optimistic_update (flags=0, cursor=0x7fe115565290, offsets=0x7fe115565228, heap=0x7fe115565220, update=0x7fe0dc09a740, cmpl_info=0, thr=0x7fe0dc068518, trx_id=36, mtr=0x7fe1155655f0) at /data/src/10.5/storage/innobase/btr/btr0cur.cc:4559
#11 0x00005594455c94c9 in row_ins_clust_index_entry_by_modify (pcur=0x7fe115565290, flags=0, mode=2, offsets=0x7fe115565228, offsets_heap=0x7fe115565220, heap=0x7fe0dc09a6c0, entry=0x7fe0dc09a2d0, thr=0x7fe0dc068518, mtr=0x7fe1155655f0) at /data/src/10.5/storage/innobase/row/row0ins.cc:365
#12 0x00005594455cff33 in row_ins_clust_index_entry_low (flags=0, mode=2, index=0x7fe0dc19f7f0, n_uniq=1, entry=0x7fe0dc09a2d0, n_ext=0, thr=0x7fe0dc068518) at /data/src/10.5/storage/innobase/row/row0ins.cc:2743
#13 0x00005594455d1955 in row_ins_clust_index_entry (index=0x7fe0dc19f7f0, entry=0x7fe0dc09a2d0, thr=0x7fe0dc068518, n_ext=0) at /data/src/10.5/storage/innobase/row/row0ins.cc:3236
#14 0x0000559445656da8 in row_upd_clust_rec_by_insert (node=0x7fe0dc0681e0, index=0x7fe0dc19f7f0, thr=0x7fe0dc068518, referenced=0, foreign=false, mtr=0x7fe1155662b0) at /data/src/10.5/storage/innobase/row/row0upd.cc:2510
#15 0x00005594456584f7 in row_upd_clust_step (node=0x7fe0dc0681e0, thr=0x7fe0dc068518) at /data/src/10.5/storage/innobase/row/row0upd.cc:2928
#16 0x00005594456588dd in row_upd (node=0x7fe0dc0681e0, thr=0x7fe0dc068518) at /data/src/10.5/storage/innobase/row/row0upd.cc:3002
#17 0x0000559445658ea3 in row_upd_step (thr=0x7fe0dc068518) at /data/src/10.5/storage/innobase/row/row0upd.cc:3146
#18 0x00005594455f8eb3 in row_update_for_mysql (prebuilt=0x7fe0dc0676b0) at /data/src/10.5/storage/innobase/row/row0mysql.cc:1889
#19 0x000055944545224e in ha_innobase::update_row (this=0x7fe0dc00a658, old_row=0x7fe0dc19ee30 "\245\003", new_row=0x7fe0dc19ee20 "\375\002") at /data/src/10.5/storage/innobase/handler/ha_innodb.cc:8569
#20 0x000055944504747b in handler::ha_update_row (this=0x7fe0dc00a658, old_data=0x7fe0dc19ee30 "\245\003", new_data=0x7fe0dc19ee20 "\375\002") at /data/src/10.5/sql/handler.cc:6702
#21 0x0000559444ca2079 in write_record (thd=0x7fe0dc000b00, table=0x7fe0dc06a2a0, info=0x7fe115566c60, sink=0x0) at /data/src/10.5/sql/sql_insert.cc:1976
#22 0x0000559444c9f402 in mysql_insert (thd=0x7fe0dc000b00, table_list=0x7fe0dc0135a0, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_REPLACE, ignore=false, result=0x0) at /data/src/10.5/sql/sql_insert.cc:1081
#23 0x0000559444cf0543 in mysql_execute_command (thd=0x7fe0dc000b00) at /data/src/10.5/sql/sql_parse.cc:4505
#24 0x0000559444cfc45c in mysql_parse (thd=0x7fe0dc000b00, rawbuf=0x7fe0dc0134a8 "REPLACE INTO t1 (pk) VALUES (2),(3),(2)", length=39, parser_state=0x7fe115567570, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:7918
#25 0x0000559444ce8105 in dispatch_command (command=COM_QUERY, thd=0x7fe0dc000b00, packet=0x7fe0dc158111 "REPLACE INTO t1 (pk) VALUES (2),(3),(2)", packet_length=39, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:1845
#26 0x0000559444ce684c in do_command (thd=0x7fe0dc000b00) at /data/src/10.5/sql/sql_parse.cc:1364
#27 0x0000559444e869a9 in do_handle_one_connection (connect=0x559449149c30, put_in_cache=true) at /data/src/10.5/sql/sql_connect.cc:1422
#28 0x0000559444e866d8 in handle_one_connection (arg=0x559449149c30) at /data/src/10.5/sql/sql_connect.cc:1319
#29 0x00005594453e3183 in pfs_spawn_thread (arg=0x5594490cb650) at /data/src/10.5/storage/perfschema/pfs.cc:1869
#30 0x00007fe11e15b4a4 in start_thread (arg=0x7fe115568700) at pthread_create.c:456
#31 0x00007fe11c28fd0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
Appeared recently, I didn't bisect for the exact revision.
The failing assertion was introduced along with the physical logging of INSERT operations. Some code changes are needed, because the assertion is documenting an assumption that turns out to be invalid.
Here is a simpler test case:
--source include/have_innodb.inc
CREATETABLE t1 (pk INTPRIMARYKEY) ENGINE=InnoDB;
INSERTINTO t1 (pk) VALUES (1);
ALTERTABLE t1 ADDCOLUMN b INT;
BEGIN;
UPDATE t1 SET pk=2;
UPDATE t1 SET pk=1;
COMMIT;
connect (con1,localhost,root);
SELECT * FROM t1;
disconnect con1;
connectiondefault;
DROPTABLE t1;
The wrong assumption (and assertion) is duplicated in two places: updating the record, and reconstructing an earlier version of the record:
if (UNIV_UNLIKELY(dfield_is_null(&uf->new_val))) {
- ut_ad(!rec_offs_nth_sql_null(offsets, n));
+ if (rec_offs_nth_sql_null(offsets, n)) {
+ ut_ad(index->table->is_instant());
+ ut_ad(n >= index->n_core_fields);
+ continue;
+ }
ut_ad(!index->table->not_redundant());
ulint l = rec_get_1byte_offs_flag(*old_vers)
? (n + 1) : (n + 1) * 2;
Marko Mäkelä
added a comment - - edited The failing assertion was introduced along with the physical logging of INSERT operations . Some code changes are needed, because the assertion is documenting an assumption that turns out to be invalid.
Here is a simpler test case:
--source include/have_innodb.inc
CREATE TABLE t1 (pk INT PRIMARY KEY ) ENGINE=InnoDB;
INSERT INTO t1 (pk) VALUES (1);
ALTER TABLE t1 ADD COLUMN b INT ;
BEGIN ;
UPDATE t1 SET pk=2;
UPDATE t1 SET pk=1;
COMMIT ;
connect (con1,localhost,root);
SELECT * FROM t1;
disconnect con1;
connection default ;
DROP TABLE t1;
The wrong assumption (and assertion) is duplicated in two places: updating the record, and reconstructing an earlier version of the record:
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index 186f75dd792..cc7640de010 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -4405,7 +4405,12 @@ void btr_cur_upd_rec_in_place(rec_t *rec, const dict_index_t *index,
ut_ad(!rec_offs_nth_default(offsets, n));
if (UNIV_UNLIKELY(dfield_is_null(&uf->new_val))) {
- ut_ad(!rec_offs_nth_sql_null(offsets, n));
+ if (rec_offs_nth_sql_null(offsets, n)) {
+ ut_ad(index->table->is_instant());
+ ut_ad(n >= index->n_core_fields);
+ continue;
+ }
+
ut_ad(!index->table->not_redundant());
mtr->memset(block,
page_offset(rec + rec_get_field_start_offs(
diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc
index d215b07e3a3..16ebe174a4c 100644
--- a/storage/innobase/trx/trx0rec.cc
+++ b/storage/innobase/trx/trx0rec.cc
@@ -2455,7 +2455,11 @@ trx_undo_prev_version_build(
ut_ad(!rec_offs_nth_default(offsets, n));
if (UNIV_UNLIKELY(dfield_is_null(&uf->new_val))) {
- ut_ad(!rec_offs_nth_sql_null(offsets, n));
+ if (rec_offs_nth_sql_null(offsets, n)) {
+ ut_ad(index->table->is_instant());
+ ut_ad(n >= index->n_core_fields);
+ continue;
+ }
ut_ad(!index->table->not_redundant());
ulint l = rec_get_1byte_offs_flag(*old_vers)
? (n + 1) : (n + 1) * 2;
People
Marko Mäkelä
Elena Stepanova
Votes:
0Vote for this issue
Watchers:
2Start watching this issue
Dates
Created:
Updated:
Resolved:
Git Integration
Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.
{"report":{"fcp":1999.4000000953674,"ttfb":445.59999990463257,"pageVisibility":"visible","entityId":83290,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":32,"apdex":0.5,"journeyId":"2eafb3d3-84b9-411a-b952-9b1b3ba0157f","navigationType":0,"readyForUser":2124.4000000953674,"redirectCount":0,"resourceLoadedEnd":2468.0999999046326,"resourceLoadedStart":451.30000019073486,"resourceTiming":[{"duration":873,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":451.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":451.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1324.3000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":873.1000003814697,"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":451.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":451.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1324.7000002861023,"responseStart":0,"secureConnectionStart":0},{"duration":977.0999999046326,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":451.80000019073486,"connectEnd":451.80000019073486,"connectStart":451.80000019073486,"domainLookupEnd":451.80000019073486,"domainLookupStart":451.80000019073486,"fetchStart":451.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":451.80000019073486,"responseEnd":1428.9000000953674,"responseStart":1428.9000000953674,"secureConnectionStart":451.80000019073486},{"duration":1070.5999999046326,"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":452,"connectEnd":452,"connectStart":452,"domainLookupEnd":452,"domainLookupStart":452,"fetchStart":452,"redirectEnd":0,"redirectStart":0,"requestStart":452,"responseEnd":1522.5999999046326,"responseStart":1522.5999999046326,"secureConnectionStart":452},{"duration":1074.0999999046326,"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":452.2000002861023,"connectEnd":452.2000002861023,"connectStart":452.2000002861023,"domainLookupEnd":452.2000002861023,"domainLookupStart":452.2000002861023,"fetchStart":452.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":452.2000002861023,"responseEnd":1526.3000001907349,"responseStart":1526.3000001907349,"secureConnectionStart":452.2000002861023},{"duration":1094.8000001907349,"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":452.40000009536743,"connectEnd":452.40000009536743,"connectStart":452.40000009536743,"domainLookupEnd":452.40000009536743,"domainLookupStart":452.40000009536743,"fetchStart":452.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":452.40000009536743,"responseEnd":1547.2000002861023,"responseStart":1547.2000002861023,"secureConnectionStart":452.40000009536743},{"duration":1094.9000000953674,"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":452.59999990463257,"connectEnd":452.59999990463257,"connectStart":452.59999990463257,"domainLookupEnd":452.59999990463257,"domainLookupStart":452.59999990463257,"fetchStart":452.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":452.59999990463257,"responseEnd":1547.5,"responseStart":1547.5,"secureConnectionStart":452.59999990463257},{"duration":1170.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":452.80000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":452.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1623,"responseStart":0,"secureConnectionStart":0},{"duration":1095,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":453,"connectEnd":453,"connectStart":453,"domainLookupEnd":453,"domainLookupStart":453,"fetchStart":453,"redirectEnd":0,"redirectStart":0,"requestStart":453,"responseEnd":1548,"responseStart":1548,"secureConnectionStart":453},{"duration":1170.1000003814697,"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":453.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":453.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1623.2000002861023,"responseStart":0,"secureConnectionStart":0},{"duration":1095.2999997138977,"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":453.2000002861023,"connectEnd":453.2000002861023,"connectStart":453.2000002861023,"domainLookupEnd":453.2000002861023,"domainLookupStart":453.2000002861023,"fetchStart":453.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":453.2000002861023,"responseEnd":1548.5,"responseStart":1548.5,"secureConnectionStart":453.2000002861023},{"duration":1768.3000001907349,"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":462.90000009536743,"connectEnd":462.90000009536743,"connectStart":462.90000009536743,"domainLookupEnd":462.90000009536743,"domainLookupStart":462.90000009536743,"fetchStart":462.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":462.90000009536743,"responseEnd":2231.2000002861023,"responseStart":2231.0999999046326,"secureConnectionStart":462.90000009536743},{"duration":2005.0999999046326,"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":463,"connectEnd":463,"connectStart":463,"domainLookupEnd":463,"domainLookupStart":463,"fetchStart":463,"redirectEnd":0,"redirectStart":0,"requestStart":463,"responseEnd":2468.0999999046326,"responseStart":2468.0999999046326,"secureConnectionStart":463},{"duration":559,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1681.3000001907349,"connectEnd":1681.3000001907349,"connectStart":1681.3000001907349,"domainLookupEnd":1681.3000001907349,"domainLookupStart":1681.3000001907349,"fetchStart":1681.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":1681.3000001907349,"responseEnd":2240.300000190735,"responseStart":2240.300000190735,"secureConnectionStart":1681.3000001907349},{"duration":519.2000002861023,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1988.5999999046326,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1988.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":2507.800000190735,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":264,"responseStart":446,"responseEnd":459,"domLoading":450,"domInteractive":2543,"domContentLoadedEventStart":2543,"domContentLoadedEventEnd":2616,"domComplete":2868,"loadEventStart":2868,"loadEventEnd":2869,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":2475.4000000953674},{"name":"bigPipe.sidebar-id.end","time":2476.4000000953674},{"name":"bigPipe.activity-panel-pipe-id.start","time":2476.7000002861023},{"name":"bigPipe.activity-panel-pipe-id.end","time":2479.5999999046326},{"name":"activityTabFullyLoaded","time":2639.300000190735}],"measures":[],"correlationId":"179df39828150b","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":111,"dbReadsTimeInMs":17,"dbConnsTimeInMs":27,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
The test does not fail immediately before
MDEV-12353. So, MariaDB 10.5.1 is unaffected by this.