[MDEV-24912] Assertion `state() == s_executing || state() == s_prepared || state() == s_committing || state() == s_must_abort || state() == s_replaying' failed. Created: 2021-02-18  Updated: 2023-10-31  Resolved: 2023-09-26

Status: Closed
Project: MariaDB Server
Component/s: Galera
Affects Version/s: 10.4, 10.5, 10.6
Fix Version/s: 10.4.32, 10.5.23, 10.6.16, 10.10.7, 10.11.6, 11.0.4, 11.1.3

Type: Bug Priority: Major
Reporter: Ramesh Sivaraman Assignee: Julius Goryavsky
Resolution: Fixed Votes: 0
Labels: debug, not-10.2, not-10.3

Issue Links:
Relates
relates to MDEV-18935 Galera test mysql-wsrep#198 sporaric ... Closed
relates to MDEV-22897 mariadb server crashed on 2 instances... Closed
relates to MDEV-28378 galera.galera_as_slave_ctas fails wit... Stalled

 Description   

use test
CREATE TABLE t1 (c1 int, UNIQUE INDEX (c1)) engine=innodb;
CREATE TABLE t2 (c1 int);
CREATE TEMPORARY TABLE t1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2) INSERT_METHOD=LAST;
cache index t1,t2 in default;

10.6.0 b19ec8848c9463b86d62601dffb67c75e3dfbd70 (Debug)

mysqld: /test/10.6_dbg/wsrep-lib/src/transaction.cpp:444: int wsrep::transaction::before_commit(): Assertion `state() == s_executing || state() == s_prepared || state() == s_committing || state() == s_must_abort || state() == s_replaying' failed.

10.6.0 b19ec8848c9463b86d62601dffb67c75e3dfbd70 (Debug)

Core was generated by `/test/GAL_MD120221-mariadb-10.6.0-linux-x86_64-dbg/bin/mysqld --defaults-file=/'.
Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
    at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
[Current thread is 1 (Thread 0x15508d535700 (LWP 1759976))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
#1  0x00005560f29e5e4f in my_write_core (sig=sig@entry=6) at /test/10.6_dbg/mysys/stacktrace.c:424
#2  0x00005560f21792e5 in handle_fatal_signal (sig=6) at /test/10.6_dbg/sql/signal_handler.cc:330
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#5  0x00001550b0a2e859 in __GI_abort () at abort.c:79
#6  0x00001550b0a2e729 in __assert_fail_base (fmt=0x1550b0bc4588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x5560f30dc200 "state() == s_executing || state() == s_prepared || state() == s_committing || state() == s_must_abort || state() == s_replaying", file=0x5560f30db178 "/test/10.6_dbg/wsrep-lib/src/transaction.cpp", line=444, function=<optimized out>) at assert.c:92
#7  0x00001550b0a3ff36 in __GI___assert_fail (assertion=assertion@entry=0x5560f30dc200 "state() == s_executing || state() == s_prepared || state() == s_committing || state() == s_must_abort || state() == s_replaying", file=file@entry=0x5560f30db178 "/test/10.6_dbg/wsrep-lib/src/transaction.cpp", line=line@entry=444, function=function@entry=0x5560f30dc1a0 "int wsrep::transaction::before_commit()") at assert.c:101
#8  0x00005560f2b16561 in wsrep::transaction::before_commit (this=this@entry=0x15503c0072a0) at /test/10.6_dbg/wsrep-lib/src/transaction.cpp:530
#9  0x00005560f217c47a in wsrep::client_state::before_commit (this=0x15503c007238) at /test/10.6_dbg/wsrep-lib/include/wsrep/client_state.hpp:503
#10 wsrep_before_commit (thd=thd@entry=0x15503c000db8, all=all@entry=false) at /test/10.6_dbg/sql/wsrep_trans_observer.h:277
#11 0x00005560f2192d65 in ha_commit_trans (thd=thd@entry=0x15503c000db8, all=all@entry=false) at /test/10.6_dbg/sql/handler.cc:1707
#12 0x00005560f20240c8 in trans_commit_stmt (thd=thd@entry=0x15503c000db8) at /test/10.6_dbg/sql/transaction.cc:472
#13 0x00005560f202214b in mysql_admin_table (thd=thd@entry=0x15503c000db8, tables=tables@entry=0x15503c0127a8, check_opt=check_opt@entry=0x15508d533c60, operator_name=operator_name@entry=0x5560f2e30219 "assign_to_keycache", lock_type=lock_type@entry=TL_READ_NO_INSERT, org_open_for_modify=org_open_for_modify@entry=false, repair_table_use_frm=false, extra_open_options=0, prepare_func=0x0, operator_func=&virtual table offset 744, view_operator_func=0x0) at /test/10.6_dbg/sql/sql_admin.cc:1255
#14 0x00005560f2022d33 in mysql_assign_to_keycache (thd=thd@entry=0x15503c000db8, tables=tables@entry=0x15503c0127a8, key_cache_name=key_cache_name@entry=0x15503c005c80) at /test/10.6_dbg/sql/sql_admin.cc:1341
#15 0x00005560f1eb3d65 in mysql_execute_command (thd=thd@entry=0x15503c000db8) at /test/10.6_dbg/sql/sql_parse.cc:3965
#16 0x00005560f1e9faaa in mysql_parse (thd=thd@entry=0x15503c000db8, rawbuf=rawbuf@entry=0x15503c0126c0 "cache index t1,t2 in default", length=length@entry=28, parser_state=parser_state@entry=0x15508d5343d0) at /test/10.6_dbg/sql/sql_parse.cc:7906
#17 0x00005560f1e9f406 in wsrep_mysql_parse (thd=thd@entry=0x15503c000db8, rawbuf=0x15503c0126c0 "cache index t1,t2 in default", length=28, parser_state=parser_state@entry=0x15508d5343d0) at /test/10.6_dbg/sql/sql_parse.cc:7720
#18 0x00005560f1eadc7c in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x15503c000db8, packet=packet@entry=0x15503c01be49 "", packet_length=packet_length@entry=28) at /test/10.6_dbg/sql/sql_class.h:1295
#19 0x00005560f1eb0fa4 in do_command (thd=0x15503c000db8) at /test/10.6_dbg/sql/sql_parse.cc:1365
#20 0x00005560f200def2 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5560f52882b8, put_in_cache=put_in_cache@entry=true) at /test/10.6_dbg/sql/sql_connect.cc:1410
#21 0x00005560f200e5f9 in handle_one_connection (arg=arg@entry=0x5560f52882b8) at /test/10.6_dbg/sql/sql_connect.cc:1312
#22 0x00005560f24c4f35 in pfs_spawn_thread (arg=0x5560f52d85e8) at /test/10.6_dbg/storage/perfschema/pfs.cc:2201
#23 0x00001550b0f3c609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#24 0x00001550b0b2b293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

10.5.9 7fb528d7226819063046c6a70a21511b3620e844 (Debug)

mysqld: /test/10.5_dbg/wsrep-lib/src/transaction.cpp:444: int wsrep::transaction::before_commit(): Assertion `state() == s_executing || state() == s_prepared || state() == s_committing || state() == s_must_abort || state() == s_replaying' failed.

