Allow programatic control of galera restarting
If a test program needs other than the default Galera config (e.g. log_slave_updates enabled), then it should be able to programmatically cause galera to be restarted as part of the TestConnections construction.
This commit is contained in:
@ -24,6 +24,7 @@ static bool check_nodes = true;
|
|||||||
static bool manual_debug = false;
|
static bool manual_debug = false;
|
||||||
static std::string required_repl_version;
|
static std::string required_repl_version;
|
||||||
static std::string required_galera_version;
|
static std::string required_galera_version;
|
||||||
|
static bool restart_galera = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void signal_set(int sig, void (* handler)(int))
|
static void signal_set(int sig, void (* handler)(int))
|
||||||
@ -66,6 +67,11 @@ void TestConnections::require_galera_version(const char* version)
|
|||||||
maxscale::required_galera_version = version;
|
maxscale::required_galera_version = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestConnections::restart_galera(bool value)
|
||||||
|
{
|
||||||
|
maxscale::restart_galera = value;
|
||||||
|
}
|
||||||
|
|
||||||
TestConnections::TestConnections(int argc, char* argv[])
|
TestConnections::TestConnections(int argc, char* argv[])
|
||||||
: enable_timeouts(true)
|
: enable_timeouts(true)
|
||||||
, global_result(0)
|
, global_result(0)
|
||||||
@ -123,7 +129,6 @@ TestConnections::TestConnections(int argc, char* argv[])
|
|||||||
|
|
||||||
int c;
|
int c;
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
bool restart_galera = false;
|
|
||||||
|
|
||||||
while ((c = getopt_long(argc, argv, "hvnqsirgzyl", long_options, &option_index)) != -1)
|
while ((c = getopt_long(argc, argv, "hvnqsirgzyl", long_options, &option_index)) != -1)
|
||||||
{
|
{
|
||||||
@ -174,7 +179,7 @@ TestConnections::TestConnections(int argc, char* argv[])
|
|||||||
|
|
||||||
case 'g':
|
case 'g':
|
||||||
printf("Restarting Galera setup\n");
|
printf("Restarting Galera setup\n");
|
||||||
restart_galera = true;
|
maxscale::restart_galera = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'z':
|
case 'z':
|
||||||
@ -280,7 +285,7 @@ TestConnections::TestConnections(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((restart_galera) && (!no_galera))
|
if ((maxscale::restart_galera) && (!no_galera))
|
||||||
{
|
{
|
||||||
galera->stop_nodes();
|
galera->stop_nodes();
|
||||||
galera->start_replication();
|
galera->start_replication();
|
||||||
|
@ -254,6 +254,18 @@ public:
|
|||||||
static void require_repl_version(const char* version);
|
static void require_repl_version(const char* version);
|
||||||
static void require_galera_version(const char* version);
|
static void require_galera_version(const char* version);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Specify whether galera should be restarted.
|
||||||
|
*
|
||||||
|
* @param value If true, galera should be restarted.
|
||||||
|
*
|
||||||
|
* @note Even if set to false (which is also the default), '-g' or '--restart-galera' at
|
||||||
|
* the command line will still cause a restart, unless '-y' or '--no-galera' has
|
||||||
|
* been specified. '-y' will prevent galera from being restarted even if the value
|
||||||
|
* has been set to true.
|
||||||
|
*/
|
||||||
|
static void restart_galera(bool value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief add_result adds result to global_result and prints error message if result is not 0
|
* @brief add_result adds result to global_result and prints error message if result is not 0
|
||||||
* @param result 0 if step PASSED
|
* @param result 0 if step PASSED
|
||||||
|
Reference in New Issue
Block a user