[MDEV-29010] Table cannot be loaded after instant ALTER, errors or assertion failure Created: 2022-07-02  Updated: 2023-11-28

Status: Open
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
Fix Version/s: 10.4, 10.5, 10.6

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Marko Mäkelä
Resolution: Unresolved Votes: 0
Labels: None


 Description   

--source include/have_innodb.inc
 
CREATE TABLE t (a CHAR(255), b INT) ENGINE=InnoDB CHARACTER SET utf32;
ALTER TABLE t DROP COLUMN a;
 
--source include/restart_mysqld.inc
 
# Cleanup
DROP TABLE t;

10.4 392ee571

2022-07-02 18:49:09 8 [ERROR] InnoDB: Table `test`.`t` contains unrecognizable instant ALTER metadata
2022-07-02 18:49:09 8 [ERROR] InnoDB: Table `test`.`t` does not exist in the InnoDB internal data dictionary though MariaDB is trying to drop it. Have you copied the .frm file of the table to the MariaDB database directory from another database? Please refer to https://mariadb.com/kb/en/innodb-troubleshooting/ for how to resolve the issue.

10.6 debug 0c62b6d5

2022-07-02 18:51:45 0 [ERROR] InnoDB: Table `test`.`t` contains unrecognizable instant ALTER metadata
mariadbd: /data/src/10.6/storage/innobase/dict/dict0load.cc:2464: dict_table_t* dict_load_table_one(const st_::span<const char>&, dict_err_ignore_t, dict_names_t&): Assertion `!table || (ignore_err & ~DICT_ERR_IGNORE_FK_NOKEY) || !table->is_readable() || !table->corrupted' failed.
220702 18:51:45 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f601af0f662 in __GI___assert_fail (assertion=0x55c02d2839b0 "!table || (ignore_err & ~DICT_ERR_IGNORE_FK_NOKEY) || !table->is_readable() || !table->corrupted", file=0x55c02d282240 "/data/src/10.6/storage/innobase/dict/dict0load.cc", line=2464, function=0x55c02d283620 "dict_table_t* dict_load_table_one(const st_::span<const char>&, dict_err_ignore_t, dict_names_t&)") at assert.c:101
No locals.
#8  0x000055c02cc11b70 in dict_load_table_one (name=@0x7f5fcb7fd350: {data_ = 0x7f60149bc15d "test/t", size_ = 6}, ignore_err=DICT_ERR_IGNORE_FK_NOKEY, fk_tables=std::deque with 0 elements) at /data/src/10.6/storage/innobase/dict/dict0load.cc:2464
        pcur = {btr_cur = {index = 0x55c02e8c8198, page_cur = {index = 0x0, rec = 0x7f601456426b "test/t", offsets = 0x0, block = 0x7f6014535410}, purge_node = 0x0, left_block = 0x0, thr = 0x0, flag = BTR_CUR_BINARY, tree_height = 1, up_match = 1, up_bytes = 0, low_match = 0, low_bytes = 0, n_fields = 0, n_bytes = 0, fold = 0, path_arr = 0x0, rtr_info = 0x0}, latch_mode = 1, old_stored = false, old_rec = 0x0, old_n_core_fields = 0, old_n_fields = 0, rel_pos = 0, block_when_stored = {m_block = 0x0, m_page_id = {m_id = 0}}, modify_clock = 0, pos_state = BTR_PCUR_IS_POSITIONED, search_mode = PAGE_CUR_GE, trx_if_known = 0x0, old_rec_buf = 0x0, buf_size = 0}
        mtr = {m_start = true, m_commit = true, m_freeing_tree = false, m_last = 0x0, m_last_offset = 0, m_log_mode = 0, m_modifications = 0, m_made_dirty = 0, m_inside_ibuf = 0, m_trim_pages = 0, m_user_space_id = 0, m_memo = {m_heap = 0x0, m_list = {<ilist<mtr_buf_t::block_t, void>> = {sentinel_ = {next = 0x7f5fcb7fcda0, prev = 0x7f5fcb7fcda0}}, size_ = 1}, m_size = 0, m_first_block = {<ilist_node<void>> = {next = 0x7f5fcb7fcd80, prev = 0x7f5fcb7fcd80}, m_buf_end = 0, m_magic_n = 375767, m_data = "\000\000\000\000\000\000\000\000\001", '\000' <repeats 15 times>, "\001\000\000\000\300U\000\000\000\316\177\313_\177\000\000p\316\177\313\201\000\000\000p\316\177\313_\177\000\000@m\201\032`\177\000\000\220\316\177\313_\177\000\000\267$\200,\300U\000\000 \000\000\000\000\000\000\000x\033\000\300_\177\000\000\030\002\000\000\000\000\000\000\030\002\000\000\202\000\000\000\"\000\000\000_\177\000\000@m\201\032\201\000\000\000x\033\000\300_\177\000\000\300\270^.\300U\000\000@\230\210\031`\177\000\000\210\274\210\031`\177\000\000@m\201\032`\177\000\000p\316\177\313_\177\000\000\001", '\000' <repeats 15 times>, "\030\002", '\000' <repeats 14 times>..., m_used = 0}}, m_log = {m_heap = 0x0, m_list = {<ilist<mtr_buf_t::block_t, void>> = {sentinel_ = {next = 0x7f5fcb7fcfe0, prev = 0x7f5fcb7fcfe0}}, size_ = 1}, m_size = 0, m_first_block = {<ilist_node<void>> = {next = 0x7f5fcb7fcfc0, prev = 0x7f5fcb7fcfc0}, m_buf_end = 0, m_magic_n = 375767, m_data = "hv\201\032`\177\000\000hv\201\032`\177\000\000\020\016\000\000\000\000\000\000\030\334\326,\300U\000\000@\320\177\313_\177\000\000D\335\326,\300U\000\000\000\000\000\000\000\000\000\000@wy.\300U\000\000`\320\177\313_\177\000\000\030\334\326,\300U\000\000p\320\177\313_\177\000\000\220\335\326,\300U\000\000\220\320\177\313_\177\000\000@wy.\300U\000\000\220\320\177\313_\177\000\000\266@\327,\300U\000\000\320\320\177\313_\177\000\000@\f\210-\300U\000\000\340\320\177\313_\177\000\000\312K\327,\300U\000\000\256\345\000\000\000\000\000\000PSS\024\304\000\000\000\060\274&-\300U\000\000@\f\210-\300U\000\000PSS\024`\177\000\000\000"..., m_used = 0}}, m_user_space = 0x0, m_commit_lsn = 0, m_freed_space = 0x0, m_freed_pages = 0x0}
        _db_stack_frame_ = {func = 0x55c02d2dbbc0 "?func", file = 0x55c02d2dbbc6 "?file", level = 2147483649, line = -1, prev = 0x0}
        __PRETTY_FUNCTION__ = "dict_table_t* dict_load_table_one(const st_::span<const char>&, dict_err_ignore_t, dict_names_t&)"
        sys_index = 0x55c02e8c8198
        dfield = {data = 0x7f60149bc15d, ext = 0, spatial_status = 0, len = 6, type = {prtype = 0, mtype = 4, len = 654, mbminlen = 0, mbmaxlen = 0}}
        tuple = {info_bits = 0, n_fields = 1, n_fields_cmp = 1, fields = 0x7f5fcb7fca70, n_v_fields = 0, v_fields = 0x0, magic_n = 65478679}
        err = DB_CORRUPTION
        rec = 0x7f601456426b "test/t"
        table = 0x7f5fc0001f58
        heap = 0x7f5fc0002918
        index_load_err = DICT_ERR_IGNORE_FK_NOKEY
