Skip to content

Commit ef04f23

Browse files
committed
Bug#35902058 innodb-purge thread can take long time to complete and systemd isn't notified
Problem: --------- - During shutdown, InnoDB purge thread can sometimes take a couple of hours to complete its work (depending on the data) and it can make user feel that the shutdown is stuck. Solution: --------- - Add an "externally" visible systemd notification indicating the step. Note: ----- - The message is kept general to accommodate pre_dd_shutdown handlertons of other SEs (if there are any). Change-Id: Ibb3f4ab8cb1da45f2fbd374c8ef88c8657ea7b68
1 parent ca021ea commit ef04f23

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

Diff for: sql/handler.cc

+15-1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
#include "mysql_version.h" // MYSQL_VERSION_ID
7373
#include "mysqld_error.h"
7474
#include "prealloced_array.h"
75+
#include "sd_notify.h" // for sysd::notify() calls
7576
#include "sql/auth/auth_common.h" // check_readonly() and SUPER_ACL
7677
#include "sql/binlog.h" // mysql_bin_log
7778
#include "sql/check_stack.h"
@@ -982,8 +983,21 @@ void ha_kill_connection(THD *thd) {
982983
@retval false (always) */
983984
static bool pre_dd_shutdown_handlerton(THD *, plugin_ref plugin, void *) {
984985
handlerton *hton = plugin_data<handlerton *>(plugin);
985-
if (hton->state == SHOW_OPTION_YES && hton->pre_dd_shutdown)
986+
if (hton->state == SHOW_OPTION_YES && hton->pre_dd_shutdown) {
987+
/*
988+
systemd notifications are added here to make the case of "InnoDB purge
989+
thread taking a long time to shut down" externally visible. The message is
990+
kept general to accommodate pre_dd_shutdown handlertons of other SEs (if
991+
any).
992+
*/
993+
sysd::notify("STATUS=Pre DD shutdown of MySQL SE plugin ",
994+
ha_resolve_storage_engine_name(hton), " in progress\n");
995+
986996
hton->pre_dd_shutdown(hton);
997+
998+
sysd::notify("STATUS=Pre DD shutdown of MySQL SE plugin ",
999+
ha_resolve_storage_engine_name(hton), " completed\n");
1000+
}
9871001
return false;
9881002
}
9891003

0 commit comments

Comments
 (0)