Bug #57148 assert in close_thread_tables during OPTIMIZE TABLE
Submitted: 30 Sep 2010 16:16 Modified: 13 Oct 2010 11:55
Reporter: Matthias Leich Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:mysql-5.5-runtime OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Tags: assert

[30 Sep 2010 16:16] Matthias Leich
Description:
The assert happens in sql_base.cc:1411
--------------------------------------
if defined(ENABLED_DEBUG_SYNC)
  /* debug_sync may not be initialized for some slave threads */
  if (thd->debug_sync_control)
    DEBUG_SYNC(thd, "before_close_thread_tables");
#endif

  DBUG_ASSERT(thd->transaction.stmt.is_empty() || thd->in_sub_stmt || <------
              (thd->state_flags & Open_tables_state::BACKUPS_AVAIL));

The assert was found when testing with RQG
- 32 threads
- derivate of the WL5004_* grammar
  heavy concurrent DML and DDL

Result on mysql-5.5-runtime
revno: 3145 2010-09-24
---------------------------
hread 1 (Thread 8944):
#0  0x000000382860bd02 in pthread_kill () from /lib64/libpthread.so.0
#1  0x0000000000b57f05 in my_write_core (sig=6) at stacktrace.c:328
#2  0x000000000069bed1 in handle_segfault (sig=6) at mysqld.cc:2517
#3  <signal handler called>
#4  0x0000003827a30265 in raise () from /lib64/libc.so.6
#5  0x0000003827a31d10 in abort () from /lib64/libc.so.6
#6  0x0000003827a296e6 in __assert_fail () from /lib64/libc.so.6
#7  0x0000000000708886 in close_thread_tables (thd=0x11f2d270)
    at sql_base.cc:1411
#8  0x000000000070b667 in open_ltable (thd=0x11f2d270, table_list=0x11dfab48,
    lock_type=TL_WRITE, lock_flags=0) at sql_base.cc:5322
#9  0x000000000077b0d1 in mysql_admin_table (thd=0x11f2d270,
    tables=0x11dfab48, check_opt=0x11f2fa68,
    operator_name=0xcded82 "optimize", lock_type=TL_WRITE,
    open_for_modify=false, no_warnings_for_error=false, extra_open_options=0,
    prepare_func=0, operator_func=
    (int (handler::*)(handler *, THD *, HA_CHECK_OPT *)) 0x7fa61a <handler::ha_optimize(THD*, HA_CHECK_OPT*)>, view_operator_func=0) at sql_admin.cc:714
#10 0x000000000077ba83 in Optimize_table_statement::execute (this=0x11dfb050,
    thd=0x11f2d270) at sql_admin.cc:987
#11 0x00000000006b3982 in mysql_execute_command (thd=0x11f2d270)
    at sql_parse.cc:4375
#12 0x00000000006b3f13 in mysql_parse (thd=0x11f2d270,
    rawbuf=0x11dfaa30 "OPTIMIZE  TABLE testdb_S . t1_base1_N", length=37,
    parser_state=0x49e749a0) at sql_parse.cc:5554
#13 0x00000000006b54a0 in dispatch_command (command=COM_QUERY, thd=0x11f2d270,
    packet=0x11f15901 "", packet_length=38) at sql_parse.cc:1099
#14 0x00000000006b6896 in do_command (thd=0x11f2d270) at sql_parse.cc:771
#15 0x00000000006a5fca in do_handle_one_connection (thd_arg=0x11f2d270)
    at sql_connect.cc:1192
#16 0x00000000006a60bd in handle_one_connection (arg=0x11f2d270)
    at sql_connect.cc:1131
#17 0x000000382860673d in start_thread () from /lib64/libpthread.so.0
#18 0x0000003827ad3d1d in clone () from /lib64/libc.so.6

How to repeat:
I will come up with more information as soon as possible.
[1 Oct 2010 9:18] Jon Olav Hauglid
Possible duplicate of Bug#55930
[13 Oct 2010 11:55] Jon Olav Hauglid
Closing this bug as a duplicate of Bug#55930.