#9  0x000055c02cc11e1d in dict_sys_t::load_table (this=0x55c02d882280 <dict_sys>, name=@0x7f5fcb7fd350: {data_ = 0x7f60149bc15d "test/t", size_ = 6}, ignore=DICT_ERR_IGNORE_FK_NOKEY) at /data/src/10.6/storage/innobase/dict/dict0load.cc:2497
        fk_list = std::deque with 0 elements
        table = 0x7f5fcb7fd2a0
#10 0x000055c02cc12289 in dict_load_table_on_id (table_id=18, ignore_err=DICT_ERR_IGNORE_FK_NOKEY) at /data/src/10.6/storage/innobase/dict/dict0load.cc:2570
        rec = 0x7f60149bc155 ""
        id_buf = "\000\000\000\000\000\000\000\022"
        pcur = {btr_cur = {index = 0x55c02e8c8ad8, page_cur = {index = 0x0, rec = 0x7f60149bc155 "", offsets = 0x0, block = 0x7f60145435f0}, purge_node = 0x0, left_block = 0x0, thr = 0x0, flag = BTR_CUR_BINARY, tree_height = 1, up_match = 1, up_bytes = 0, low_match = 0, low_bytes = 0, n_fields = 0, n_bytes = 0, fold = 0, path_arr = 0x0, rtr_info = 0x0}, latch_mode = 1, old_stored = false, old_rec = 0x0, old_n_core_fields = 27968, old_n_fields = 0, rel_pos = 0, block_when_stored = {m_block = 0x0, m_page_id = {m_id = 0}}, modify_clock = 0, pos_state = BTR_PCUR_IS_POSITIONED, search_mode = PAGE_CUR_GE, trx_if_known = 0x0, old_rec_buf = 0x0, buf_size = 0}
        field = 0x7f60149bc15d "test/t"
        len = 6
        mtr = {m_start = true, m_commit = false, m_freeing_tree = false, m_last = 0x0, m_last_offset = 0, m_log_mode = 0, m_modifications = 0, m_made_dirty = 0, m_inside_ibuf = 0, m_trim_pages = 0, m_user_space_id = 0, m_memo = {m_heap = 0x0, m_list = {<ilist<mtr_buf_t::block_t, void>> = {sentinel_ = {next = 0x7f5fcb7fd500, prev = 0x7f5fcb7fd500}}, size_ = 1}, m_size = 32, m_first_block = {<ilist_node<void>> = {next = 0x7f5fcb7fd4e0, prev = 0x7f5fcb7fd4e0}, m_buf_end = 0, m_magic_n = 375767, m_data = "\000\000\000\000\000\000\000\000 \000\000\000\300U\000\000\360\065T\024`\177\000\000\001\000\000\000\000\000\000\000P\332\177\313_\177\000\000\022>\253,\300U\000\000\005\000\000\000\000\000\000\000\310`\215.\300U\000\000\300h\216.\300U\000\000ha\215.\300U\000\000@\211{\033`\177\000\000\b\326\177\313_\177\000\001\001\001\000\313_\177\000\000\000\000\000\000\000\000\000\000\324\003\f", '\000' <repeats 13 times>, "\300\325\177\313_\177\000\000\300\325\177\313\000\000\000\000h\"\362,\300U\000\000\000\000\000\000\000\000\000\000\350\257\355,\300U\000\000\000\000\000\000\000\000\000\000\360\325\177\313_\177\000\000D\335\326,\000\000\001\000\020\326\177\313_\177\000\000"..., m_used = 32}}, m_log = {m_heap = 0x0, m_list = {<ilist<mtr_buf_t::block_t, void>> = {sentinel_ = {next = 0x7f5fcb7fd740, prev = 0x7f5fcb7fd740}}, size_ = 1}, m_size = 0, m_first_block = {<ilist_node<void>> = {next = 0x7f5fcb7fd720, prev = 0x7f5fcb7fd720}, m_buf_end = 0, m_magic_n = 375767, m_data = "\000\000\000\000\000\000\000\000A\v\372\032`\177\000\000\240\327\177\313_\177\000\000\367\006\201,\300U\000\000\220\201\201\032`\177\000\000\070_`.\300U\000\000\300\327\177\313_\177\000\000\320\361Z.\300U\000\000\360\327\177\313_\177\000\000\227\310\201,\300U\000\000@m\201\032`\177\000\000`\225+.\300U\000\000\060\330\177\313_\177\000\000\243\331\177,\000\000\000\000\320\361Z.\300U\000\000@\260\177\032`\177\000\000@\022\221\032`\177\000\000\000\000\000\000\000\000\000\000\020\330\177\313_\177\000\000\244^\201,\300U\000\000\270u\201\032`\177\000\000@m\201\032`\177\000\000\060\330\177\313_\177\000\000<\"\201,\300U\000\000hv\201\032`\177\000\000"..., m_used = 0}}, m_user_space = 0x0, m_commit_lsn = 0, m_freed_space = 0x0, m_freed_pages = 0x0}
        __PRETTY_FUNCTION__ = "dict_table_t* dict_load_table_on_id(table_id_t, dict_err_ignore_t)"
        sys_table_ids = 0x55c02e8c8ad8
        dfield = {data = 0x7f5fcb7fd4b8, ext = 0, spatial_status = 0, len = 8, type = {prtype = 0, mtype = 4, len = 8, mbminlen = 0, mbmaxlen = 0}}
        tuple = {info_bits = 0, n_fields = 1, n_fields_cmp = 1, fields = 0x7f5fcb7fd360, n_v_fields = 0, v_fields = 0x0, magic_n = 65478679}
        table = 0x0
