Skip to content

Commit 9204c65

Browse files
Delete pid file when crashing after timeout with unacked trx
Summary: If rpl_semi_sync_master_crash_if_active_trxs = true, the server crashes after a timeout if there are any active unacked transactions. mysqld_safe expects the pid file to be deleted if the expectation is to not bring the intance back up again. This change deletes the pid file before crashing on this condition. Squash with D5841339 Reviewed By: Tema Differential Revision: D7747659 fbshipit-source-id: a94df24
1 parent 0e662d8 commit 9204c65

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

plugin/semisync/semisync_master.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717

1818
#include "semisync_master.h"
19+
#include "mysqld.h"
1920
#if defined(ENABLED_DEBUG_SYNC)
2021
#include "debug_sync.h"
2122
#include "sql_class.h"
@@ -913,6 +914,7 @@ int ReplSemiSyncMaster::switch_off()
913914
{
914915
sql_print_error("Force shutdown: Semi-sync master is being switched off "
915916
"while there are active un-acked transactions");
917+
delete_pid_file(MYF(MY_WME));
916918
exit(0);
917919
}
918920

sql/mysqld.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,7 +1582,6 @@ static void create_shutdown_file();
15821582
static int delete_shutdown_file();
15831583
static void mysqld_exit(int exit_code) MY_ATTRIBUTE((noreturn));
15841584
#endif
1585-
static void delete_pid_file(myf flags);
15861585

15871586

15881587
#ifndef EMBEDDED_LIBRARY
@@ -12182,7 +12181,7 @@ static int delete_shutdown_file()
1218212181
@param flags file operation flags
1218312182
*/
1218412183

12185-
static void delete_pid_file(myf flags)
12184+
void delete_pid_file(myf flags)
1218612185
{
1218712186
#ifndef EMBEDDED_LIBRARY
1218812187
File file;

sql/mysqld.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ bool is_secure_file_path(char *path);
252252
bool is_mysql_datadir_path(const char *path);
253253
void dec_connection_count_locked();
254254
void dec_connection_count();
255+
void delete_pid_file(myf flags);
255256

256257
// These are needed for unit testing.
257258
void set_remaining_args(int argc, char **argv);

0 commit comments

Comments
 (0)