summaryrefslogtreecommitdiff
path: root/sql/wsrep_mysqld.cc
diff options
context:
space:
mode:
authorNirbhay Choubey <nirbhay@skysql.com>2014-09-08 21:21:37 -0400
committerNirbhay Choubey <nirbhay@skysql.com>2014-09-08 21:21:37 -0400
commit47fcca0ffcc09623731f3e36d61ccc8da6b0f493 (patch)
treeedfe9229531d2c035a8547b2c20e7caaee4ccd0a /sql/wsrep_mysqld.cc
parentc0483b00295612372af6b33c6613a1a8bd839096 (diff)
downloadmariadb-git-47fcca0ffcc09623731f3e36d61ccc8da6b0f493.tar.gz
MDEV-6667 : Improved handling of wsrep-new-cluster option
Code refactoring. Using mysql option handling system to handle 'wsrep-new-cluster' option.
Diffstat (limited to 'sql/wsrep_mysqld.cc')
-rw-r--r--sql/wsrep_mysqld.cc39
1 files changed, 7 insertions, 32 deletions
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index 38b6f4dfe59..7bf2cdda34f 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -781,36 +781,6 @@ void wsrep_stop_replication(THD *thd)
return;
}
-/* This one is set to true when --wsrep-new-cluster is found in the command
- * line arguments */
-static my_bool wsrep_new_cluster= FALSE;
-#define WSREP_NEW_CLUSTER "--wsrep-new-cluster"
-/* Finds and hides --wsrep-new-cluster from the arguments list
- * by moving it to the end of the list and decrementing argument count */
-void wsrep_filter_new_cluster (int* argc, char* argv[])
-{
- int i;
- for (i= *argc - 1; i > 0; i--)
- {
- /* make a copy of the argument to convert possible underscores to hyphens.
- * the copy need not to be longer than WSREP_NEW_CLUSTER option */
- char arg[sizeof(WSREP_NEW_CLUSTER) + 1]= { 0, };
- strncpy(arg, argv[i], sizeof(arg) - 1);
- char* underscore(arg);
- while (NULL != (underscore= strchr(underscore, '_'))) *underscore= '-';
-
- if (!strcmp(arg, WSREP_NEW_CLUSTER))
- {
- wsrep_new_cluster= TRUE;
- *argc -= 1;
- /* preserve the order of remaining arguments AND
- * preserve the original argument pointers - just in case */
- char* wnc= argv[i];
- memmove(&argv[i], &argv[i + 1], (*argc - i)*sizeof(argv[i]));
- argv[*argc]= wnc; /* this will be invisible to the rest of the program */
- }
- }
-}
bool wsrep_start_replication()
{
@@ -834,11 +804,16 @@ bool wsrep_start_replication()
return true;
}
- bool const bootstrap(TRUE == wsrep_new_cluster);
- wsrep_new_cluster= FALSE;
+ bool const bootstrap= wsrep_new_cluster;
WSREP_INFO("Start replication");
+ if (wsrep_new_cluster)
+ {
+ WSREP_INFO("'wsrep-new-cluster' option used, bootstrapping the cluster");
+ wsrep_new_cluster= false;
+ }
+
if ((rcode = wsrep->connect(wsrep,
wsrep_cluster_name,
wsrep_cluster_address,