Skip to content

Commit 7d591cf

Browse files
MDEV-24713 Assertion `dict_table_is_comp(index->table)' failed in row_merge_buf_add()
- During online alter conversion from compact to redundant, virtual column field length already set during innobase_get_computed_value(). Skip the char(n) check for virtual column in row_merge_buf_add()
1 parent 7229107 commit 7d591cf

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

mysql-test/suite/gcol/r/innodb_virtual_index.result

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,3 +286,17 @@ Warning 1264 Out of range value for column 'va' at row 1
286286
ALTER TABLE t1 FORCE;
287287
ERROR 22003: Out of range value for column 'va' at row 1
288288
DROP TABLE t1;
289+
#
290+
# MDEV-24713 Assertion `dict_table_is_comp(index->table)' failed
291+
# in row_merge_buf_add()
292+
#
293+
CREATE TABLE t1 (id INT PRIMARY KEY, a CHAR(3),
294+
b CHAR(8) AS (a) VIRTUAL, KEY(b))
295+
ROW_FORMAT=REDUNDANT ENGINE=InnoDB
296+
CHARACTER SET utf8;
297+
INSERT INTO t1 (id,a) VALUES (1,'foo');
298+
OPTIMIZE TABLE t1;
299+
Table Op Msg_type Msg_text
300+
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
301+
test.t1 optimize status OK
302+
DROP TABLE t1;

mysql-test/suite/gcol/t/innodb_virtual_index.test

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,3 +302,15 @@ INSERT IGNORE INTO t1 (id, a) VALUES (NULL, -1);
302302
--error ER_WARN_DATA_OUT_OF_RANGE
303303
ALTER TABLE t1 FORCE;
304304
DROP TABLE t1;
305+
306+
--echo #
307+
--echo # MDEV-24713 Assertion `dict_table_is_comp(index->table)' failed
308+
--echo # in row_merge_buf_add()
309+
--echo #
310+
CREATE TABLE t1 (id INT PRIMARY KEY, a CHAR(3),
311+
b CHAR(8) AS (a) VIRTUAL, KEY(b))
312+
ROW_FORMAT=REDUNDANT ENGINE=InnoDB
313+
CHARACTER SET utf8;
314+
INSERT INTO t1 (id,a) VALUES (1,'foo');
315+
OPTIMIZE TABLE t1;
316+
DROP TABLE t1;

storage/innobase/row/row0merge.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,10 @@ row_merge_buf_add(
691691
continue;
692692
}
693693

694-
if (field->len != UNIV_SQL_NULL
694+
/* innobase_get_computed_value() sets the
695+
length of the virtual column field. */
696+
if (v_col == NULL
697+
&& field->len != UNIV_SQL_NULL
695698
&& col->mtype == DATA_MYSQL
696699
&& col->len != field->len) {
697700
if (conv_heap != NULL) {

0 commit comments

Comments
 (0)