MDEV-30597 Assertion `flag == 1' failed in row_build_index_entry_low

- InnoDB tries to build the previous version of the record for
the virtual index, but the undo log record doesn't contain
virtual column information. This leads to assert failure while
building the tuple.
parent 7170db3c
......@@ -79,10 +79,29 @@ a b c d
ROLLBACK;
SET DEBUG_SYNC = 'now SIGNAL dml_done';
connection con1;
disconnect con1;
connection default;
SELECT * FROM t;
a b d
9 10 29
DROP TABLE t;
SET DEBUG_SYNC = 'RESET';
#
# MDEV-30597 Assertion `flag == 1' failed in
# row_build_index_entry_low
#
CREATE TABLE t1 (
col1 INT PRIMARY KEY, col_text TEXT,
col_text_g TEXT GENERATED ALWAYS AS (SUBSTR(col_text,1,499))
) ENGINE = InnoDB ROW_FORMAT = Compact;
connection con1;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
INSERT INTO t1 (col1) VALUES (1) ;
DELETE FROM t1 WHERE col1 = 1;
ALTER TABLE t1 ADD UNIQUE INDEX (col_text_g(9));
BEGIN;
INSERT INTO t1 (col1) VALUES (1);
ROLLBACK;
disconnect con1;
DROP TABLE t1;
# End of 10.4 tests
......@@ -103,7 +103,6 @@ SET DEBUG_SYNC = 'now SIGNAL dml_done';
connection con1;
reap;
disconnect con1;
connection default;
SELECT * FROM t;
......@@ -111,5 +110,27 @@ SELECT * FROM t;
DROP TABLE t;
SET DEBUG_SYNC = 'RESET';
--echo #
--echo # MDEV-30597 Assertion `flag == 1' failed in
--echo # row_build_index_entry_low
--echo #
CREATE TABLE t1 (
col1 INT PRIMARY KEY, col_text TEXT,
col_text_g TEXT GENERATED ALWAYS AS (SUBSTR(col_text,1,499))
) ENGINE = InnoDB ROW_FORMAT = Compact;
connection con1;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
INSERT INTO t1 (col1) VALUES (1) ;
DELETE FROM t1 WHERE col1 = 1;
ALTER TABLE t1 ADD UNIQUE INDEX (col_text_g(9));
BEGIN;
INSERT INTO t1 (col1) VALUES (1);
ROLLBACK;
disconnect con1;
DROP TABLE t1;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
--echo # End of 10.4 tests
......@@ -860,6 +860,20 @@ row_vers_build_cur_vrow(
return(cur_vrow);
}
/** Find out whether data tuple has missing data type
for virtualcolumn.
@param tuple data tuple
@return true if tuple has missing column type */
static bool dtuple_vcol_data_missing(const dtuple_t &tuple)
{
for (ulint i= 0; i < tuple.n_v_fields; i++)
{
if (tuple.v_fields[i].type.mtype == DATA_MISSING)
return true;
}
return false;
}
/** Finds out if a version of the record, where the version >= the current
purge view, should have ientry as its secondary index entry. We check
if there is any not delete marked version of the record where the trx
......@@ -1088,6 +1102,9 @@ row_vers_old_has_index_entry(
if (dict_index_has_virtual(index)) {
if (vrow) {
if (dtuple_vcol_data_missing(*vrow)) {
goto nochange_index;
}
/* Keep the virtual row info for the next
version, unless it is changed */
mem_heap_empty(v_heap);
......@@ -1098,6 +1115,7 @@ row_vers_old_has_index_entry(
if (!cur_vrow) {
/* Nothing for this index has changed,
continue */
nochange_index:
version = prev_version;
continue;
}
......
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