10.5.9 7fb528d7226819063046c6a70a21511b3620e844 (Debug)

Core was generated by `/test/GAL_MD120221-mariadb-10.5.9-linux-x86_64-dbg/bin/mysqld --defaults-file=/'.
Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
    at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
[Current thread is 1 (Thread 0x14a3fdfb4700 (LWP 60144))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
#1  0x000055846e686957 in my_write_core (sig=sig@entry=6) at /test/10.5_dbg/mysys/stacktrace.c:424
#2  0x000055846ddd5e9f in handle_fatal_signal (sig=6) at /test/10.5_dbg/sql/signal_handler.cc:330
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#5  0x000014a4154ba859 in __GI_abort () at abort.c:79
#6  0x000014a4154ba729 in __assert_fail_base (fmt=0x14a415650588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55846ed81e40 "state() == s_executing || state() == s_prepared || state() == s_committing || state() == s_must_abort || state() == s_replaying", file=0x55846ed80db8 "/test/10.5_dbg/wsrep-lib/src/transaction.cpp", line=444, function=<optimized out>) at assert.c:92
#7  0x000014a4154cbf36 in __GI___assert_fail (assertion=assertion@entry=0x55846ed81e40 "state() == s_executing || state() == s_prepared || state() == s_committing || state() == s_must_abort || state() == s_replaying", file=file@entry=0x55846ed80db8 "/test/10.5_dbg/wsrep-lib/src/transaction.cpp", line=line@entry=444, function=function@entry=0x55846ed81de0 "int wsrep::transaction::before_commit()") at assert.c:101
#8  0x000055846e7b7361 in wsrep::transaction::before_commit (this=this@entry=0x14a394007278) at /test/10.5_dbg/wsrep-lib/src/transaction.cpp:530
#9  0x000055846ddd9034 in wsrep::client_state::before_commit (this=0x14a394007210) at /test/10.5_dbg/wsrep-lib/include/wsrep/client_state.hpp:503
#10 wsrep_before_commit (thd=thd@entry=0x14a394000db8, all=all@entry=false) at /test/10.5_dbg/sql/wsrep_trans_observer.h:277
#11 0x000055846ddef920 in ha_commit_trans (thd=thd@entry=0x14a394000db8, all=all@entry=false) at /test/10.5_dbg/sql/handler.cc:1707
#12 0x000055846dc80a02 in trans_commit_stmt (thd=thd@entry=0x14a394000db8) at /test/10.5_dbg/sql/transaction.cc:472
#13 0x000055846dc7ea85 in mysql_admin_table (thd=thd@entry=0x14a394000db8, tables=tables@entry=0x14a394012a18, check_opt=check_opt@entry=0x14a3fdfb2c30, operator_name=operator_name@entry=0x55846ead5e79 "assign_to_keycache", lock_type=lock_type@entry=TL_READ_NO_INSERT, org_open_for_modify=org_open_for_modify@entry=false, repair_table_use_frm=false, extra_open_options=0, prepare_func=0x0, operator_func=&virtual table offset 744, view_operator_func=0x0) at /test/10.5_dbg/sql/sql_admin.cc:1255
#14 0x000055846dc7f66d in mysql_assign_to_keycache (thd=thd@entry=0x14a394000db8, tables=tables@entry=0x14a394012a18, key_cache_name=key_cache_name@entry=0x14a394005c58) at /test/10.5_dbg/sql/sql_admin.cc:1341
#15 0x000055846db10a97 in mysql_execute_command (thd=thd@entry=0x14a394000db8) at /test/10.5_dbg/sql/sql_parse.cc:4108
#16 0x000055846dafc1d5 in mysql_parse (thd=thd@entry=0x14a394000db8, rawbuf=rawbuf@entry=0x14a394012930 "cache index t1,t2 in default", length=length@entry=28, parser_state=parser_state@entry=0x14a3fdfb33d0, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:8062
#17 0x000055846dafbb00 in wsrep_mysql_parse (thd=thd@entry=0x14a394000db8, rawbuf=0x14a394012930 "cache index t1,t2 in default", length=28, parser_state=parser_state@entry=0x14a3fdfb33d0, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:7865
#18 0x000055846db0a5da in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14a394000db8, packet=packet@entry=0x14a39401c0b9 "", packet_length=packet_length@entry=28, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_class.h:1257
#19 0x000055846db0dd10 in do_command (thd=0x14a394000db8) at /test/10.5_dbg/sql/sql_parse.cc:1370
#20 0x000055846dc6a82c in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55847242a938, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1410
#21 0x000055846dc6af33 in handle_one_connection (arg=arg@entry=0x55847242a938) at /test/10.5_dbg/sql/sql_connect.cc:1312
#22 0x000055846e122f89 in pfs_spawn_thread (arg=0x558472489128) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
#23 0x000014a4159c8609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#24 0x000014a4155b7293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

10.4.18 542d769ea1a22a7a6a87c9fe76ff911a162ade44 (Debug)

mysqld: /test/10.4_dbg/wsrep-lib/src/transaction.cpp:444: int wsrep::transaction::before_commit(): Assertion `state() == s_executing || state() == s_prepared || state() == s_committing || state() == s_must_abort || state() == s_replaying' failed.