#11 0x000055c02cc042a9 in dict_table_open_on_id<true> (table_id=18, dict_locked=false, table_op=DICT_TABLE_OP_NORMAL, thd=0x55c02ec10418, mdl=0x55c02e8d6308) at /data/src/10.6/storage/innobase/dict/dict0dict.cc:860
        table = 0x0
#12 0x000055c02cab34f9 in row_purge_parse_undo_rec (node=0x55c02e8d6168, undo_rec=0x55c02e8e6a60 "", thr=0x55c02e8d60c8, updated_extern=0x7f5fcb7fda82) at /data/src/10.6/storage/innobase/row/row0purge.cc:940
        clust_index = 0x55c02cab5425 <std::deque<trx_purge_rec_t, std::allocator<trx_purge_rec_t> >::pop_front()+69>
        undo_no = 4
        table_id = 18
        roll_ptr = 140049412774464
        info_bits = 203 '\313'
        type = 10
        ptr = 0x55c02e8e6a65 "\001\347"
        __PRETTY_FUNCTION__ = "bool row_purge_parse_undo_rec(purge_node_t*, trx_undo_rec_t*, que_thr_t*, bool*)"
        trx_id = 18446744073709551615
#13 0x000055c02cab3e85 in row_purge (node=0x55c02e8d6168, undo_rec=0x55c02e8e6a60 "", thr=0x55c02e8d60c8) at /data/src/10.6/storage/innobase/row/row0purge.cc:1120
        updated_extern = false
