Details
-
Bug
-
Status: Done
-
Medium
-
Resolution: Fixed
-
8.0.x, Not 5.7.x
-
None
-
Yes
Description
If a table created using file-per-tablespace is attempted to be dropped after tablespace is discarded, it leads to a crash.
The issue can be reproduced on upstream as well. Please find the testcase below
CREATE TABLE t1(a int);
INSERT INTO t1 VALUES (10);
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
ALTER TABLE t1 DISCARD TABLESPACE;
DROP TABLE t1;
Stacktrace:
#0 __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56 #1 0x000055a02ffd943f in my_write_core (sig=6) at /home/mohit.joshi/upstream-8.0/mysys/stacktrace.cc:308 #2 0x000055a02ea23c57 in handle_fatal_signal (sig=6) at /home/mohit.joshi/upstream-8.0/sql/signal_handler.cc:171 #3 <signal handler called> #4 __GI_raise ([email protected]=6) at ../sysdeps/unix/sysv/linux/raise.c:50 #5 0x00007f4597490859 in __GI_abort () at abort.c:79 #6 0x000055a0304ac1dc in ut_dbg_assertion_failed (expr=0x55a03229c230 "block->page.id.space() == index->space", file=0x55a03229be38 "/home/mohit.joshi/upstream-8.0/storage/innobase/btr/btr0sea.cc", line=1118) at /home/mohit.joshi/upstream-8.0/storage/innobase/ut/ut0dbg.cc:99 #7 0x000055a03053bb59 in btr_search_drop_page_hash_index (block=0x7f4573b197b8) at /home/mohit.joshi/upstream-8.0/storage/innobase/btr/btr0sea.cc:1118 #8 0x000055a0305b258f in buf_LRU_free_page (bpage=0x7f4573b197b8, zip=true) at /home/mohit.joshi/upstream-8.0/storage/innobase/buf/buf0lru.cc:1888 #9 0x000055a03056268d in buf_page_free_stale (buf_pool=0x7f4584330520, bpage=0x7f4573b197b8) at /home/mohit.joshi/upstream-8.0/storage/innobase/buf/buf0buf.cc:5253 #10 0x000055a0305629d8 in buf_page_free_stale (buf_pool=0x7f4584330520, bpage=0x7f4573b197b8, hash_lock=0x7f457c641fb0) at /home/mohit.joshi/upstream-8.0/storage/innobase/buf/buf0buf.cc:5307 #11 0x000055a03055eba9 in Buf_fetch_other::get (this=0x7f45881d6920, [email protected]: 0x7f4573b197b8) at /home/mohit.joshi/upstream-8.0/storage/innobase/buf/buf0buf.cc:3556 #12 0x000055a030571c05 in Buf_fetch<Buf_fetch_other>::single_page (this=0x7f45881d6920) at /home/mohit.joshi/upstream-8.0/storage/innobase/buf/buf0buf.cc:4097 #13 0x000055a03055f1f3 in buf_page_get_gen (page_id=..., page_size=..., rw_latch=2, guess=0x0, mode=Page_fetch::PEEK_IF_IN_POOL, file=0x55a03229be38 "/home/mohit.joshi/upstream-8.0/storage/innobase/btr/btr0sea.cc", line=1259, mtr=0x7f45881d6b80, dirty_with_no_latch=false) at /home/mohit.joshi/upstream-8.0/storage/innobase/buf/buf0buf.cc:4304 #14 0x000055a03053c2ea in btr_search_drop_page_hash_when_freed (page_id=..., page_size=...) at /home/mohit.joshi/upstream-8.0/storage/innobase/btr/btr0sea.cc:1258 #15 0x000055a03053c6c3 in btr_drop_next_batch (page_size=..., first=0x7f45881d71a0, last=0x7f45881d71a8) at /home/mohit.joshi/upstream-8.0/storage/innobase/btr/btr0sea.cc:1325 #16 0x000055a03053c953 in btr_drop_ahi_for_table (table=0x7f44d016e040) at /home/mohit.joshi/upstream-8.0/storage/innobase/btr/btr0sea.cc:1362 #17 0x000055a030372c4e in row_drop_table_from_cache (table=0x7f44d016e040, trx=0x7f458a529078) at /home/mohit.joshi/upstream-8.0/storage/innobase/row/row0mysql.cc:3726 #18 0x000055a030373ef7 in row_drop_table_for_mysql (name=0x7f45881d7bf0 "test/t1", trx=0x7f458a529078, nonatomic=true, handler=0x0) at /home/mohit.joshi/upstream-8.0/storage/innobase/row/row0mysql.cc:4124 #19 0x000055a03015b2a6 in innobase_basic_ddl::delete_impl<dd::Table> (thd=0x7f44d0001040, name=0x7f45881d9150 "./test/t1", dd_tab=0x7f44d019fe68, td=0x0) at /home/mohit.joshi/upstream-8.0/storage/innobase/handler/ha_innodb.cc:13835 #20 0x000055a030134cd6 in ha_innobase::delete_table (this=0x7f44d0ac0f48, name=0x7f45881d9150 "./test/t1", table_def=0x7f44d019fe68) at /home/mohit.joshi/upstream-8.0/storage/innobase/handler/ha_innodb.cc:14857 #21 0x000055a02ebdf099 in handler::ha_delete_table (this=0x7f44d0ac0f48, name=0x7f45881d9150 "./test/t1", table_def=0x7f44d019fe68) at /home/mohit.joshi/upstream-8.0/sql/handler.cc:4978 #22 0x000055a02ebd612e in ha_delete_table (thd=0x7f44d0001040, table_type=0x55a037099b40, path=0x7f45881d9150 "./test/t1", db=0x7f44d0aca1d8 "test", alias=0x7f44d0ac9ac0 "t1", table_def=0x7f44d019fe68, generate_warning=true) at /home/mohit.joshi/upstream-8.0/sql/handler.cc:2554 #23 0x000055a02e8da89f in drop_base_table (thd=0x7f44d0001040, drop_ctx=..., table=0x7f44d0ac9bc0, atomic=true, post_ddl_htons=0x7f45881da6c0, fk_invalidator=0x7f45881da6f0, safe_to_release_mdl=0x7f45881d9510) at /home/mohit.joshi/upstream-8.0/sql/sql_table.cc:2891 #24 0x000055a02e8dba66 in mysql_rm_table_no_locks (thd=0x7f44d0001040, tables=0x7f44d0ac9bc0, if_exists=false, drop_temporary=false, drop_database=false, dropped_non_atomic_flag=0x7f45881da641, post_ddl_htons=0x7f45881da6c0, fk_invalidator=0x7f45881da6f0, safe_to_release_mdl=0x7f45881da670) at /home/mohit.joshi/upstream-8.0/sql/sql_table.cc:3245 #25 0x000055a02e8d7629 in mysql_rm_table (thd=0x7f44d0001040, tables=0x7f44d0ac9bc0, if_exists=false, drop_temporary=false) at /home/mohit.joshi/upstream-8.0/sql/sql_table.cc:1622 #26 0x000055a02e81620c in mysql_execute_command (thd=0x7f44d0001040, first_level=true) at /home/mohit.joshi/upstream-8.0/sql/sql_parse.cc:3437 #27 0x000055a02e81b4dd in dispatch_sql_command (thd=0x7f44d0001040, parser_state=0x7f45881dbb90) at /home/mohit.joshi/upstream-8.0/sql/sql_parse.cc:5000 #28 0x000055a02e8115fe in dispatch_command (thd=0x7f44d0001040, com_data=0x7f45881dcb80, command=COM_QUERY) at /home/mohit.joshi/upstream-8.0/sql/sql_parse.cc:1841 #29 0x000055a02e80faa1 in do_command (thd=0x7f44d0001040) at /home/mohit.joshi/upstream-8.0/sql/sql_parse.cc:1320 #30 0x000055a02ea0c72d in handle_connection (arg=0x55a0370c7bd0) at /home/mohit.joshi/upstream-8.0/sql/conn_handler/connection_handler_per_thread.cc:301 #31 0x000055a0308c1498 in pfs_spawn_thread (arg=0x55a03715cb40) at /home/mohit.joshi/upstream-8.0/storage/perfschema/pfs.cc:2898 #32 0x00007f45979b2609 in start_thread (arg=<optimized out>) at pthread_create.c:477 #33 0x00007f459758d293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95