Open midenok opened 3 years ago
--- a/storage/innobase/trx/trx0rec.cc
+++ b/storage/innobase/trx/trx0rec.cc
@@ -1204,10 +1204,12 @@ trx_undo_page_report_modify(
const dict_col_t* col
= dict_table_get_nth_col(table, col_no);
- if (!col->ord_part) {
+ if (!col->ord_part && !col->vers_sys_end()) {
continue;
}
+ ut_ad(!col->vers_sys_end() || table->versioned());
+
const ulint pos = dict_index_get_nth_col_pos(
index, col_no, NULL);
/* All non-virtual columns must be present in
#0 trx_undo_page_report_modify (undo_block=0x7f480f2ab200, trx=0x7f480fb000c0, index=0x7f47a4023ff8, rec=0x7f480f7e407f "", offsets=0x7f47a40485f8, update=0x7f47a4045da8, cmpl_info=0, row=0x0, mtr=0x7f480c051a40) at /home/midenok/src/mariadb/10.3/src/storage/innobase/trx/trx0rec.cc:1314
#1 0x00000000010bb131 in trx_undo_report_row_operation (thr=0x7f47a4046028, index=0x7f47a4023ff8, clust_entry=0x0, update=0x7f47a4045da8, cmpl_info=0, rec=0x7f480f7e407f "", offsets=0x7f47a40485f8, roll_ptr=0x7f480c052158) at /home/midenok/src/mariadb/10.3/src/storage/innobase/trx/trx0rec.cc:2030
#2 0x00000000011356e7 in btr_cur_upd_lock_and_undo (flags=10, cursor=0x7f47a401e340, offsets=0x7f47a40485f8, update=0x7f47a4045da8, cmpl_info=0, thr=0x7f47a4046028, mtr=0x7f480c052750, roll_ptr=0x7f480c052158) at /home/midenok/src/mariadb/10.3/src/storage/innobase/btr/btr0cur.cc:3806
#3 0x0000000001139068 in btr_cur_pessimistic_update (flags=10, cursor=0x7f47a401e340, offsets=0x7f480c052350, offsets_heap=0x7f480c052740, entry_heap=0x7f47a4048840, big_rec=0x7f480c052330, update=0x7f47a4045da8, cmpl_info=0, thr=0x7f47a4046028, trx_id=43, mtr=0x7f480c052750) at /home/midenok/src/mariadb/10.3/src/storage/innobase/btr/btr0cur.cc:4783
#4 0x000000000105588a in row_upd_clust_rec (flags=0, node=0x7f47a40435b0, index=0x7f47a4023ff8, offsets=0x7f47a40485f8, offsets_heap=0x7f480c052740, thr=0x7f47a4046028, mtr=0x7f480c052750) at /home/midenok/src/mariadb/10.3/src/storage/innobase/row/row0upd.cc:2942
#5 0x000000000105427c in row_upd_clust_step (node=0x7f47a40435b0, thr=0x7f47a4046028) at /home/midenok/src/mariadb/10.3/src/storage/innobase/row/row0upd.cc:3243
#6 0x0000000001050532 in row_upd (node=0x7f47a40435b0, thr=0x7f47a4046028) at /home/midenok/src/mariadb/10.3/src/storage/innobase/row/row0upd.cc:3306
#7 0x0000000001050045 in row_upd_step (thr=0x7f47a4046028) at /home/midenok/src/mariadb/10.3/src/storage/innobase/row/row0upd.cc:3450
#8 0x0000000000fd1fe0 in row_update_for_mysql (prebuilt=0x7f47a40428b8) at /home/midenok/src/mariadb/10.3/src/storage/innobase/row/row0mysql.cc:1844
#9 0x0000000000dee5bb in ha_innobase::update_row (this=0x7f47a403b8a0, old_row=0x7f47a40425f8 "\374\001", new_row=0x7f47a40424e0 "\374\001") at /home/midenok/src/mariadb/10.3/src/storage/innobase/handler/ha_innodb.cc:8920
#10 0x0000000000b579cc in handler::ha_update_row (this=0x7f47a403b8a0, old_data=0x7f47a40425f8 "\374\001", new_data=0x7f47a40424e0 "\374\001") at ../src/sql/handler.cc:6510
#11 0x00000000009013fa in mysql_update (thd=0x7f47a4000d28, table_list=0x7f47a4012ca0, fields=..., values=..., conds=0x7f47a40458e0, order_num=0, order=0x0, limit=18446744073709551615, ignore=false, found_return=0x7f480c055370, updated_return=0x7f480c055368) at ../src/sql/sql_update.cc:957
#12 0x00000000007cc97a in mysql_execute_command (thd=0x7f47a4000d28) at ../src/sql/sql_parse.cc:4343
#13 0x00000000007c5516 in mysql_parse (thd=0x7f47a4000d28, rawbuf=0x7f47a4011be0 "update t1 set c0= 'criminal'", length=28, parser_state=0x7f480c056548, is_com_multi=false, is_next_command=false) at ../src/sql/sql_parse.cc:7870
1306 if (flen != UNIV_SQL_NULL
1307 && spatial_status != SPATIAL_ONLY) {
1308 if (trx_undo_left(undo_block, ptr)
1309 < flen) {
1310 return(0);
1311 }
1312
1313 memcpy(ptr, field, flen);
1314 ptr += flen;
1315 }
Record is non-history, row_end == timestamp_max_bytes. It is written into undo log by the above patch.
(rr) p col->vers_sys_end()
$13 = true
(rr) x/7bx field
0x7f480f7e40a7: 0x7f 0xff 0xff 0xff 0x0f 0x42 0x3f
(rr) x/7bx timestamp_max_bytes
0x17d403c <timestamp_max_bytes>: 0x7f 0xff 0xff 0xff 0x0f 0x42 0x3f
#0 trx_purge_get_next_rec (n_pages_handled=0x7f47e5efbc50, heap=0x3db6d60) at /home/midenok/src/mariadb/10.3/src/storage/innobase/trx/trx0purge.cc:1326
#1 0x00000000010a9716 in trx_purge_fetch_next_rec (roll_ptr=0x7f47d801a360, n_pages_handled=0x7f47e5efbc50, heap=0x3db6d60) at /home/midenok/src/mariadb/10.3/src/storage/innobase/trx/trx0purge.cc:1373
#2 0x00000000010a80e2 in trx_purge_attach_undo_recs (n_purge_threads=3) at /home/midenok/src/mariadb/10.3/src/storage/innobase/trx/trx0purge.cc:1447
#3 0x00000000010a74ed in trx_purge (n_purge_threads=3, truncate=true, slot=0x1d1a1c8 <srv_sys+520>) at /home/midenok/src/mariadb/10.3/src/storage/innobase/trx/trx0purge.cc:1583
1324 rec_copy = trx_undo_rec_copy(rec, heap);
1325
1326 mtr_commit(&mtr);
(rr) x/7bx (rec + 62)
0x7f480f3602c4: 0x7f 0xff 0xff 0xff 0x0f 0x42 0x3f
(rr) x/7bx (rec_copy + 62)
0x7f47d801a3ae: 0x7f 0xff 0xff 0xff 0x0f 0x42 0x3f
#0 row_purge_remove_sec_if_poss_leaf (node=0x3db6858, index=0x7f47a402c5d8, entry=0x7f47cc008838) at /home/midenok/src/mariadb/10.3/src/storage/innobase/row/row0purge.cc:597
#1 0x0000000001005ddd in row_purge_remove_sec_if_poss (node=0x3db6858, index=0x7f47a402c5d8, entry=0x7f47cc008838) at /home/midenok/src/mariadb/10.3/src/storage/innobase/row/row0purge.cc:693
#2 0x0000000001005440 in row_purge_upd_exist_or_extern_func (thr=0x3db6690, node=0x3db6858, undo_rec=0x7f47d801a370 "") at /home/midenok/src/mariadb/10.3/src/storage/innobase/row/row0purge.cc:895
#3 0x0000000001003ce6 in row_purge_record_func (node=0x3db6858, undo_rec=0x7f47d801a370 "", thr=0x3db6690, updated_extern=false) at /home/midenok/src/mariadb/10.3/src/storage/innobase/row/row0purge.cc:1215
#4 0x00000000010020d0 in row_purge (node=0x3db6858, undo_rec=0x7f47d801a370 "", thr=0x3db6690) at /home/midenok/src/mariadb/10.3/src/storage/innobase/row/row0purge.cc:1259
#5 0x0000000001001e3b in row_purge_step (thr=0x3db6690) at /home/midenok/src/mariadb/10.3/src/storage/innobase/row/row0purge.cc:1337
(rr) x/7bx node->row->fields[3].data
0x7f47d801a3ae: 0x7f 0xff 0xff 0xff 0x0f 0x42 0x3f
(rr) p node->row->fields[3].type.vers_sys_end()
$14 = true
--- a/storage/innobase/row/row0upd.cc
+++ b/storage/innobase/row/row0upd.cc
@@ -2579,6 +2579,11 @@ row_upd_sec_step(
if (node->state == UPD_NODE_UPDATE_ALL_SEC
|| row_upd_changes_ord_field_binary(node->index, node->update,
thr, node->row, node->ext)) {
+
+ if (node->index->vers_skip_fts_doc_id()) {
+ return DB_SUCCESS;
+ }
return(row_upd_sec_index_entry(node, thr));
}
Must be:
--- a/storage/innobase/row/row0upd.cc
+++ b/storage/innobase/row/row0upd.cc
@@ -2579,6 +2579,11 @@ row_upd_sec_step(
if (node->state == UPD_NODE_UPDATE_ALL_SEC
|| row_upd_changes_ord_field_binary(node->index, node->update,
thr, node->row, node->ext)) {
+
+ if (node->index->vers_skip_fts_doc_id() &&
+ node->row->vers_history_row()) {
+ return DB_SUCCESS;
+ }
return(row_upd_sec_index_entry(node, thr));
}
We cannot skip update of non-history row because it does delete-marking record.
--source include/have_innodb.inc
create table t1 (
id int primary key,
ftx varchar(255),
row_start timestamp(6) as row start,
row_end timestamp(6) as row end,
period for system_time (row_start, row_end))
with system versioning engine innodb;
insert into t1 values (1, 'c', default, default);
delete from t1;
alter table t1 add fulltext key(ftx);
drop table t1;
#12 0x00007f421f8335d6 in __GI___assert_fail (assertion=0x564a2de08cda "!(col->prtype & 256U)", file=0x564a2dd9d0b5 "../src/storage/innobase/row/row0merge.cc", line=718, function=0x564a2ddd372c "ulint row_merge_buf_add(row_merge_buf_t *, dict_index_t *, const dict_table_t *, const dict_table_t *, fts_psort_t *, dtuple_t *, const bool, const row_ext_t *, doc_id_t *, mem_heap_t *, dberr_t *, mem_heap_t **, TABLE *, trx_t *)") at ./assert/assert.c:101
#13 0x0000564a2edc8535 in row_merge_buf_add (buf=0x7f41c4044430, fts_index=0x7f41c40ec7a0, old_table=0x7f41c406f120, new_table=0x7f41c407c320, psort_info=0x7f41c4042a70, row=0x7f41c4044518, history_row=true, ext=0x0, doc_id=0x7f4219f1cfa0, conv_heap=0x0, err=0x7f4219f1cfc4, v_heap=0x7f4219f1d570, my_table=0x7f41c40fcce8, trx=0x7f421ab540c0) at ../src/storage/innobase/row/row0merge.cc:718
#14 0x0000564a2edbdf58 in row_merge_read_clustered_index (trx=0x7f421ab540c0, table=0x7f41c40fcce8, old_table=0x7f41c406f120, new_table=0x7f41c407c320, online=false, index=0x7f41c407c140, fts_sort_idx=0x7f41c407f320, psort_info=0x7f41c4042a70, files=0x7f41c4188cd0, key_numbers=0x7f41c407c158, n_index=3, defaults=0x0, add_v=0x0, col_map=0x7f41c407d8f0, add_autoinc=18446744073709551615, sequence=..., block=0x7f42103b0000 "", skip_pk_sort=true, tmpfd=0x7f4219f1ddc0, stage=0x7f41c418b2a0, pct_cost=25, crypt_block=0x0, eval_table=0x7f41c40fcce8, allow_not_null=false) at ../src/storage/innobase/row/row0merge.cc:2357
#15 0x0000564a2edb8bfb in row_merge_build_indexes (trx=0x7f421ab540c0, old_table=0x7f41c406f120, new_table=0x7f41c407c320, online=false, indexes=0x7f41c407c140, key_numbers=0x7f41c407c158, n_indexes=3, table=0x7f41c40fcce8, defaults=0x0, col_map=0x7f41c407d8f0, add_autoinc=18446744073709551615, sequence=..., skip_pk_sort=true, stage=0x7f41c418b2a0, add_v=0x0, eval_table=0x7f41c40fcce8, allow_not_null=false) at ../src/storage/innobase/row/row0merge.cc:4739
#16 0x0000564a2ec50afe in ha_innobase::inplace_alter_table (this=0x7f41c4108540, altered_table=0x7f41c40fcce8, ha_alter_info=0x7f4219f1eeb0) at ../src/storage/innobase/handler/handler0alter.cc:7225
#17 0x0000564a2e7c05b9 in handler::ha_inplace_alter_table (this=0x7f41c4108540, altered_table=0x7f41c40fcce8, ha_alter_info=0x7f4219f1eeb0) at ../src/sql/handler.h:4153
#18 0x0000564a2e7b77d3 in mysql_inplace_alter_table (thd=0x7f41c4000d38, table_list=0x7f41c4011ce0, table=0x7f41c4107948, altered_table=0x7f41c40fcce8, ha_alter_info=0x7f4219f1eeb0, target_mdl_request=0x7f4219f1f600, alter_ctx=0x7f4219f1f7b0) at ../src/sql/sql_table.cc:7773
#19 0x0000564a2e7b129f in mysql_alter_table (thd=0x7f41c4000d38, new_db=0x7f41c4005408, new_name=0x7f41c40057f0, create_info=0x7f4219f20a98, table_list=0x7f41c4011ce0, alter_info=0x7f4219f209e0, order_num=0, order=0x0, ignore=false) at ../src/sql/sql_table.cc:10112
#20 0x0000564a2e86fc45 in Sql_cmd_alter_table::execute (this=0x7f41c4012410, thd=0x7f41c4000d38) at ../src/sql/sql_alter.cc:512
#21 0x0000564a2e69e5a2 in mysql_execute_command (thd=0x7f41c4000d38) at ../src/sql/sql_parse.cc:6076
#22 0x0000564a2e690c7b in mysql_parse (thd=0x7f41c4000d38, rawbuf=0x7f41c4011bf0 "alter table t1 add fulltext key(ftx)", length=36, parser_state=0x7f4219f235d8, is_com_multi=false, is_next_command=false) at ../src/sql/sql_parse.cc:7871
--source include/have_innodb.inc
CREATE TABLE t (f TEXT) WITH SYSTEM VERSIONING CHARACTER SET utf8 ENGINE=InnoDB;
INSERT INTO t VALUES ('foo');
DELETE FROM t;
ALTER TABLE t ADD FULLTEXT (f);
# Cleanup
DROP TABLE t;
#0 row_merge_buf_add (buf=0x7f7b7c0a3820, fts_index=0x7f7b7c02bf80, old_table=0x7f7b7c02b570, new_table=0x7f7b7c086ec0, psort_info=0x7f7b7c0b0850, row=0x7f7b7f732488, ext=0x0, history_fts=true, doc_id=0x7f7b8405a340, conv_heap=0x0, err=0x7f7b8405a364, v_heap=0x7f7b8405a910, my_table=0x7f7b8405c478, trx=0x7f7b873ff108) at ../src/storage/innobase/row/row0merge.cc:719
#1 0x000055d3c418f676 in row_merge_read_clustered_index (trx=0x7f7b873ff108, table=0x7f7b8405c478, old_table=0x7f7b7c02b570, new_table=0x7f7b7c086ec0, online=false, index=0x7f7b7c086928, fts_sort_idx=0x7f7b7c089800, psort_info=0x7f7b7c0b0850, files=0x7f7b7c0abd10, key_numbers=0x7f7b7c086940, n_index=3, defaults=0x0, add_v=0x0, col_map=0x7f7b7c086a28, add_autoinc=18446744073709551615, sequence=..., block=0x7f7b5b6f4000 "", skip_pk_sort=true, tmpfd=0x7f7b8405b160, stage=0x7f7b7c0a92d0, pct_cost=25, crypt_block=0x0, eval_table=0x7f7b8405c478, allow_not_null=false) at ../src/storage/innobase/row/row0merge.cc:2323
#2 0x000055d3c418a2f7 in row_merge_build_indexes (trx=0x7f7b873ff108, old_table=0x7f7b7c02b570, new_table=0x7f7b7c086ec0, online=false, indexes=0x7f7b7c086928, key_numbers=0x7f7b7c086940, n_indexes=3, table=0x7f7b8405c478, defaults=0x0, col_map=0x7f7b7c086a28, add_autoinc=18446744073709551615, sequence=..., skip_pk_sort=true, stage=0x7f7b7c0a92d0, add_v=0x0, eval_table=0x7f7b8405c478, allow_not_null=false) at ../src/storage/innobase/row/row0merge.cc:4697
#3 0x000055d3c40088ff in ha_innobase::inplace_alter_table (this=0x7f7b7c031950, altered_table=0x7f7b8405c478, ha_alter_info=0x7f7b8405d7f0) at /home/midenok/src/mariadb/10.4/src/storage/innobase/handler/handler0alter.cc:8728
#4 0x000055d3c395a009 in handler::ha_inplace_alter_table (this=0x7f7b7c031950, altered_table=0x7f7b8405c478, ha_alter_info=0x7f7b8405d7f0) at ../src/sql/handler.h:4355
#5 0x000055d3c394f849 in mysql_inplace_alter_table (thd=0x7f7b7c0186d8, table_list=0x7f7b7c023b70, table=0x7f7b7c030b38, altered_table=0x7f7b8405c478, ha_alter_info=0x7f7b8405d7f0, target_mdl_request=0x7f7b8405e110, alter_ctx=0x7f7b8405e2c0) at ../src/sql/sql_table.cc:7918
#6 0x000055d3c3948d8d in mysql_alter_table (thd=0x7f7b7c0186d8, new_db=0x7f7b7c01cec0, new_name=0x7f7b7c01d318, create_info=0x7f7b8405f658, table_list=0x7f7b7c023b70, recreate_info=0x7f7b8405ee58, alter_info=0x7f7b8405f5a0, order_num=0, order=0x0, ignore=false) at ../src/sql/sql_table.cc:10446
#7 0x000055d3c39fa800 in Sql_cmd_alter_table::execute (this=0x7f7b7c024330, thd=0x7f7b7c0186d8) at ../src/sql/sql_alter.cc:531
#8 0x000055d3c3847307 in mysql_execute_command (thd=0x7f7b7c0186d8) at ../src/sql/sql_parse.cc:6216
#9 0x000055d3c3837d8b in mysql_parse (thd=0x7f7b7c0186d8, rawbuf=0x7f7b7c023a90 "ALTER TABLE t ADD FULLTEXT (f)", length=30, parser_state=0x7f7b84062480, is_com_multi=false, is_next_command=false) at ../src/sql/sql_parse.cc:8008
#0 row_merge_buf_add (buf=0x7f7b7c0a38e0, fts_index=0x7f7b7c02bf80, old_table=0x7f7b7c02b570, new_table=0x7f7b7c086ec0, psort_info=0x7f7b7c0b0850, row=0x7f7b7f732488, ext=0x0, history_fts=true, doc_id=0x7f7b8405a340, conv_heap=0x0, err=0x7f7b8405a364, v_heap=0x7f7b8405a910, my_table=0x7f7b8405c478, trx=0x7f7b873ff108) at ../src/storage/innobase/row/row0merge.cc:719
#1 0x000055d3c418f676 in row_merge_read_clustered_index (trx=0x7f7b873ff108, table=0x7f7b8405c478, old_table=0x7f7b7c02b570, new_table=0x7f7b7c086ec0, online=false, index=0x7f7b7c086928, fts_sort_idx=0x7f7b7c089800, psort_info=0x7f7b7c0b0850, files=0x7f7b7c0abd10, key_numbers=0x7f7b7c086940, n_index=3, defaults=0x0, add_v=0x0, col_map=0x7f7b7c086a28, add_autoinc=18446744073709551615, sequence=..., block=0x7f7b5b6f4000 "", skip_pk_sort=true, tmpfd=0x7f7b8405b160, stage=0x7f7b7c0a92d0, pct_cost=25, crypt_block=0x0, eval_table=0x7f7b8405c478, allow_not_null=false) at ../src/storage/innobase/row/row0merge.cc:2323
#2 0x000055d3c418a2f7 in row_merge_build_indexes (trx=0x7f7b873ff108, old_table=0x7f7b7c02b570, new_table=0x7f7b7c086ec0, online=false, indexes=0x7f7b7c086928, key_numbers=0x7f7b7c086940, n_indexes=3, table=0x7f7b8405c478, defaults=0x0, col_map=0x7f7b7c086a28, add_autoinc=18446744073709551615, sequence=..., skip_pk_sort=true, stage=0x7f7b7c0a92d0, add_v=0x0, eval_table=0x7f7b8405c478, allow_not_null=false) at ../src/storage/innobase/row/row0merge.cc:4697
#3 0x000055d3c40088ff in ha_innobase::inplace_alter_table (this=0x7f7b7c031950, altered_table=0x7f7b8405c478, ha_alter_info=0x7f7b8405d7f0) at /home/midenok/src/mariadb/10.4/src/storage/innobase/handler/handler0alter.cc:8728
#4 0x000055d3c395a009 in handler::ha_inplace_alter_table (this=0x7f7b7c031950, altered_table=0x7f7b8405c478, ha_alter_info=0x7f7b8405d7f0) at ../src/sql/handler.h:4355
#5 0x000055d3c394f849 in mysql_inplace_alter_table (thd=0x7f7b7c0186d8, table_list=0x7f7b7c023b70, table=0x7f7b7c030b38, altered_table=0x7f7b8405c478, ha_alter_info=0x7f7b8405d7f0, target_mdl_request=0x7f7b8405e110, alter_ctx=0x7f7b8405e2c0) at ../src/sql/sql_table.cc:7918
#6 0x000055d3c3948d8d in mysql_alter_table (thd=0x7f7b7c0186d8, new_db=0x7f7b7c01cec0, new_name=0x7f7b7c01d318, create_info=0x7f7b8405f658, table_list=0x7f7b7c023b70, recreate_info=0x7f7b8405ee58, alter_info=0x7f7b8405f5a0, order_num=0, order=0x0, ignore=false) at ../src/sql/sql_table.cc:10446
#7 0x000055d3c39fa800 in Sql_cmd_alter_table::execute (this=0x7f7b7c024330, thd=0x7f7b7c0186d8) at ../src/sql/sql_alter.cc:531
#8 0x000055d3c3847307 in mysql_execute_command (thd=0x7f7b7c0186d8) at ../src/sql/sql_parse.cc:6216
#9 0x000055d3c3837d8b in mysql_parse (thd=0x7f7b7c0186d8, rawbuf=0x7f7b7c023a90 "ALTER TABLE t ADD FULLTEXT (f)", length=30, parser_state=0x7f7b84062480, is_com_multi=false, is_next_command=false) at ../src/sql/sql_parse.cc:8008
Reproduce
Result
frame 4
Notes
Caused by MDEV-21138 #68