[MDEV-31025] Redundant table alter fails when fixed column stored externally Created: 2023-04-07  Updated: 2023-09-19  Resolved: 2023-04-19

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11, 11.0, 11.1
Fix Version/s: 11.1.1, 10.11.3, 10.4.29, 10.5.20, 10.6.13, 10.8.8, 10.9.6, 10.10.4

Type: Bug Priority: Major
Reporter: Roel Van de Paar Assignee: Thirunarayanan Balathandayuthapani
Resolution: Fixed Votes: 0
Labels: regression

Issue Links:
Blocks
blocks MDEV-18361 row0log.cc:3057: dberr_t row_log_tabl... Closed
Duplicate
duplicates MDEV-31176 Assertion `index->table->not_redundan... Closed
Problem/Incident
is caused by MDEV-24621 In bulk insert, pre-sort and build in... Closed
Relates
relates to MDEV-27858 Assertion `page_dir_get_n_heap(new_pa... Closed

 Description   

Looks similar to MDEV-27858 however this bug remains post-patch. It is however not caused by the patch, as the bug can be found in builds from late January 2022.

SET GLOBAL innodb_default_row_format=0;
SET sql_mode='',unique_checks=0,foreign_key_checks=0;
CREATE TABLE t (pk INT,c CHAR(255),c2 CHAR(255),c3 CHAR(255),c4 CHAR(255),c5 CHAR(255),c6 CHAR(255),c7 CHAR(255),c8 CHAR(255),PRIMARY KEY(pk)) ENGINE=InnoDB CHARACTER SET utf32;
INSERT INTO t(c) VALUES (10);

Leads to:

11.1.0 2b61ff8f2221745f0a96855a0feb0825c426f993 (Debug)

mariadbd: /test/11.1_dbg/storage/innobase/btr/btr0bulk.cc:1226: dberr_t BtrBulk::finish(dberr_t): Assertion `err != DB_SUCCESS || btr_validate_index(m_index, __null) == DB_SUCCESS' failed.

11.1.0 2b61ff8f2221745f0a96855a0feb0825c426f993 (Debug)

Core was generated by `/test/MD070423-mariadb-11.1.0-linux-x86_64-dbg/bin/mariadbd --no-defaults --cor'.
Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=23363482273344)
    at ./nptl/pthread_kill.c:44
