Bug #59999 mysqlhotcopy returns error and crashes debug server
Submitted: 7 Feb 2011 21:11
Reporter: Sveta Smirnova Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Locking Severity:S3 (Non-critical)
Version:5.5, 5.6.2 OS:Any
Assigned to: CPU Architecture:Any
Tags: regression
Triage: Needs Triage: D1 (Critical)

[7 Feb 2011 21:11] Sveta Smirnova
Description:
I believe cause of error is same as in bug #58927.

mysqlhotcopy fails with 

Failed to store master position: DBD::mysql::db do failed: Table 'log_pos' was not locked with LOCK TABLES at ./bin/mysqlhotcopy line 770.

Then debug server crashes with:

mysqld: /users/ssmirnova/blade12/src/mysql-trunk/sql/mdl.cc:1550: bool MDL_context::try_acquire_lock_impl(MDL_request*, MDL_ticket**): Assertion `mdl_request->type != MDL_EXCLUSIVE || is_lock_owner(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE)' failed.
110207 21:58:54 - mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.

key_buffer_size=16384
read_buffer_size=262144
max_used_connections=1
max_threads=151
thread_count=1
connection_count=1
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 50186 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0xb57f900
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0x496500a0 thread_stack 0x20000
./bin/mysqld(my_print_stacktrace+0x35)[0x919e4e]
./bin/mysqld(handle_segfault+0x31f)[0x54c9c1]
/lib64/libpthread.so.0[0x3429e0dd40]
/lib64/libc.so.6(gsignal+0x35)[0x3429230015]
/lib64/libc.so.6(abort+0x110)[0x3429231980]
/lib64/libc.so.6(__assert_fail+0xf6)[0x3429229726]
./bin/mysqld(_ZN11MDL_context21try_acquire_lock_implEP11MDL_requestPP10MDL_ticket+0x77)[0x6223bf]
./bin/mysqld(_ZN11MDL_context12acquire_lockEP11MDL_requestm+0x128)[0x622ad2]
./bin/mysqld(_ZN11MDL_context32upgrade_shared_lock_to_exclusiveEP10MDL_ticketm+0x16d)[0x6233db]
./bin/mysqld(_Z24wait_while_table_is_usedP3THDP5TABLE17ha_extra_function+0xb7)[0x674ea7]
./bin/mysqld(_Z19close_cached_tablesP3THDP10TABLE_LISTbm+0x3e6)[0x6726da]
./bin/mysqld(_Z20reload_acl_and_cacheP3THDmP10TABLE_LISTPi+0x642)[0x6eed06]
./bin/mysqld(_Z21mysql_execute_commandP3THD+0x4f6b)[0x6d0324]
./bin/mysqld(_Z11mysql_parseP3THDPcjP12Parser_state+0x214)[0x6d51fb]
./bin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0xae5)[0x6c95b5]
./bin/mysqld(_Z10do_commandP3THD+0x297)[0x6c88bd]
./bin/mysqld(_Z24do_handle_one_connectionP3THD+0x468)[0x6a1a6c]
./bin/mysqld(handle_one_connection+0x33)[0x6a15fd]
/lib64/libpthread.so.0[0x3429e061b5]
/lib64/libc.so.6(clone+0x6d)[0x34292cd39d]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0xb5d4760): FLUSH TABLES /*!32323 `test`.`u` */
Connection ID (thread ID): 1
Status: NOT_KILLED

How to repeat:
create table u like mysql.user;
create table t1 like mysql.user;
alter table u engine=innodb;
insert into u select * from mysql.user;
insert into t1 select * from mysql.user;

CREATE TABLE log_pos (
      host varchar(60) NOT NULL,
      time_stamp timestamp NOT NULL,
      log_file varchar(32),
      log_pos int(11),
      master_host varchar(60),
      master_log_file varchar(32),
      master_log_pos int(11),
      PRIMARY KEY (host,time_stamp)
 );

Then call mysqlhotcopy:

$./bin/mysqlhotcopy -S /tmp/mysql_ssmirnova.sock -u root --allowold  --record_log_pos=dba.log_pos test./^u/ test2 
Deleting previous 'old' hotcopy directory ('/users/ssmirnova/blade12/build/mysql-trunk/data/test2_old')
Existing hotcopy directory renamed to '/users/ssmirnova/blade12/build/mysql-trunk/data/test2_old'
Locked 1 tables in 0 seconds.
Flushed tables (`test`.`u`) in 0 seconds.
Failed to store master position: DBD::mysql::db do failed: Table 'log_pos' was not locked with LOCK TABLES at ./bin/mysqlhotcopy line 770.

DBD::mysql::db do failed: Lost connection to MySQL server during query at ./bin/mysqlhotcopy line 503.
[1]+  Exit 1                  ./bin/mysqld --defaults-file=support-files/my-small.cnf --basedir=. --datadir=./data --port=33051 --socket=/tmp/mysql_ssmirnova.sock --log-error --log-bin
[7 Feb 2011 22:32] Jon Olav Hauglid
See also Bug#57649