#14 0x000055c02cab403c in row_purge_step (thr=0x55c02e8d60c8) at /data/src/10.6/storage/innobase/row/row0purge.cc:1172
        purge_rec = {undo_rec = 0x55c02e8e6a60 "", roll_ptr = 1688849880777191}
        node = 0x55c02e8d6168
#15 0x000055c02ca29b01 in que_thr_step (thr=0x55c02e8d60c8) at /data/src/10.6/storage/innobase/que/que0que.cc:653
        node = 0x55c02e8d6168
        old_thr = 0x55c02e8d60c8
        trx = 0x7f6015550080
        type = 13
        __PRETTY_FUNCTION__ = "que_thr_t* que_thr_step(que_thr_t*)"
#16 0x000055c02ca29d71 in que_run_threads_low (thr=0x55c02e8d60c8) at /data/src/10.6/storage/innobase/que/que0que.cc:709
        next_thr = 0x55c02e8d60c8
        trx = 0x7f6015550080
        __PRETTY_FUNCTION__ = "void que_run_threads_low(que_thr_t*)"
#17 0x000055c02ca29e85 in que_run_threads (thr=0x55c02e8d60c8) at /data/src/10.6/storage/innobase/que/que0que.cc:729
        trx = 0x7f6015550080
        __PRETTY_FUNCTION__ = "void que_run_threads(que_thr_t*)"
