summaryrefslogtreecommitdiff
path: root/sql/wsrep_thd.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/wsrep_thd.cc')
-rw-r--r--sql/wsrep_thd.cc33
1 files changed, 23 insertions, 10 deletions
diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc
index e610d3a6c2b..420a25dd2ae 100644
--- a/sql/wsrep_thd.cc
+++ b/sql/wsrep_thd.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013-2022 Codership Oy <info@codership.com>
+/* Copyright (C) 2013-2023 Codership Oy <info@codership.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -308,32 +308,37 @@ void wsrep_fire_rollbacker(THD *thd)
}
-int wsrep_abort_thd(THD *bf_thd_ptr, THD *victim_thd_ptr, my_bool signal)
+int wsrep_abort_thd(THD *bf_thd,
+ THD *victim_thd,
+ my_bool signal)
{
DBUG_ENTER("wsrep_abort_thd");
- THD *victim_thd= (THD *) victim_thd_ptr;
- THD *bf_thd= (THD *) bf_thd_ptr;
mysql_mutex_lock(&victim_thd->LOCK_thd_data);
/* Note that when you use RSU node is desynced from cluster, thus WSREP(thd)
might not be true.
*/
- if ((WSREP(bf_thd) ||
+ if ((WSREP_NNULL(bf_thd) ||
((WSREP_ON || bf_thd->variables.wsrep_OSU_method == WSREP_OSU_RSU) &&
wsrep_thd_is_toi(bf_thd))) &&
- victim_thd &&
!wsrep_thd_is_aborting(victim_thd))
{
- WSREP_DEBUG("wsrep_abort_thd, by: %llu, victim: %llu", (bf_thd) ?
- (long long)bf_thd->real_id : 0, (long long)victim_thd->real_id);
+ WSREP_DEBUG("wsrep_abort_thd, by: %llu, victim: %llu",
+ (long long)bf_thd->real_id, (long long)victim_thd->real_id);
mysql_mutex_unlock(&victim_thd->LOCK_thd_data);
ha_abort_transaction(bf_thd, victim_thd, signal);
- mysql_mutex_lock(&victim_thd->LOCK_thd_data);
+ DBUG_RETURN(1);
}
else
{
- WSREP_DEBUG("wsrep_abort_thd not effective: %p %p", bf_thd, victim_thd);
+ WSREP_DEBUG("wsrep_abort_thd not effective: bf %llu victim %llu "
+ "wsrep %d wsrep_on %d RSU %d TOI %d aborting %d",
+ (long long)bf_thd->real_id, (long long)victim_thd->real_id,
+ WSREP_NNULL(bf_thd), WSREP_ON,
+ bf_thd->variables.wsrep_OSU_method == WSREP_OSU_RSU,
+ wsrep_thd_is_toi(bf_thd),
+ wsrep_thd_is_aborting(victim_thd));
}
mysql_mutex_unlock(&victim_thd->LOCK_thd_data);
@@ -375,6 +380,14 @@ bool wsrep_bf_abort(THD* bf_thd, THD* victim_thd)
have acquired MDL locks (due to DDL execution), and this has caused BF conflict.
such case does not require aborting in wsrep or replication provider state.
*/
+ if (victim_thd->current_backup_stage != BACKUP_FINISHED &&
+ wsrep_check_mode(WSREP_MODE_BF_MARIABACKUP))
+ {
+ WSREP_DEBUG("killing connection for non wsrep session");
+ mysql_mutex_lock(&victim_thd->LOCK_thd_data);
+ victim_thd->awake_no_mutex(KILL_CONNECTION);
+ mysql_mutex_unlock(&victim_thd->LOCK_thd_data);
+ }
return false;
}