Commit 34045af0 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-15216 Assertion `! is_set() || m_can_overwrite_status' failed in...

MDEV-15216 Assertion `! is_set() || m_can_overwrite_status' failed in Diagnostics_area::set_error_status upon operation inside XA

don't implicitly commit or rollback in mysql_admin_table()
unless the statement has CF_IMPLICIT_COMMIT_END flag.
parent 087ea8f8
set global my_cache.key_buffer_size = 1024*1024;
create table t1 (i int) engine=myisam partition by hash (i) partitions 2;
xa start 'xid';
cache index t1 partition (non_existing_partition) in my_cache;
Table Op Msg_type Msg_text
test.t1 assign_to_keycache error Error in list of partitions to test.t1
cache index t1 partition (p1) in my_cache;
Table Op Msg_type Msg_text
test.t1 assign_to_keycache status OK
xa end 'xid';
xa rollback 'xid';
drop table t1;
set global my_cache.key_buffer_size = 0;
......@@ -561,7 +561,7 @@ INSERT INTO db1.trans (a) VALUES (1);
cache index t3 in keycache;
CALL db1.test_if_commit();
IMPLICIT COMMIT
YES
NO
set global keycache.key_buffer_size=0;
#
# SQLCOM_PRELOAD_KEYS
......@@ -570,7 +570,7 @@ INSERT INTO db1.trans (a) VALUES (1);
load index into cache t3;
CALL db1.test_if_commit();
IMPLICIT COMMIT
YES
NO
#
# SQLCOM_FLUSH
#
......
......@@ -140,11 +140,7 @@ master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP FUNCTION myfunc_int
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (41)
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (40)
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (39)
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Gtid # # GTID #-#-#
......
......@@ -145,12 +145,8 @@ master-bin.000001 # Query # # use `test`; DROP FUNCTION myfunc_int
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
......
......@@ -140,11 +140,7 @@ master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP FUNCTION myfunc_int
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (41)
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (40)
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (39)
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Gtid # # GTID #-#-#
......
#
# MDEV-15216 Assertion `! is_set() || m_can_overwrite_status' failed in Diagnostics_area::set_error_status upon operation inside XA
#
--source include/have_partition.inc
set global my_cache.key_buffer_size = 1024*1024;
create table t1 (i int) engine=myisam partition by hash (i) partitions 2;
xa start 'xid';
cache index t1 partition (non_existing_partition) in my_cache;
cache index t1 partition (p1) in my_cache;
xa end 'xid';
xa rollback 'xid';
drop table t1;
set global my_cache.key_buffer_size = 0;
......@@ -1064,7 +1064,9 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
}
else
{
if (trans_commit_stmt(thd) || trans_commit_implicit(thd))
if (trans_commit_stmt(thd) ||
(stmt_causes_implicit_commit(thd, CF_IMPLICIT_COMMIT_END) &&
trans_commit_implicit(thd)))
goto err;
}
close_thread_tables(thd);
......@@ -1098,7 +1100,8 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
err:
/* Make sure this table instance is not reused after the failure. */
trans_rollback_stmt(thd);
trans_rollback(thd);
if (stmt_causes_implicit_commit(thd, CF_IMPLICIT_COMMIT_END))
trans_rollback(thd);
if (table && table->table)
{
table->table->m_needs_reopen= true;
......
......@@ -192,7 +192,7 @@ static bool some_non_temp_table_to_be_updated(THD *thd, TABLE_LIST *tables)
/*
Implicitly commit a active transaction if statement requires so.
Check whether the statement implicitly commits an active transaction.
@param thd Thread handle.
@param mask Bitmask used for the SQL command match.
......@@ -200,7 +200,7 @@ static bool some_non_temp_table_to_be_updated(THD *thd, TABLE_LIST *tables)
@return 0 No implicit commit
@return 1 Do a commit
*/
static bool stmt_causes_implicit_commit(THD *thd, uint mask)
bool stmt_causes_implicit_commit(THD *thd, uint mask)
{
LEX *lex= thd->lex;
bool skip= FALSE;
......
......@@ -84,6 +84,7 @@ bool check_identifier_name(LEX_STRING *str, uint max_char_length,
uint err_code, const char *param_for_err_msg);
bool mysql_test_parse_for_slave(THD *thd,char *inBuf,uint length);
bool sqlcom_can_generate_row_events(const THD *thd);
bool stmt_causes_implicit_commit(THD *thd, uint mask);
bool is_update_query(enum enum_sql_command command);
bool is_log_table_write_query(enum enum_sql_command command);
bool alloc_query(THD *thd, const char *packet, uint packet_length);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment