mirror of
https://github.com/MariaDB/server.git
synced 2025-08-09 22:24:09 +03:00
MDEV-6667: Merged fix from maria-10.0-galera.
This commit is contained in:
@@ -5361,9 +5361,6 @@ int mysqld_main(int argc, char **argv)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (WSREP_ON)
|
||||
wsrep_filter_new_cluster (&argc, argv);
|
||||
|
||||
orig_argc= argc;
|
||||
orig_argv= argv;
|
||||
my_getopt_use_args_separator= TRUE;
|
||||
@@ -7341,6 +7338,13 @@ struct my_option my_long_options[]=
|
||||
{"table_cache", 0, "Deprecated; use --table-open-cache instead.",
|
||||
&tc_size, &tc_size, 0, GET_ULONG,
|
||||
REQUIRED_ARG, TABLE_OPEN_CACHE_DEFAULT, 1, 512*1024L, 0, 1, 0},
|
||||
#ifdef WITH_WSREP
|
||||
{"wsrep-new-cluster", 0, "Bootstrap a cluster. It works by overriding the "
|
||||
"current value of wsrep_cluster_address. It is recommended not to add this "
|
||||
"option to the config file as this will trigger bootstrap on every server "
|
||||
"start.", &wsrep_new_cluster, &wsrep_new_cluster, 0, GET_BOOL, NO_ARG,
|
||||
0, 0, 0, 0, 0, 0},
|
||||
#endif
|
||||
|
||||
/* The following options exist in 5.6 but not in 10.0 */
|
||||
MYSQL_TO_BE_IMPLEMENTED_OPTION("default-tmp-storage-engine"),
|
||||
|
@@ -82,6 +82,7 @@ my_bool wsrep_restart_slave_activated = 0; // node has dropped, and slave
|
||||
// restart will be needed
|
||||
my_bool wsrep_slave_UK_checks = 0; // slave thread does UK checks
|
||||
my_bool wsrep_slave_FK_checks = 0; // slave thread does FK checks
|
||||
bool wsrep_new_cluster = false; // Bootstrap the cluster ?
|
||||
/*
|
||||
* End configuration options
|
||||
*/
|
||||
@@ -886,37 +887,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()
|
||||
{
|
||||
wsrep_status_t rcode;
|
||||
@@ -939,11 +909,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,
|
||||
|
@@ -87,6 +87,7 @@ extern my_bool wsrep_restart_slave_activated;
|
||||
extern my_bool wsrep_slave_FK_checks;
|
||||
extern my_bool wsrep_slave_UK_checks;
|
||||
extern ulong wsrep_running_threads;
|
||||
extern bool wsrep_new_cluster;
|
||||
|
||||
enum enum_wsrep_OSU_method { WSREP_OSU_TOI, WSREP_OSU_RSU };
|
||||
enum enum_wsrep_sync_wait {
|
||||
@@ -112,11 +113,6 @@ extern const char* wsrep_provider_version;
|
||||
extern const char* wsrep_provider_vendor;
|
||||
|
||||
int wsrep_show_status(THD *thd, SHOW_VAR *var, char *buff);
|
||||
|
||||
/* Filters out --wsrep-new-cluster oprtion from argv[]
|
||||
* should be called in the very beginning of main() */
|
||||
void wsrep_filter_new_cluster (int* argc, char* argv[]);
|
||||
|
||||
int wsrep_init();
|
||||
void wsrep_deinit(bool free_options);
|
||||
void wsrep_recover();
|
||||
@@ -328,7 +324,6 @@ int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len);
|
||||
#define wsrep_stop_replication(X) do { } while(0)
|
||||
#define wsrep_inited (0)
|
||||
#define wsrep_deinit(X) do { } while(0)
|
||||
#define wsrep_filter_new_cluster(X,Y) do { } while(0)
|
||||
#define wsrep_recover() do { } while(0)
|
||||
#define wsrep_slave_threads (1)
|
||||
|
||||
|
Reference in New Issue
Block a user