Commit e5267cae authored by Nirbhay Choubey's avatar Nirbhay Choubey

MDEV-6717 : wsrep_data_home_dir should default to @@datadir

Used mysql_real_data_home as wsrep_data_home_dir's default.
Added a test case.
parent 140fd7ad
......@@ -2,47 +2,58 @@
# wsrep_data_home_dir (readonly)
#
# default
SELECT @@global.wsrep_data_home_dir;
@@global.wsrep_data_home_dir
SELECT COUNT(@@global.wsrep_data_home_dir);
COUNT(@@global.wsrep_data_home_dir)
1
# scope
SELECT @@session.wsrep_data_home_dir;
ERROR HY000: Variable 'wsrep_data_home_dir' is a GLOBAL variable
SET @@global.wsrep_data_home_dir='/tmp/data';
ERROR HY000: Variable 'wsrep_data_home_dir' is a read only variable
SELECT @@global.wsrep_data_home_dir;
@@global.wsrep_data_home_dir
SELECT COUNT(@@global.wsrep_data_home_dir);
COUNT(@@global.wsrep_data_home_dir)
1
# valid values
SET @@global.wsrep_data_home_dir='/tmp/data';
ERROR HY000: Variable 'wsrep_data_home_dir' is a read only variable
SELECT @@global.wsrep_data_home_dir;
@@global.wsrep_data_home_dir
SELECT COUNT(@@global.wsrep_data_home_dir);
COUNT(@@global.wsrep_data_home_dir)
1
SET @@global.wsrep_data_home_dir=junk-dir;
ERROR HY000: Variable 'wsrep_data_home_dir' is a read only variable
SELECT @@global.wsrep_data_home_dir;
@@global.wsrep_data_home_dir
SELECT COUNT(@@global.wsrep_data_home_dir);
COUNT(@@global.wsrep_data_home_dir)
1
SET @@global.wsrep_data_home_dir=junk/dir;
ERROR HY000: Variable 'wsrep_data_home_dir' is a read only variable
SELECT @@global.wsrep_data_home_dir;
@@global.wsrep_data_home_dir
SELECT COUNT(@@global.wsrep_data_home_dir);
COUNT(@@global.wsrep_data_home_dir)
1
SET @@global.wsrep_data_home_dir=OFF;
ERROR HY000: Variable 'wsrep_data_home_dir' is a read only variable
SELECT @@global.wsrep_data_home_dir;
@@global.wsrep_data_home_dir
SELECT COUNT(@@global.wsrep_data_home_dir);
COUNT(@@global.wsrep_data_home_dir)
1
SET @@global.wsrep_data_home_dir=default;
ERROR HY000: Variable 'wsrep_data_home_dir' is a read only variable
SELECT @@global.wsrep_data_home_dir;
@@global.wsrep_data_home_dir
SELECT COUNT(@@global.wsrep_data_home_dir);
COUNT(@@global.wsrep_data_home_dir)
1
# invalid values
SET @@global.wsrep_data_home_dir=NULL;
ERROR HY000: Variable 'wsrep_data_home_dir' is a read only variable
#
# MDEV-6717 : wsrep_data_home_dir should default to @@datadir
#
SELECT @@GLOBAL.wsrep_data_home_dir = VARIABLE_VALUE FROM
INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='datadir';
@@GLOBAL.wsrep_data_home_dir = VARIABLE_VALUE
1
SELECT @@GLOBAL.wsrep_data_home_dir = VARIABLE_VALUE FROM
INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='wsrep_data_home_dir';
@@GLOBAL.wsrep_data_home_dir = VARIABLE_VALUE
1
# End of test
......@@ -5,7 +5,7 @@
--echo #
--echo # default
SELECT @@global.wsrep_data_home_dir;
SELECT COUNT(@@global.wsrep_data_home_dir);
--echo
--echo # scope
......@@ -13,29 +13,37 @@ SELECT @@global.wsrep_data_home_dir;
SELECT @@session.wsrep_data_home_dir;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.wsrep_data_home_dir='/tmp/data';
SELECT @@global.wsrep_data_home_dir;
SELECT COUNT(@@global.wsrep_data_home_dir);
--echo
--echo # valid values
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.wsrep_data_home_dir='/tmp/data';
SELECT @@global.wsrep_data_home_dir;
SELECT COUNT(@@global.wsrep_data_home_dir);
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.wsrep_data_home_dir=junk-dir;
SELECT @@global.wsrep_data_home_dir;
SELECT COUNT(@@global.wsrep_data_home_dir);
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.wsrep_data_home_dir=junk/dir;
SELECT @@global.wsrep_data_home_dir;
SELECT COUNT(@@global.wsrep_data_home_dir);
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.wsrep_data_home_dir=OFF;
SELECT @@global.wsrep_data_home_dir;
SELECT COUNT(@@global.wsrep_data_home_dir);
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.wsrep_data_home_dir=default;
SELECT @@global.wsrep_data_home_dir;
SELECT COUNT(@@global.wsrep_data_home_dir);
--echo
--echo # invalid values
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.wsrep_data_home_dir=NULL;
--echo #
--echo # MDEV-6717 : wsrep_data_home_dir should default to @@datadir
--echo #
SELECT @@GLOBAL.wsrep_data_home_dir = VARIABLE_VALUE FROM
INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='datadir';
SELECT @@GLOBAL.wsrep_data_home_dir = VARIABLE_VALUE FROM
INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='wsrep_data_home_dir';
--echo # End of test
......@@ -3707,7 +3707,7 @@ static Sys_var_charptr Sys_wsrep_provider_options(
static Sys_var_charptr Sys_wsrep_data_home_dir(
"wsrep_data_home_dir", "home directory for wsrep provider",
READ_ONLY GLOBAL_VAR(wsrep_data_home_dir), CMD_LINE(REQUIRED_ARG),
IN_FS_CHARSET, DEFAULT(""),
IN_FS_CHARSET, DEFAULT(mysql_real_data_home),
NO_MUTEX_GUARD, NOT_IN_BINLOG);
static Sys_var_charptr Sys_wsrep_cluster_name(
......
......@@ -538,9 +538,6 @@ int wsrep_init()
wsrep->provider_vendor, sizeof(provider_vendor) - 1);
}
if (!wsrep_data_home_dir || strlen(wsrep_data_home_dir) == 0)
wsrep_data_home_dir = mysql_real_data_home;
char node_addr[512]= { 0, };
size_t const node_addr_max= sizeof(node_addr) - 1;
if (!wsrep_node_address || !strcmp(wsrep_node_address, ""))
......
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