#18 0x000055c02caf4db7 in srv_task_execute () at /data/src/10.6/storage/innobase/srv/srv0srv.cc:1656
        thr = 0x55c02e8d60c8
        __PRETTY_FUNCTION__ = "bool srv_task_execute()"
#19 0x000055c02caf5327 in purge_worker_callback () at /data/src/10.6/storage/innobase/srv/srv0srv.cc:1899
        __PRETTY_FUNCTION__ = "void purge_worker_callback(void*)"
        ctx = 0x7f5fc0000b60
        thd = 0x55c02ec10418
#20 0x000055c02ccd00c4 in tpool::task_group::execute (this=0x55c02e30fce0 <purge_task_group>, t=0x55c02e30f900 <purge_worker_task>) at /data/src/10.6/tpool/task_group.cc:55
        lk = {_M_device = 0x55c02e30fd10 <purge_task_group+48>, _M_owns = false}
#21 0x000055c02ccd03e0 in tpool::task::execute (this=0x55c02e30f900 <purge_worker_task>) at /data/src/10.6/tpool/task.cc:32
No locals.
#22 0x000055c02ccc970d in tpool::thread_pool_generic::worker_main (this=0x55c02e7a25a0, thread_var=0x55c02e7b1b40) at /data/src/10.6/tpool/tpool_generic.cc:580
        task = 0x55c02e30f900 <purge_worker_task>
#23 0x000055c02cccfe64 in std::__invoke_impl<void, void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*> (__f=@0x7f5ff4001cb8: (void (tpool::thread_pool_generic::*)(tpool::thread_pool_generic * const, tpool::worker_data *)) 0x55c02ccc9678 <tpool::thread_pool_generic::worker_main(tpool::worker_data*)>, __t=@0x7f5ff4001cb0: 0x55c02e7a25a0) at /usr/include/c++/10/bits/invoke.h:73
No locals.
#24 0x000055c02cccfd54 in std::__invoke<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*> (__fn=@0x7f5ff4001cb8: (void (tpool::thread_pool_generic::*)(tpool::thread_pool_generic * const, tpool::worker_data *)) 0x55c02ccc9678 <tpool::thread_pool_generic::worker_main(tpool::worker_data*)>) at /usr/include/c++/10/bits/invoke.h:95
No locals.
#25 0x000055c02cccfc87 in std::thread::_Invoker<std::tuple<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*> >::_M_invoke<0ul, 1ul, 2ul> (this=0x7f5ff4001ca8) at /usr/include/c++/10/thread:264
No locals.
#26 0x000055c02cccfc24 in std::thread::_Invoker<std::tuple<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*> >::operator() (this=0x7f5ff4001ca8) at /usr/include/c++/10/thread:271
No locals.
#27 0x000055c02cccfc08 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*> > >::_M_run (this=0x7f5ff4001ca0) at /usr/include/c++/10/thread:215
No locals.
#28 0x00007f601b2cced0 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
No symbol table info available.
#29 0x00007f601b3dbea7 in start_thread (arg=<optimized out>) at pthread_create.c:477
        ret = <optimized out>
        pd = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140049412777728, 5024322719675952871, 140050651368094, 140050651368095, 140049412775488, 8396800, -4970166275466219801, -4937690529880101145}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = 0
#30 0x00007f601afd8def in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Couldn't reproduce on 10.3.



 Comments   
Comment by Thirunarayanan Balathandayuthapani [ 2022-07-05 ]

CREATE TABLE t (a CHAR(255), b INT) ENGINE=InnoDB CHARACTER SET utf32;
ALTER TABLE t DROP COLUMN a;
--source include/restart_mysqld.inc

InnoDB stores the metadata blob for the dropped column and its length (1021).
While loading the instant metadata from the clustered index, InnoDB deserialise
the metadata blob have the following condition:

                        if (c.ind() > DICT_MAX_FIXED_COL_LEN + 1) {
                                return true;
                        }

and it also have the following assert:

                       DBUG_ASSERT(fixed_len <= DICT_MAX_FIXED_COL_LEN + 1);

Note: DICT_MAX_FIXED_COL_LEN is 768 bytes.

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