Merge branch '2.3' into 2.4
This commit is contained in:
commit
9f07613330
@ -455,12 +455,14 @@ int Galera_nodes::start_galera()
|
||||
for (int i = 0; i < N; i++)
|
||||
{
|
||||
// Remove the grastate.dat file
|
||||
ssh_node(i, "rm -f /var/lib/mysql/grastate.dat", true);
|
||||
|
||||
ssh_node(i, "echo [mysqld] > cluster_address.cnf", true);
|
||||
ssh_node_f(i, true, "echo wsrep_cluster_address=gcomm://%s >> cluster_address.cnf", gcomm.c_str());
|
||||
ssh_node(i, "cp cluster_address.cnf /etc/my.cnf.d/", true);
|
||||
|
||||
ssh_node(i, "rm -rf /var/lib/mysql/*", true);
|
||||
ssh_node(i, "mysql_install_db --user=mysql", true);
|
||||
|
||||
ssh_node_f(i,
|
||||
true,
|
||||
"sed -i 's/###NODE-ADDRESS###/%s/' /etc/my.cnf.d/* /etc/mysql/my.cnf.d/*;"
|
||||
@ -474,7 +476,7 @@ int Galera_nodes::start_galera()
|
||||
// Start the first node that also starts a new cluster
|
||||
ssh_node_f(0, true, "galera_new_cluster");
|
||||
|
||||
for (int i = 0; i < N; i++)
|
||||
for (int i = 1; i < N; i++)
|
||||
{
|
||||
if (start_node(i, "") != 0)
|
||||
{
|
||||
|
@ -1035,10 +1035,10 @@ int TestConnections::copy_maxscale_logs(double timestamp)
|
||||
"rm -rf %s/logs;"
|
||||
"mkdir %s/logs;"
|
||||
"cp %s/*.log %s/logs/;"
|
||||
"cp /tmp/core* %s/logs/;"
|
||||
"test -e /tmp/core* && cp /tmp/core* %s/logs/;"
|
||||
"cp %s %s/logs/;"
|
||||
"chmod 777 -R %s/logs;"
|
||||
"ls /tmp/core* && exit 42;",
|
||||
"test -e /tmp/core* && exit 42;",
|
||||
maxscales->access_homedir[i],
|
||||
maxscales->access_homedir[i],
|
||||
maxscales->maxscale_log_dir[i],
|
||||
|
@ -1206,6 +1206,46 @@ bool disable_signals(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool disable_normal_signals(void)
|
||||
{
|
||||
sigset_t sigset;
|
||||
|
||||
if (sigfillset(&sigset) != 0)
|
||||
{
|
||||
int e = errno;
|
||||
errno = 0;
|
||||
static const char message[] = "Failed to initialize set the signal set for MaxScale. Exiting.";
|
||||
print_log_n_stderr(true, true, message, message, e);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!delete_signal(&sigset, SIGHUP, "SIGHUP"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!delete_signal(&sigset, SIGUSR1, "SIGUSR1"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!delete_signal(&sigset, SIGTERM, "SIGTERM"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sigprocmask(SIG_SETMASK, &sigset, NULL) != 0)
|
||||
{
|
||||
int e = errno;
|
||||
errno = 0;
|
||||
static const char message[] = "Failed to set the signal set for MaxScale. Exiting";
|
||||
print_log_n_stderr(true, true, message, message, e);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the handling of a particular signal.
|
||||
*
|
||||
@ -1233,31 +1273,12 @@ static bool configure_signal(int signum, const char* signame, void (* handler)(i
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures signal handling of MaxScale.
|
||||
* Configure fatal signal handlers
|
||||
*
|
||||
* @return True, if all signals could be configured, false otherwise.
|
||||
* @return True if signal handlers were installed correctly
|
||||
*/
|
||||
bool configure_signals(void)
|
||||
bool configure_critical_signals(void)
|
||||
{
|
||||
if (!configure_signal(SIGHUP, "SIGHUP", sighup_handler))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!configure_signal(SIGUSR1, "SIGUSR1", sigusr1_handler))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!configure_signal(SIGTERM, "SIGTERM", sigterm_handler))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!configure_signal(SIGINT, "SIGINT", sigint_handler))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!configure_signal(SIGSEGV, "SIGSEGV", sigfatal_handler))
|
||||
{
|
||||
@ -1289,6 +1310,36 @@ bool configure_signals(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures signal handling of MaxScale.
|
||||
*
|
||||
* @return True, if all signals could be configured, false otherwise.
|
||||
*/
|
||||
bool configure_normal_signals(void)
|
||||
{
|
||||
if (!configure_signal(SIGHUP, "SIGHUP", sighup_handler))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!configure_signal(SIGUSR1, "SIGUSR1", sigusr1_handler))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!configure_signal(SIGTERM, "SIGTERM", sigterm_handler))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!configure_signal(SIGINT, "SIGINT", sigint_handler))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool set_runtime_dirs(const char* basedir)
|
||||
{
|
||||
bool rv = true;
|
||||
@ -1885,12 +1936,10 @@ int main(int argc, char** argv)
|
||||
* the pipe. */
|
||||
close(daemon_pipe[0]);
|
||||
}
|
||||
/*<
|
||||
* Set signal handlers for SIGHUP, SIGTERM, SIGINT and critical signals like SIGSEGV.
|
||||
*/
|
||||
if (!configure_signals())
|
||||
|
||||
if (!configure_critical_signals())
|
||||
{
|
||||
static const char* logerr = "Failed to configure signal handlers. Exiting.";
|
||||
static const char* logerr = "Failed to configure fatal signal handlers. Exiting.";
|
||||
|
||||
print_log_n_stderr(true, true, logerr, logerr, 0);
|
||||
rc = MAXSCALE_INTERNALERROR;
|
||||
@ -2252,6 +2301,15 @@ int main(int argc, char** argv)
|
||||
config_threadcount(),
|
||||
config_thread_stack_size());
|
||||
|
||||
if (!configure_normal_signals())
|
||||
{
|
||||
static const char* logerr = "Failed to configure all signal handlers. Exiting.";
|
||||
|
||||
print_log_n_stderr(true, true, logerr, logerr, 0);
|
||||
rc = MAXSCALE_INTERNALERROR;
|
||||
goto return_main;
|
||||
}
|
||||
|
||||
worker = RoutingWorker::get(RoutingWorker::MAIN);
|
||||
mxb_assert(worker);
|
||||
|
||||
@ -2267,13 +2325,15 @@ int main(int argc, char** argv)
|
||||
|
||||
main_worker->run();
|
||||
|
||||
disable_normal_signals();
|
||||
|
||||
/*<
|
||||
* Wait for worker threads to exit.
|
||||
*/
|
||||
RoutingWorker::join_workers();
|
||||
MXS_NOTICE("All workers have shut down.");
|
||||
|
||||
set_admin_worker(nullptr); // Main worker has quit, re-assign to non-worker.
|
||||
set_admin_worker(nullptr); // Main worker has quit, re-assign to non-worker.
|
||||
|
||||
/*< Destroy all monitors */
|
||||
MonitorManager::destroy_all_monitors();
|
||||
|
Loading…
x
Reference in New Issue
Block a user