diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c index 7558d6d00ae..8e2ca4ee662 100644 --- a/extra/my_print_defaults.c +++ b/extra/my_print_defaults.c @@ -96,6 +96,11 @@ static struct my_option my_long_options[] = {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; +void cleanup_and_exit(int exit_code) +{ + my_end(0); + exit(exit_code); +} static void usage(my_bool version) { @@ -110,7 +115,7 @@ static void usage(my_bool version) my_print_default_files(config_file); my_print_variables(my_long_options); printf("\nExample usage:\n%s --defaults-file=example.cnf client client-server mysql\n", my_progname); - exit(0); + cleanup_and_exit(0); } @@ -123,7 +128,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), opt_defaults_file_used= 1; break; case 'n': - exit(0); + cleanup_and_exit(0); case 'I': case '?': usage(0); @@ -172,7 +177,7 @@ int main(int argc, char **argv) /* Check out the args */ if (get_options(&argc,&argv)) - exit(1); + cleanup_and_exit(1); nargs= argc + 1; if (opt_mysqld) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 829bc0be763..91fdb27ffe7 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1868,6 +1868,10 @@ extern "C" void unireg_abort(int exit_code) wsrep_close_threads(thd); /* this won't close all threads */ sleep(1); /* so give some time to exit for those which can */ WSREP_INFO("Some threads may fail to exit."); + + /* In bootstrap mode we deinitialize wsrep here. */ + if (opt_bootstrap && wsrep_inited) + wsrep_deinit(); } #endif // WITH_WSREP