[Current thread is 1 (Thread 0x153fbc0fc640 (LWP 409785))]
(gdb) bt
#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=23363482273344) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=23363482273344) at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=23363482273344, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3  0x0000153fd9e69476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x0000153fd9e4f7f3 in __GI_abort () at ./stdlib/abort.c:79
#5  0x0000153fd9e4f71b in __assert_fail_base (fmt=0x153fda004150 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x563cf977ac18 "err != DB_SUCCESS || btr_validate_index(m_index, __null) == DB_SUCCESS", file=0x563cf977ad48 "/test/11.1_dbg/storage/innobase/btr/btr0bulk.cc", line=1226, function=<optimized out>) at ./assert/assert.c:92
#6  0x0000153fd9e60e96 in __GI___assert_fail (assertion=0x563cf977ac18 "err != DB_SUCCESS || btr_validate_index(m_index, __null) == DB_SUCCESS", file=0x563cf977ad48 "/test/11.1_dbg/storage/innobase/btr/btr0bulk.cc", line=1226, function=0x563cf977abf0 "dberr_t BtrBulk::finish(dberr_t)") at ./assert/assert.c:101
#7  0x0000563cf91ce13d in BtrBulk::finish (this=this@entry=0x153fbc0fa220, err=DB_SUCCESS) at /test/11.1_dbg/storage/innobase/btr/btr0bulk.cc:1226
#8  0x0000563cf90f98f5 in row_merge_bulk_t::write_to_index (this=this@entry=0x153f70079d40, index_no=index_no@entry=0, trx=trx@entry=0x153fd9122b80) at /test/11.1_dbg/storage/innobase/row/row0merge.cc:5337
#9  0x0000563cf90f99e6 in row_merge_bulk_t::write_to_table (this=0x153f70079d40, table=<optimized out>, trx=trx@entry=0x153fd9122b80) at /test/11.1_dbg/storage/innobase/row/row0merge.cc:5350
#10 0x0000563cf90f9a2c in trx_mod_table_time_t::write_bulk (this=this@entry=0x153f7002a208, table=<optimized out>, trx=trx@entry=0x153fd9122b80) at /test/11.1_dbg/storage/innobase/row/row0merge.cc:5363
#11 0x0000563cf8fa896d in innodb_prepare_commit_versioned (thd=<optimized out>, trx_id=<optimized out>) at /test/11.1_dbg/storage/innobase/handler/ha_innodb.cc:3661
#12 0x0000563cf8cec096 in ha_commit_trans (thd=thd@entry=0x153f70000d58, all=all@entry=false) at /test/11.1_dbg/sql/handler.cc:1813
#13 0x0000563cf8b7ad85 in trans_commit_stmt (thd=thd@entry=0x153f70000d58) at /test/11.1_dbg/sql/transaction.cc:472
#14 0x0000563cf8a0fdb8 in mysql_execute_command (thd=thd@entry=0x153f70000d58, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/11.1_dbg/sql/sql_parse.cc:5820
#15 0x0000563cf8a10f05 in mysql_parse (thd=thd@entry=0x153f70000d58, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x153fbc0fb230) at /test/11.1_dbg/sql/sql_parse.cc:7760
#16 0x0000563cf8a13099 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x153f70000d58, packet=packet@entry=0x153f7000ae49 "INSERT INTO t(c) VALUES (10)", packet_length=packet_length@entry=28, blocking=blocking@entry=true) at /test/11.1_dbg/sql/sql_class.h:242
#17 0x0000563cf8a14ef5 in do_command (thd=0x153f70000d58, blocking=blocking@entry=true) at /test/11.1_dbg/sql/sql_parse.cc:1405
#18 0x0000563cf8b66cfc in do_handle_one_connection (connect=<optimized out>, connect@entry=0x563cfac5cfd8, put_in_cache=put_in_cache@entry=true) at /test/11.1_dbg/sql/sql_connect.cc:1416
#19 0x0000563cf8b66f5b in handle_one_connection (arg=0x563cfac5cfd8) at /test/11.1_dbg/sql/sql_connect.cc:1318
#20 0x0000153fd9ebbb43 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#21 0x0000153fd9f4da00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Bug confirmed present in:
MariaDB: 10.7.8 (dbg), 10.8.8 (dbg), 10.9.6 (dbg), 10.10.4 (dbg), 10.11.3 (dbg), 11.0.2 (dbg), 11.1.0 (dbg)

Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.4.29 (dbg), 10.4.29 (opt), 10.5.20 (dbg), 10.5.20 (opt), 10.6.13 (dbg), 10.6.13 (opt), 10.7.8 (opt), 10.8.8 (opt), 10.9.6 (opt), 10.10.4 (opt), 10.11.3 (opt), 11.0.2 (opt), 11.1.0 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.40 (dbg), 5.7.40 (opt), 8.0.31 (dbg), 8.0.31 (opt)



 Comments   
Comment by Roel Van de Paar [ 2023-04-07 ]

Likely caused by MDEV-24621

Comment by Thirunarayanan Balathandayuthapani [ 2023-04-11 ]

This problem can happen even with the following test case:

--source include/have_innodb.inc
SET sql_mode='';
CREATE TABLE t (pk INT,c CHAR(255),c2 CHAR(255),c3 CHAR(255), c4 char(255), c5 char(255),
                c6 char(255), c7 char(255), c8 char(255),primary key(pk))engine=innodb character set utf32 row_format=redundant;
INSERT INTO t(pk, c) VALUES (1, 10);
ALTER TABLE t FORCE;
CHECK TABLE t;
select * from t;
DROP TABLE t;

Comment by Thirunarayanan Balathandayuthapani [ 2023-04-11 ]

Patch is in bb-10.4-thiru. Branch has MDEV-24011 (10.4 only bugs)

Comment by Marko Mäkelä [ 2023-04-13 ]

OK to push.

Comment by Roel Van de Paar [ 2023-08-25 ]

An old run had a leftover testcase for this bug. Adding it here just for completeness/info.

SET @@unique_checks=OFF; 
SET GLOBAL innodb_default_row_format=REDUNDANT;
SET foreign_key_checks=0;
CREATE TABLE t (pk INT,c CHAR(255),c2 CHAR(255),c3 CHAR(255),c4 CHAR(255),c5 CHAR(255),c6 CHAR(255),c7 CHAR(255),c8 CHAR
(255),PRIMARY KEY(pk)) CHARACTER SET utf32 COMMENT=''COMMENT='';
INSERT INTO t VALUES (+1,+1,0,0,0,0,0,0,0);

Generated at Thu Feb 08 10:20:43 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.