diff options
author | Thirunarayanan Balathandayuthapani <thiru@mariadb.com> | 2023-03-13 15:41:06 +0530 |
---|---|---|
committer | Thirunarayanan Balathandayuthapani <thiru@mariadb.com> | 2023-03-13 15:41:39 +0530 |
commit | ab65a262e0b5fd6f47386d5e5766722c2fac3d00 (patch) | |
tree | 866b48e26463b4e5306c15383e49f138e1f858f6 | |
parent | f169dfb41adcb637732507ed56d3038003170a15 (diff) | |
download | mariadb-git-bb-10.6-thiru.tar.gz |
MDEV-26198 Assertion `0' failed in row_log_table_apply_op duringbb-10.6-thiru
ADD PRIMARY KEY or OPTIMIZE TABLE
- InnoDB alter fails to apply the online log during redundant table
rebuild. Problem is that InnoDB wrongly reads the length flags of the
record while applying the temporary log record.
rec_init_offsets_comp_ordinary(): For finding the n_core_null_bytes,
InnoDB should use the same logic as rec_convert_dtuple_to_rec_comp().
-rw-r--r-- | mysql-test/suite/innodb/r/instant_alter_crash.result | 24 | ||||
-rw-r--r-- | mysql-test/suite/innodb/t/instant_alter_crash.test | 26 | ||||
-rw-r--r-- | storage/innobase/rem/rem0rec.cc | 4 |
3 files changed, 53 insertions, 1 deletions
diff --git a/mysql-test/suite/innodb/r/instant_alter_crash.result b/mysql-test/suite/innodb/r/instant_alter_crash.result index f0fedcc7673..7855aa24264 100644 --- a/mysql-test/suite/innodb/r/instant_alter_crash.result +++ b/mysql-test/suite/innodb/r/instant_alter_crash.result @@ -206,3 +206,27 @@ Table Op Msg_type Msg_text test.t2 check status OK DROP TABLE t1,t2; db.opt +# +# MDEV-26198 Assertion `0' failed in row_log_table_apply_op during +# ADD PRIMARY KEY or OPTIMIZE TABLE +# +CREATE TABLE t1(f1 year default null, f2 year default null, +f3 text, f4 year default null, f5 year default null, +f6 year default null, f7 year default null, +f8 year default null)ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 VALUES(1, 1, 1, 1, 1, 1, 1, 1); +ALTER TABLE t1 ADD COLUMN f9 year default null, ALGORITHM=INPLACE; +set DEBUG_SYNC="row_log_table_apply1_before SIGNAL con1_insert WAIT_FOR con1_finish"; +ALTER TABLE t1 ROW_FORMAT=REDUNDANT, ADD COLUMN f10 YEAR DEFAULT NULL, ALGORITHM=INPLACE; +connect con1,localhost,root,,,; +SET DEBUG_SYNC="now WAIT_FOR con1_insert"; +INSERT IGNORE INTO t1 (f3) VALUES ( 'b' ); +INSERT IGNORE INTO t1 (f3) VALUES ( 'l' ); +SET DEBUG_SYNC="now SIGNAL con1_finish"; +connection default; +disconnect con1; +SET DEBUG_SYNC=RESET; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/instant_alter_crash.test b/mysql-test/suite/innodb/t/instant_alter_crash.test index 0bd983a2b4c..37cdb2862ad 100644 --- a/mysql-test/suite/innodb/t/instant_alter_crash.test +++ b/mysql-test/suite/innodb/t/instant_alter_crash.test @@ -236,3 +236,29 @@ CHECK TABLE t2; DROP TABLE t1,t2; --list_files $MYSQLD_DATADIR/test + +--echo # +--echo # MDEV-26198 Assertion `0' failed in row_log_table_apply_op during +--echo # ADD PRIMARY KEY or OPTIMIZE TABLE +--echo # +CREATE TABLE t1(f1 year default null, f2 year default null, + f3 text, f4 year default null, f5 year default null, + f6 year default null, f7 year default null, + f8 year default null)ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +INSERT INTO t1 VALUES(1, 1, 1, 1, 1, 1, 1, 1); +ALTER TABLE t1 ADD COLUMN f9 year default null, ALGORITHM=INPLACE; +set DEBUG_SYNC="row_log_table_apply1_before SIGNAL con1_insert WAIT_FOR con1_finish"; +send ALTER TABLE t1 ROW_FORMAT=REDUNDANT, ADD COLUMN f10 YEAR DEFAULT NULL, ALGORITHM=INPLACE; + +connect(con1,localhost,root,,,); +SET DEBUG_SYNC="now WAIT_FOR con1_insert"; +INSERT IGNORE INTO t1 (f3) VALUES ( 'b' ); +INSERT IGNORE INTO t1 (f3) VALUES ( 'l' ); +SET DEBUG_SYNC="now SIGNAL con1_finish"; + +connection default; +reap; +disconnect con1; +SET DEBUG_SYNC=RESET; +CHECK TABLE t1; +DROP TABLE t1; diff --git a/storage/innobase/rem/rem0rec.cc b/storage/innobase/rem/rem0rec.cc index 98cf2dda900..712a7e55d4f 100644 --- a/storage/innobase/rem/rem0rec.cc +++ b/storage/innobase/rem/rem0rec.cc @@ -291,7 +291,9 @@ rec_init_offsets_comp_ordinary( != n_core) ? UT_BITS_IN_BYTES(unsigned(index->get_n_nullable(n_core))) : (redundant_temp - ? UT_BITS_IN_BYTES(index->n_nullable) + ? (index->is_instant() + ? UT_BITS_IN_BYTES(index->get_n_nullable(n_core)) + : UT_BITS_IN_BYTES(index->n_nullable)) : index->n_core_null_bytes); if (mblob) { |