[MDEV-542] Galera: Assertion `! is_set() || can_overwrite_status' failed in Diagnostics_area::set_ error_status on concurrent DDL Created: 2012-09-20  Updated: 2012-10-23  Resolved: 2012-10-23

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 5.5.25-galera
Fix Version/s: 5.5.28a-galera

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Seppo Jaakola
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-468 Galera: Server does not honor metadat... Closed

 Description   

mysqld: sql/sql_error.cc:422: void Diagnostics_area::set_error_status(THD*, uint, const char*, const char*): Assertion `! is_set() || can_overwrite_status' failed.
120920 22:53:22 [ERROR] mysqld got signal 6 ;

#6  0x00007fec6af93d4d in __GI___assert_fail (assertion=0xd51db0 "! is_set() || can_overwrite_status", file=<optimized out>, line=422, function=<optimized out>) at assert.c:8 1
#7  0x00000000005f34d7 in Diagnostics_area::set_error_status (this=0x7fec58078830, thd=0x7fec58074f10, sql_errno_arg=1213, message_arg=0x7fec6c5a40b0 "Deadlock found when try ing to get lock; try restarting transaction", sqlstate=0xd672db "40001") at /home/elens t/maria-5.5-galera/sql/sql_error.cc:422
#8  0x00000000005db7a0 in THD::raise_condition (this=0x7fec58074f10, sql_errno=1213, sqlstate=0xd672db "40001", level=MYSQL_ERROR::WARN_LEVEL_ERROR, msg=0x7fec6c5a40b0 "Deadl ock found when trying to get lock; try restarting transaction") at maria-5 .5-galera/sql/sql_class.cc:1256
#9  0x0000000000566121 in my_message_sql (error=1213, str=0x7fec6c5a40b0 "Deadlock found when trying to get lock; try restarting transaction", MyFlags=0) at mari a-5.5-galera/sql/mysqld.cc:3273
#10 0x0000000000cd65e3 in my_error (nr=1213, MyFlags=0) at maria-5.5-galera/mysys/my_error.c:96
#11 0x00000000007e33df in ha_commit_trans (thd=0x7fec58074f10, all=false) at maria-5.5-galera/sql/handler.cc:1286
#12 0x000000000072c089 in trans_commit_stmt (thd=0x7fec58074f10) at maria-5.5-galera/sql/transaction.cc:325
#13 0x000000000060272c in select_create::send_eof (this=0x371c150) at maria-5.5-galera/sql/sql_insert.cc:4173
#14 0x0000000000650176 in JOIN::exec (this=0x371c228) at maria-5.5-galera/sql/sql_select.cc:2236
#15 0x0000000000652f7f in mysql_select (thd=0x7fec58074f10, rref_pointer_array=0x7fec58077e68, tables=0x0, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0,  having=0x0, proc_param=0x0, select_options=2416184064, result=0x371c150, unit=0x7fec580 77538, select_lex=0x7fec58077c10) at maria-5.5-galera/sql/sql_select.cc:30 53
#16 0x0000000000649ab5 in handle_select (thd=0x7fec58074f10, lex=0x7fec58077488, result=0x371c150, setup_tables_done_option=0) at maria-5.5-galera/sql/sql_select .cc:316
#17 0x000000000061848b in mysql_execute_command (thd=0x7fec58074f10) at maria-5.5-galera/sql/sql_parse.cc:2859
#18 0x000000000062307c in mysql_parse (thd=0x7fec58074f10, rawbuf=0x371b718 "CREATE TABLE test.t1 AS SELECT SLEEP(5)", length=39, parser_state=0x7fec6c5a5550) at /home/elenst /maria-5.5-galera/sql/sql_parse.cc:6271
#19 0x0000000000622216 in wsrep_mysql_parse (thd=0x7fec58074f10, rawbuf=0x371b718 "CREATE TABLE test.t1 AS SELECT SLEEP(5)", length=39, parser_state=0x7fec6c5a5550) at /home/ elenst/maria-5.5-galera/sql/sql_parse.cc:6047
#20 0x0000000000614787 in dispatch_command (command=COM_QUERY, thd=0x7fec58074f10, packet=0x7fec580cfa21 "CREATE TABLE test.t1 AS SELECT SLEEP(5)", packet_length=39) at /home /elenst/maria-5.5-galera/sql/sql_parse.cc:1227
#21 0x00000000006135ef in do_command (thd=0x7fec58074f10) at maria-5.5-galera/sql/sql_parse.cc:891
#22 0x000000000071a3a0 in do_handle_one_connection (thd_arg=0x7fec58074f10) at maria-5.5-galera/sql/sql_connect.cc:1278
#23 0x0000000000719d78 in handle_one_connection (arg=0x7fec58074f10) at maria-5.5-galera/sql/sql_connect.cc:1186

