mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
BUG#37145 Killing a statement doing DDL may log binlog event with error code 1053
When the thread executing a DDL was killed after finished its execution but before writing the binlog event, the error code in the binlog event could be set wrongly to ER_SERVER_SHUTDOWN or ER_QUERY_INTERRUPTED. This patch fixed the problem by ignoring the kill status when constructing the event for DDL statements. This patch also included the following changes in order to provide the test case. 1) modified mysqltest to support variable for connection command 2) modified mysql-test-run.pl, add new variable MYSQL_SLAVE to run mysql client against the slave mysqld.
This commit is contained in:
@ -1506,7 +1506,8 @@ bool change_password(THD *thd, const char *host, const char *user,
|
||||
acl_user->host.hostname ? acl_user->host.hostname : "",
|
||||
new_password));
|
||||
thd->clear_error();
|
||||
Query_log_event qinfo(thd, buff, query_length, 0, FALSE);
|
||||
Query_log_event qinfo(thd, buff, query_length,
|
||||
0, FALSE, THD::NOT_KILLED);
|
||||
mysql_bin_log.write(&qinfo);
|
||||
}
|
||||
end:
|
||||
@ -3014,7 +3015,8 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
thd->clear_error();
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE);
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length,
|
||||
0, FALSE, THD::NOT_KILLED);
|
||||
mysql_bin_log.write(&qinfo);
|
||||
}
|
||||
}
|
||||
@ -3181,7 +3183,8 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc,
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
thd->clear_error();
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE);
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length,
|
||||
0, FALSE, THD::NOT_KILLED);
|
||||
mysql_bin_log.write(&qinfo);
|
||||
}
|
||||
}
|
||||
@ -3294,7 +3297,8 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
thd->clear_error();
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE);
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length,
|
||||
0, FALSE, THD::NOT_KILLED);
|
||||
mysql_bin_log.write(&qinfo);
|
||||
}
|
||||
}
|
||||
@ -5404,7 +5408,8 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list)
|
||||
|
||||
if (some_users_created && mysql_bin_log.is_open())
|
||||
{
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE);
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length,
|
||||
0, FALSE, THD::NOT_KILLED);
|
||||
mysql_bin_log.write(&qinfo);
|
||||
}
|
||||
|
||||
@ -5473,7 +5478,8 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list)
|
||||
|
||||
if (some_users_deleted && mysql_bin_log.is_open())
|
||||
{
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE);
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length,
|
||||
0, FALSE, THD::NOT_KILLED);
|
||||
mysql_bin_log.write(&qinfo);
|
||||
}
|
||||
|
||||
@ -5553,7 +5559,8 @@ bool mysql_rename_user(THD *thd, List <LEX_USER> &list)
|
||||
|
||||
if (some_users_renamed && mysql_bin_log.is_open())
|
||||
{
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE);
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length,
|
||||
0, FALSE, THD::NOT_KILLED);
|
||||
mysql_bin_log.write(&qinfo);
|
||||
}
|
||||
|
||||
@ -5731,7 +5738,8 @@ bool mysql_revoke_all(THD *thd, List <LEX_USER> &list)
|
||||
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE);
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length,
|
||||
0, FALSE, THD::NOT_KILLED);
|
||||
mysql_bin_log.write(&qinfo);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user