diff --git a/sql/handler.cc b/sql/handler.cc --- a/sql/handler.cc +++ b/sql/handler.cc @@ -47,6 +47,8 @@ #include "rowid_filter.h" #include "mysys_err.h" +#include +extern std::atomic commits_in_progress; #ifdef WITH_PARTITION_STORAGE_ENGINE #include "ha_partition.h" #endif @@ -1742,6 +1744,7 @@ int ha_commit_trans(THD *thd, bool all) need_prepare_ordered= FALSE; need_commit_ordered= FALSE; + commits_in_progress++; for (Ha_trx_info *hi= ha_info; hi; hi= hi->next()) { @@ -1876,6 +1879,7 @@ int ha_commit_trans(THD *thd, bool all) thd->rgi_slave->is_parallel_exec); } end: + commits_in_progress--; if (mdl_backup.ticket) { /* diff --git a/sql/mysqld.cc b/sql/mysqld.cc --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -162,6 +162,8 @@ extern "C" { // Because of SCO 3.2V4.2 #endif /* __WIN__ */ #include +#include +std::atomic commits_in_progress(0); #ifdef __WIN__ #include @@ -3167,6 +3169,9 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused))) process_alarm(sig); // Trigger alarms. break; #endif + case SIGUSR2: + if (commits_in_progress > 0) + __builtin_trap(); default: #ifdef EXTRA_DEBUG sql_print_warning("Got signal: %d error: %d",sig,error); /* purecov: tested */