Commit 1c09bbfe authored by Seppo Jaakola's avatar Seppo Jaakola

References lp:1087368 - merged fix from wsrep-5.5 branch.

    Note this is compatible only with new wsrep provider #23 libraries, which understand 'bootstrap' address in connecting.
parent 527ce30c
......@@ -91,6 +91,40 @@ static my_bool defaults_already_read= FALSE;
/* The only purpose of this global array is to hold full name of my.cnf
* which seems to be otherwise unavailable */
char wsrep_defaults_file[FN_REFLEN + 10]={0,};
/* Command-line only option to start a new wsrep service instance */
#define WSREP_NEW_CLUSTER1 "--wsrep-new-cluster"
#define WSREP_NEW_CLUSTER2 "--wsrep_new_cluster"
/* This one is set to true when --wsrep-new-cluster is found in the command
* line arguments */
my_bool wsrep_new_cluster= FALSE;
/* Finds and removes --wsrep-new-cluster from the arguments list.
* Returns true if found. */
static my_bool find_wsrep_new_cluster (int* argc, char* argv[])
{
my_bool ret= FALSE;
int i;
for (i= *argc - 1; i > 0; i--)
{
if (!strcmp(argv[i], WSREP_NEW_CLUSTER1) ||
!strcmp(argv[i], WSREP_NEW_CLUSTER2))
{
ret= TRUE;
*argc -= 1;
if (*argc == i)
{ // last argument, just zero it up
argv[i]= NULL;
}
else
{ // not the last argument, copy the last one over and zero that up.
argv[i]= argv[*argc];
argv[*argc]= NULL;
}
}
}
return ret;
}
#endif /* WITH_WREP */
/* Which directories are searched for options (and in which order) */
......@@ -529,6 +563,9 @@ int my_load_defaults(const char *conf_file, const char **groups,
init_alloc_root(&alloc,512,0);
if ((dirs= init_default_directories(&alloc)) == NULL)
goto err;
#ifdef WITH_WSREP
wsrep_new_cluster= find_wsrep_new_cluster(argc, argv[0]);
#endif /* WITH_WSREP */
/*
Check if the user doesn't want any default option processing
--no-defaults is always the first option
......
......@@ -409,7 +409,6 @@ static void wsrep_init_position()
}
}
int wsrep_init()
{
int rcode= -1;
......@@ -651,6 +650,8 @@ void wsrep_stop_replication(THD *thd)
}
extern my_bool wsrep_new_cluster;
bool wsrep_start_replication()
{
wsrep_status_t rcode;
......@@ -674,11 +675,19 @@ bool wsrep_start_replication()
return true;
}
/* Note 'bootstrap' address is not officially supported in wsrep API #23
but it can be back ported from #24 provider to get sneak preview of
bootstrap command
*/
const char* cluster_address =
wsrep_new_cluster ? "bootstrap" : wsrep_cluster_address;
wsrep_new_cluster= FALSE;
WSREP_INFO("Start replication");
if ((rcode = wsrep->connect(wsrep,
wsrep_cluster_name,
wsrep_cluster_address,
cluster_address,
wsrep_sst_donor)))
{
if (-ESOCKTNOSUPPORT == rcode)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment