Bug #54220 | Corruption or crash on SELECT FROM I_S + ALTER TABLE with innodb_file_per_table | ||
---|---|---|---|
Submitted: | 3 Jun 2010 22:22 | Modified: | 4 Aug 2010 11:00 |
Reporter: | Elena Stepanova | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | MySQL Server: InnoDB Plugin storage engine | Severity: | S2 (Serious) |
Version: | mysql-trunk, mysql-next-mr, 5.5.4-m3 | OS: | Any |
Assigned to: | Assigned Account | CPU Architecture: | Any |
[3 Jun 2010 22:22]
Elena Stepanova
[4 Jun 2010 21:23]
Elena Stepanova
Might be related to bug##49938
[29 Jul 2010 13:37]
Jimmy Yang
seems to be a dup of #54678
[29 Jul 2010 14:12]
Jimmy Yang
The root cause for this bug is the same as with 54678: We are allowing ::info to peaking into a changing metadata as in the case of bug #54678. A proper solution would be MySQL block access to the table while we are dropping/recreating the table. However, MySQL now takes a more relaxed approach due to following reason: our truncate table could take 2 approaches, 1) with drop/recreate the table 2) delete row-by-row (if table has foreign keys) And MySQL server layer has no idea which approach InnoDB is taking. To avoid locking metadata for long(as in option 2), it would allow ::info to access the metadata, which could see stale meatadata, as shown in this case. Need to work with MySQL for a good solution
[30 Jul 2010 4:26]
Jimmy Yang
Here is the step to reproduce the problem and confirm our theory. The steps are similar with 54678, the only difference is that in our case @@innodb_file_per_table is 1, in which case, the truncate table will truncate the whole table space (rather than index trees as in 54678). mysql> select @@innodb_file_per_table; +-------------------------+ | @@innodb_file_per_table | +-------------------------+ | 1 | +-------------------------+ 1 row in set (0.00 sec) CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, user_num CHAR(10) ) ENGINE = innodb PARTITION BY HASH(id) PARTITIONS 3; Same as 54678, the problem is between: 1) truncate table t1; (or truncate partition) 2) select * from information_schema.table where table_name = "t1"; 1. seesion 1: mysql> SELECT COUNT(*) FROM information_schema.partitions -> WHERE table_schema = 'test' -> AND table_name = 't1' -> AND partition_name IS NOT NULL; 2. break at btr_get_size(), first we come with flag == 2, let the session looping 3. session 2: mysql> ALTER TABLE t1 TRUNCATE PARTITION p0; 4. step through row_truncate_table_for_mysql(), let it go through fil_discard_tablespace(), notice space 15 is dropped, and the new space is 18. (gdb) p table->space $11 = 15 (gdb) n 2816 if (flags != ULINT_UNDEFINED (gdb) n 2817 && fil_discard_tablespace(space)) { (gdb) 2816 if (flags != ULINT_UNDEFINED (gdb) 2821 dict_hdr_get_new_id(NULL, NULL, &space); (gdb) n 2824 || fil_create_new_single_table_tablespace( (gdb) p space $12 = 18 5) let session 2 looping 6)Let session 1 continue in btr_get_size(), it comes to buf_page_get_gen(), and still try to find page 3 or space 15, but space 15 is dropped, so it start to print messages: Breakpoint 18, buf_page_get_gen (space=15, zip_size=0, offset=3, rw_latch=2, guess=0x0, mode=10, file=0x877e688 "/home/jy/work/mysql5.5_7/mysql-trunk-innodb/storage/innobase/include/btr0btr.ic", line=53, mtr=0xb1408ab8) at /home/jy/work/mysql5.5_7/mysql-trunk-innodb/storage/innobase/buf/buf0buf.c:2734 2734 ulint retries = 0; 1: block = (buf_block_t *) 0x0 (gdb) c Continuing. [Switching to Thread 0xb13dbb70 (LWP 4715)] Continuing. 100729 21:08:26 InnoDB: Error: trying to access tablespace 15 page no. 3, InnoDB: but the tablespace does not exist or is just being dropped. 100729 21:08:28 InnoDB: Error: trying to access tablespace 15 page no. 3, InnoDB: but the tablespace does not exist or is just being dropped. 100729 21:08:28 InnoDB: Error: trying to access tablespace 15 page no. 3, .... InnoDB: but the tablespace does not exist or is just being dropped. 100729 21:08:28 InnoDB: Error: trying to access tablespace 15 page no. 3, InnoDB: but the tablespace does not exist or is just being dropped. 100729 21:08:28 InnoDB: Error: trying to access tablespace 15 page no. 3,
[12 Sep 2011 16:32]
Avleen Vig
Hi folks, We tripped over this two days ago. Any update on when this might be fixed? Thanks!
[12 Sep 2011 16:34]
Avleen Vig
Hi folks, We tripped over this two days ago. Any update on when this might be fixed? Thanks!
[12 Sep 2011 16:34]
Avleen Vig
Hi folks, We tripped over this two days ago. Any update on when this might be fixed? Thanks!
[12 Sep 2011 16:54]
Calvin Sun
Hi Avleen, Which version of MySQL you are using? The original bug (#54678) was fixed almost a year ago. The fix should fix this issue too, Thanks, Calvin