Bug #46339 crash on REPAIR TABLE merge table USE_FRM
Submitted: 22 Jul 2009 10:58 Modified: 1 Dec 2010 16:46
Reporter: Matthias Leich Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Merge storage engine Severity:S3 (Non-critical)
Version:5.1.37-debug,5.4 OS:Any
Assigned to: Ingo Strüwing CPU Architecture:Any
Tags: assertion, crash, merge, regression, Repair

[22 Jul 2009 10:58] Matthias Leich
Description:
My backtrace:

read 1 (process 11354):
# 12:48:48 #0  0x00007fb4b2c13ce6 in pthread_kill () from /lib64/libpthread.so.0
# 12:48:48 #1  0x0000000000b54410 in my_write_core (sig=6) at stacktrace.c:309
# 12:48:48 #2  0x00000000006ecf81 in handle_segfault (sig=6) at mysqld.cc:2718
# 12:48:48 #3  <signal handler called>
# 12:48:48 #4  0x00007fb4b1b0f5c5 in raise () from /lib64/libc.so.6
# 12:48:48 #5  0x00007fb4b1b10bb3 in abort () from /lib64/libc.so.6
# 12:48:48 #6  0x00007fb4b1b081e9 in __assert_fail () from /lib64/libc.so.6
# 12:48:48 #7  0x0000000000866ade in prepare_for_repair (thd=0x2121318, table_list=0x1fecea0, check_opt=0x2123790) at sql_table.cc:4321
# 12:48:48 #8  0x00000000008757bb in mysql_admin_table (thd=0x2121318, tables=0x1fecea0, check_opt=0x2123790, operator_name=0xd4d985 "repair", lock_type=TL_WRITE, open_for_modify=true, no_warnings_for_error=true, extra_open_options=32,
# 12:48:48     prepare_func=0x866812 <prepare_for_repair>, operator_func=0x84b0ce <handler::ha_repair(THD*, st_ha_check_opt*)>, view_operator_func=0) at sql_table.cc:4569
# 12:48:48 #9  0x0000000000877373 in mysql_repair_table (thd=0x2121318, tables=0x1fecea0, check_opt=0x2123790) at sql_table.cc:4962
# 12:48:48 #10 0x0000000000701017 in mysql_execute_command (thd=0x2121318) at sql_parse.cc:3017
# 12:48:48 #11 0x000000000070741e in mysql_parse (thd=0x2121318, inBuf=0x1fecb60 "REPAIR LOCAL TABLE t1_211 , t1_150 QUICK  USE_FRM", length=49, found_semicolon=0x43ea6f30) at sql_parse.cc:5942
# 12:48:48 #12 0x000000000070803c in dispatch_command (command=COM_QUERY, thd=0x2121318, packet=0x212bc79 "", packet_length=49) at sql_parse.cc:1061
# 12:48:48 #13 0x000000000070951a in do_command (thd=0x2121318) at sql_parse.cc:743
# 12:48:48 #14 0x00000000006f6893 in handle_one_connection (arg=0x2121318) at sql_connect.cc:1158
# 12:48:48 #15 0x00007fb4b2c0f040 in start_thread () from /lib64/libpthread.so.0
# 12:48:48 #16 0x00007fb4b1bb008d in clone () from /lib64/libc.so.6
# 12:48:48 #17 0x0000000000000000 in ?? ()

My environment:
- MySQL 5.4 (azalea) 2009-07-12
  ./BUILD/compile-pentium64-debug-max
- Linux OpenSuSE 11.0 (64 Bit)
- Intel Core2Duo

There might be some relation to
Bug#40863 REPAIR TABLE ... USE_FRM can corrupt data
but I am running with much more specific conditions
+ get a server crash.

How to repeat:
I will come up with a small replay testcase soon.
[23 Jul 2009 9:05] MySQL Verification Team
here's a simple testcase:

drop table if exists m1,t1;
create table t1(a int)engine=myisam;
create table m1(a int)engine=merge union=(t1) insert_method=last;
lock table m1 read;
repair table m1 use_frm;
[23 Jul 2009 9:08] MySQL Verification Team
regression, since 5.0 didn't crash. oops, the lock table isn't needed either. only affects debug builds.
[9 Oct 2009 14:23] Konstantin Osipov
Hello Ingo,
This seems to be a regression introduced by your fixes for MERGE tables in 5.1
Could you please take a look?
Thank you,
-kostja
[29 Mar 2010 16:26] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/104575

3431 Ingo Struewing	2010-03-29
      Bug#46339 - crash on REPAIR TABLE merge table USE_FRM
      
      REPAIR TABLE ... USE_FRM crashed debug servers.
      
      A wrong assert assumed that this operation would not be executed
      for MERGE tables.
      
      Replaced the assert by a note message, saying that the operation
      is not supported by the engine.
     @ mysql-test/r/merge.result
        Bug#46339 - crash on REPAIR TABLE merge table USE_FRM
        Added test result.
     @ mysql-test/t/merge.test
        Bug#46339 - crash on REPAIR TABLE merge table USE_FRM
        Added test.
     @ sql/sql_table.cc
        Bug#46339 - crash on REPAIR TABLE merge table USE_FRM
        Added generalized message reporting function.
        Replaced assert by a note message.
[30 Mar 2010 11:43] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/104624