Query (0x371b718): CREATE TABLE test.t1 AS SELECT SLEEP(5)
Connection ID (thread ID): 4
Status: KILL_QUERY

How to reproduce manually

# Start cluster (1 node is enough, or it can be more)
# connect to a node
# run 
USE test;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 AS SELECT SLEEP(30);
 
# while the last statement is running, open another connection to the same node and run
DROP TABLE IF EXISTS test.t1;
 
# Observe the crash

MTR test case

# Run as
# perl --mysqld=--wsrep_provider=/home/elenst/galera-23.2.1-src/libgalera_smm.so --mysqld=--binlog-format=row --mysqld=--innodb --mysqld=--default-storage-engine=InnoDB --mysqld=--innodb_autoinc_lock_mode=2 --mysqld=--innodb_locks_unsafe_for_binlog=1 --mysqld=--innodb_flush_log_at_trx_commit=0 --mysqld=--wsrep_cluster_address=gcomm:// ./mtr main.t1 
 
DROP TABLE IF EXISTS t1;
--send CREATE TABLE t1 AS SELECT SLEEP(3)
--sleep 1
--connect (con1,localhost,root,,)
DROP TABLE IF EXISTS t1;
--connection default
--reap

Shell script

#!/bin/bash
 
port=${1:-3306}
client=${2:-mysql}
 
$client --no-defaults -uroot --protocol=tcp --port=$port -e "DROP TABLE IF EXISTS test.t1"
$client --no-defaults -uroot --protocol=tcp --port=$port -e "CREATE TABLE test.t1 AS SELECT SLEEP(5)" &
sleep 1
$client --no-defaults -uroot --protocol=tcp --port=$port -e "DROP TABLE IF EXISTS test.t1"
 
fg
$client --no-defaults -uroot --protocol=tcp --port=$port -e "SHOW STATUS LIKE 'wsrep%'"
 

My server command line

maria-5.5-galera/sql/mysqld --no-defaults --datadir=maria-5.5-galera/data1 --wsrep_provider=galera-23.2.1-src/libgalera_smm.so --wsrep_sst_method=rsync --core --binlog-format=row --default-storage-engine=InnoDB --innodb_autoinc_lock_mode=2 --innodb_locks_unsafe_for_binlog=1 --innodb_flush_log_at_trx_commit=0 --log-error=log.err --basedir=maria-5.5-galera/ --port=8306 --loose-lc-messages-dir=maria-5.5-galera/sql/share --socket=/tmp/galera-1.sock --tmpdir=maria-5.5-galera/data1/tmp --general-log=1 --wsrep_cluster_address=gcomm:// --core

Reproducible on revno 3354 and revno 3351.



 Comments   
Comment by Seppo Jaakola [ 2012-10-15 ]

This issue is due to MySQL calling my_ok() (and thus sending OK status for client), after CREATE...SELECT has been aborted by kill query. A fix to workaround this has been pushed in upstream (https://bugs.launchpad.net/codership-mysql/+bug/1052002).
Fix will be available after wsrep patch merge, this is tracked by: https://bugs.launchpad.net/codership-mysql/+bug/1066784

Comment by Seppo Jaakola [ 2012-10-23 ]

Fix was merged from upstream as part of revision: http://bazaar.launchpad.net/~maria-captains/maria/maria-5.5-galera/revision/3355

Generated at Thu Feb 08 06:29:31 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.