10.4.18 542d769ea1a22a7a6a87c9fe76ff911a162ade44 (Debug)

Core was generated by `/test/GAL_MD120221-mariadb-10.4.18-linux-x86_64-dbg/bin/mysqld --defaults-file='.
Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
    at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
[Current thread is 1 (Thread 0x14a28d5ee700 (LWP 85463))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
#1  0x0000563635cb7d6d in my_write_core (sig=sig@entry=6) at /test/10.4_dbg/mysys/stacktrace.c:386
#2  0x00005636353c6a35 in handle_fatal_signal (sig=6) at /test/10.4_dbg/sql/signal_handler.cc:343
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#5  0x000014a2d21fe859 in __GI_abort () at abort.c:79
#6  0x000014a2d21fe729 in __assert_fail_base (fmt=0x14a2d2394588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x5636362e0c80 "state() == s_executing || state() == s_prepared || state() == s_committing || state() == s_must_abort || state() == s_replaying", file=0x5636362dfbf8 "/test/10.4_dbg/wsrep-lib/src/transaction.cpp", line=444, function=<optimized out>) at assert.c:92
#7  0x000014a2d220ff36 in __GI___assert_fail (assertion=assertion@entry=0x5636362e0c80 "state() == s_executing || state() == s_prepared || state() == s_committing || state() == s_must_abort || state() == s_replaying", file=file@entry=0x5636362dfbf8 "/test/10.4_dbg/wsrep-lib/src/transaction.cpp", line=line@entry=444, function=function@entry=0x5636362e0c20 "int wsrep::transaction::before_commit()") at assert.c:101
#8  0x0000563635d55c3d in wsrep::transaction::before_commit (this=this@entry=0x14a250006fa0) at /test/10.4_dbg/wsrep-lib/src/transaction.cpp:530
#9  0x00005636353c90b0 in wsrep::client_state::before_commit (this=0x14a250006f38) at /test/10.4_dbg/wsrep-lib/include/wsrep/client_state.hpp:503
#10 wsrep_before_commit (thd=thd@entry=0x14a250000d90, all=all@entry=false) at /test/10.4_dbg/sql/wsrep_trans_observer.h:273
#11 0x00005636353de847 in ha_commit_trans (thd=thd@entry=0x14a250000d90, all=all@entry=false) at /test/10.4_dbg/sql/handler.cc:1579
#12 0x00005636352506ef in trans_commit_stmt (thd=thd@entry=0x14a250000d90) at /test/10.4_dbg/sql/transaction.cc:436
#13 0x000056363524e9cb in mysql_admin_table (thd=thd@entry=0x14a250000d90, tables=tables@entry=0x14a250011fe0, check_opt=check_opt@entry=0x14a28d5eb9b0, operator_name=operator_name@entry=0x563636008f80 "assign_to_keycache", lock_type=lock_type@entry=TL_READ_NO_INSERT, org_open_for_modify=org_open_for_modify@entry=false, repair_table_use_frm=false, extra_open_options=0, prepare_func=0x0, operator_func=&virtual table offset 720, view_operator_func=0x0) at /test/10.4_dbg/sql/sql_admin.cc:1256
#14 0x000056363524f534 in mysql_assign_to_keycache (thd=thd@entry=0x14a250000d90, tables=tables@entry=0x14a250011fe0, key_cache_name=key_cache_name@entry=0x14a2500059b0) at /test/10.4_dbg/sql/sql_admin.cc:1342
#15 0x00005636350f251b in mysql_execute_command (thd=thd@entry=0x14a250000d90) at /test/10.4_dbg/sql/sql_parse.cc:4060
#16 0x00005636350fc8e1 in mysql_parse (thd=thd@entry=0x14a250000d90, rawbuf=rawbuf@entry=0x14a250011ef8 "cache index t1,t2 in default", length=length@entry=28, parser_state=parser_state@entry=0x14a28d5ed490, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.4_dbg/sql/sql_parse.cc:7958
#17 0x00005636350fd97b in wsrep_mysql_parse (thd=thd@entry=0x14a250000d90, rawbuf=0x14a250011ef8 "cache index t1,t2 in default", length=28, parser_state=parser_state@entry=0x14a28d5ed490, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.4_dbg/sql/sql_parse.cc:7762
#18 0x00005636350ff1af in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14a250000d90, packet=packet@entry=0x14a25001b641 "", packet_length=packet_length@entry=28, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.4_dbg/sql/sql_class.h:1170
#19 0x0000563635102938 in do_command (thd=0x14a250000d90) at /test/10.4_dbg/sql/sql_parse.cc:1373
#20 0x000056363523c6db in do_handle_one_connection (connect=connect@entry=0x563639b73830) at /test/10.4_dbg/sql/sql_connect.cc:1412
#21 0x000056363523c7fa in handle_one_connection (arg=0x563639b73830) at /test/10.4_dbg/sql/sql_connect.cc:1316
#22 0x000014a2d27bb609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#23 0x000014a2d22fb293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95



 Comments   
Comment by Jan Lindström [ 2023-08-23 ]

https://github.com/MariaDB/server/pull/2733

Comment by Roel Van de Paar [ 2023-09-26 ]

sysprg Please also have a look at CS. When executing this testcase against 11.3 for example I get:

11.3.0 8ad1e26b1bafa4ed9928306efc10c047f2274108 (Debug)

11.3.0-dbg>cache index t1,t2 in default;
+---------+--------------------+----------+--------------------------------------------------------------------------+
| Table   | Op                 | Msg_type | Msg_text                                                                 |
+---------+--------------------+----------+--------------------------------------------------------------------------+
| test.t1 | assign_to_keycache | Error    | Table 't1' is differently defined or of non-MyISAM type or doesn't exist |
| test.t1 | assign_to_keycache | error    | Corrupt                                                                  |
| test.t2 | assign_to_keycache | note     | The storage engine for the table doesn't support assign_to_keycache      |
+---------+--------------------+----------+--------------------------------------------------------------------------+
3 rows in set (0.000 sec)

Let me know if a new bug should be logged for this.

Comment by Julius Goryavsky [ 2023-09-26 ]

Fix merged with head revision as https://github.com/MariaDB/server/commit/8a5a07f09a7059b03a1421af21332d4d1fb633a9

Comment by Julius Goryavsky [ 2023-09-29 ]

Post-fix for mtr tests: https://github.com/MariaDB/server/commit/c1bc05605c90ef127659603225bd4ee0b1417f0a

Generated at Thu Feb 08 09:33:39 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.