3431 Ingo Struewing	2010-03-30
      Bug#46339 - crash on REPAIR TABLE merge table USE_FRM
      
      REPAIR TABLE ... USE_FRM crashed debug servers.
      
      A wrong assert assumed that this operation would not be executed
      for MERGE tables.
      
      Replaced the assert by a note message, saying that the operation
      is not supported by the engine.
     @ mysql-test/r/merge.result
        Bug#46339 - crash on REPAIR TABLE merge table USE_FRM
        Added test result.
     @ mysql-test/t/merge.test
        Bug#46339 - crash on REPAIR TABLE merge table USE_FRM
        Added test.
     @ sql/sql_table.cc
        Bug#46339 - crash on REPAIR TABLE merge table USE_FRM
        Added generalized message reporting function.
        Replaced assert by a note message.
[25 Apr 2010 17:06] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/106464

3431 Ingo Struewing	2010-04-25
      Bug#46339 - crash on REPAIR TABLE merge table USE_FRM
      
      REPAIR TABLE ... USE_FRM crashed debug servers.
      
      A wrong assert assumed that this operation would not be executed
      for MERGE tables.
      
      Replaced the assert by an error message, saying that a merge table
      cannot be repaired from .frm file.
     @ mysql-test/r/merge.result
        Bug#46339 - crash on REPAIR TABLE merge table USE_FRM
        Added test result.
     @ mysql-test/t/merge.test
        Bug#46339 - crash on REPAIR TABLE merge table USE_FRM
        Added test.
     @ sql/sql_table.cc
        Bug#46339 - crash on REPAIR TABLE merge table USE_FRM
        Added generalized message reporting function.
        Replaced assert by a note message.
[25 Apr 2010 17:12] Ingo Strüwing
Hi Sergey, on Davi's request the patch is different now. You might want to have another look.
[26 Apr 2010 13:44] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/106529

3431 Ingo Struewing	2010-04-26
      Bug#46339 - crash on REPAIR TABLE merge table USE_FRM
      
      REPAIR TABLE ... USE_FRM crashed debug servers.
      
      A wrong assert assumed that this operation would not be executed
      for MERGE tables.
      
      Removed the assert.
     @ mysql-test/r/merge.result
        Bug#46339 - crash on REPAIR TABLE merge table USE_FRM
        Added test result.
     @ mysql-test/t/merge.test
        Bug#46339 - crash on REPAIR TABLE merge table USE_FRM
        Added test.
     @ sql/sql_table.cc
        Bug#46339 - crash on REPAIR TABLE merge table USE_FRM
        Removed false assert.
[22 Sep 2010 10:43] Ingo Strüwing
Patch queued to mysql-5.1-bugteam and null-merged to mysql-5.5-merge.
The fix for 5.5 and up will be provided with the fix for Bug#56494
(Segfault in upgrade_shared_lock_to_exclusive() for REPAIR of merge table).
The testcase will be included in that fix too.
[28 Sep 2010 15:38] Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:alik@sun.com-20100928153607-tdsxkdm5cmuym5sq) (version source revid:alik@sun.com-20100928153508-0saa6v93dinqx1u7) (merge vers: 5.6.1-m4) (pib:21)
[28 Sep 2010 15:41] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100928153646-pqp8o1a92mxtuj3h) (version source revid:alik@sun.com-20100928153532-lr3gtvnyp2en4y75) (pib:21)
[28 Sep 2010 15:43] Bugs System
Pushed into mysql-5.5 5.5.7-rc (revid:alik@sun.com-20100928153459-4nudf4zgzlou4s7q) (version source revid:alik@sun.com-20100928153459-4nudf4zgzlou4s7q) (merge vers: 5.5.7-rc) (pib:21)
[1 Nov 2010 18:59] Bugs System
Pushed into mysql-5.1 5.1.53 (revid:build@mysql.com-20101101184443-o2olipi8vkaxzsqk) (version source revid:build@mysql.com-20101101184443-o2olipi8vkaxzsqk) (merge vers: 5.1.53) (pib:21)
[3 Nov 2010 14:26] Tony Bedford
An entry has been added to the 5.6.1, 5.5.7, and 5.1.52 changelogs:

        Using REPAIR TABLE table USE_FRM on a MERGE table caused the
        server to crash.
[9 Nov 2010 19:42] Bugs System
Pushed into mysql-5.5 5.5.7-rc (revid:sunanda.menon@sun.com-20101109182959-otkxq8vo2dcd13la) (version source revid:marko.makela@oracle.com-20100824081003-v4ecy0tga99cpxw2) (merge vers: 5.1.50) (pib:21)
[13 Nov 2010 16:16] Bugs System
Pushed into mysql-trunk 5.6.99-m5 (revid:alexander.nozdrin@oracle.com-20101113155825-czmva9kg4n31anmu) (version source revid:marko.makela@oracle.com-20100824081003-v4ecy0tga99cpxw2) (merge vers: 5.1.50) (pib:21)
[13 Nov 2010 16:27] Bugs System
Pushed into mysql-next-mr (revid:alexander.nozdrin@oracle.com-20101113160336-atmtmfb3mzm4pz4i) (version source revid:marko.makela@oracle.com-20100824081003-v4ecy0tga99cpxw2) (pib:21)