Commit 49a50a19 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-17923 Assertion failed in trx_undo_page_report_modify after CREATE FULLTEXT INDEX

row_fts_merge_insert(): Correctly initialize DB_ROLL_PTR to a safe value
that will not be dereferenced by MVCC.
parent 5ec9b88e
......@@ -166,3 +166,19 @@ SELECT len,COUNT(*) FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS where name='word'
len COUNT(*)
84 6
DROP TABLE t;
#
# MDEV-17923 Assertion memcmp(field, field_ref_zero, 7) failed in
# trx_undo_page_report_modify upon optimizing table
# under innodb_optimize_fulltext_only
#
CREATE TABLE t1 (f1 TEXT, f2 TEXT, FULLTEXT KEY (f2)) ENGINE=InnoDB;
INSERT INTO t1 (f1) VALUES ('foo'),('bar');
DELETE FROM t1 LIMIT 1;
ALTER TABLE t1 ADD FULLTEXT KEY (f1);
SET @optimize_fulltext.save= @@innodb_optimize_fulltext_only;
SET GLOBAL innodb_optimize_fulltext_only= 1;
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
DROP TABLE t1;
SET GLOBAL innodb_optimize_fulltext_only= @optimize_fulltext.save;
......@@ -90,3 +90,19 @@ ENGINE=InnoDB;
# The column length should be 84 bytes (84 characters * 1 byte/character).
SELECT len,COUNT(*) FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS where name='word' GROUP BY len;
DROP TABLE t;
--echo #
--echo # MDEV-17923 Assertion memcmp(field, field_ref_zero, 7) failed in
--echo # trx_undo_page_report_modify upon optimizing table
--echo # under innodb_optimize_fulltext_only
--echo #
CREATE TABLE t1 (f1 TEXT, f2 TEXT, FULLTEXT KEY (f2)) ENGINE=InnoDB;
INSERT INTO t1 (f1) VALUES ('foo'),('bar');
DELETE FROM t1 LIMIT 1;
ALTER TABLE t1 ADD FULLTEXT KEY (f1);
SET @optimize_fulltext.save= @@innodb_optimize_fulltext_only;
SET GLOBAL innodb_optimize_fulltext_only= 1;
OPTIMIZE TABLE t1;
DROP TABLE t1;
SET GLOBAL innodb_optimize_fulltext_only= @optimize_fulltext.save;
......@@ -1581,9 +1581,7 @@ row_fts_merge_insert(
dict_table_t* aux_table;
dict_index_t* aux_index;
trx_t* trx;
byte trx_id_buf[6];
roll_ptr_t roll_ptr = 0;
dfield_t* field;
byte sys_buf[DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN];
ut_ad(index);
ut_ad(table);
......@@ -1689,16 +1687,16 @@ row_fts_merge_insert(
dict_index_get_n_fields(aux_index));
/* Set TRX_ID and ROLL_PTR */
trx_write_trx_id(trx_id_buf, trx->id);
field = dtuple_get_nth_field(ins_ctx.tuple, 2);
dfield_set_data(field, &trx_id_buf, 6);
trx_write_trx_id(sys_buf, trx->id);
trx_write_roll_ptr(sys_buf + DATA_TRX_ID_LEN,
1ULL << ROLL_PTR_INSERT_FLAG_POS);
dfield_set_data(dtuple_get_nth_field(ins_ctx.tuple, 2),
&sys_buf, DATA_TRX_ID_LEN);
dfield_set_data(dtuple_get_nth_field(ins_ctx.tuple, 3),
&sys_buf + DATA_TRX_ID_LEN, DATA_ROLL_PTR_LEN);
field = dtuple_get_nth_field(ins_ctx.tuple, 3);
dfield_set_data(field, &roll_ptr, 7);
ut_d(ins_ctx.aux_index_id = id);
#ifdef UNIV_DEBUG
ins_ctx.aux_index_id = id;
#endif
const ulint space = table->space;
for (i = 0; i < fts_sort_pll_degree; i++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment