Bug #43913 rpl_cross_version can't pass on conflicts complainig clash with --slave-load-tm

The 'slave_patternload_file' is assigned to the real path of the load data file 
when initializing the object of Relay_log_info. But the path of the load data
file is not formatted to real path when executing event from relay log. So the 
error will be encountered if the path of the load data file is a symbolic link.

Actually the global 'opt_secure_file_priv' is not formatted to real path when 
loading data from file. So the same thing will happen too.

      
To fix these errors, the path of the load data file should be formatted to 
real path when executing event from relay log. And the 'opt_secure_file_priv' 
should be formatted to real path when loading data infile.
This commit is contained in:
2009-11-28 12:43:16 +08:00
parent 822e0c9b6d
commit f6ff4a5810
8 changed files with 54 additions and 7 deletions

View file

@ -0,0 +1,17 @@
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
create table t1(a int not null auto_increment, b int, primary key(a) );
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
select * from t1;
a b
1 10
2 15
select * from t1;
a b
1 10
2 15
drop table t1;

View file

@ -0,0 +1 @@
--secure-file-priv=$MYSQLTEST_VARDIR/std_data_master_link

View file

@ -0,0 +1 @@
ln -s $MYSQLTEST_VARDIR/std_data $MYSQLTEST_VARDIR/std_data_master_link

View file

@ -0,0 +1 @@
--slave-load-tmpdir=$MYSQLTEST_VARDIR/std_data_slave_link

View file

@ -0,0 +1 @@
ln -s $MYSQLTEST_VARDIR/std_data $MYSQLTEST_VARDIR/std_data_slave_link

View file

@ -0,0 +1,20 @@
#
# BUG#43913
# This test verifies if loading data infile will work fine
# if the path of the load data file is a symbolic link.
#
--source include/master-slave.inc
--source include/have_binlog_format_statement.inc
create table t1(a int not null auto_increment, b int, primary key(a) );
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
select * from t1;
sync_slave_with_master;
connection slave;
select * from t1;
connection master;
drop table t1;
sync_slave_with_master;

View file

@ -105,7 +105,8 @@ int init_relay_log_info(Relay_log_info* rli,
rli->tables_to_lock_count= 0;
char pattern[FN_REFLEN];
if (fn_format(pattern, PREFIX_SQL_LOAD, slave_load_tmpdir, "",
(void) my_realpath(pattern, slave_load_tmpdir, 0);
if (fn_format(pattern, PREFIX_SQL_LOAD, pattern, "",
MY_SAFE_PATH | MY_RETURN_REAL_PATH) == NullS)
{
pthread_mutex_unlock(&rli->data_lock);

View file

@ -304,7 +304,8 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
else
{
(void) fn_format(name, ex->file_name, mysql_real_data_home, "",
MY_RELATIVE_PATH | MY_UNPACK_FILENAME);
MY_RELATIVE_PATH | MY_UNPACK_FILENAME |
MY_RETURN_REAL_PATH);
#if !defined(__WIN__) && ! defined(__NETWARE__)
MY_STAT stat_info;
if (!my_stat(name,&stat_info,MYF(MY_WME)))
@ -347,12 +348,16 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
DBUG_ASSERT(FALSE);
#endif
}
else if (opt_secure_file_priv &&
strncmp(opt_secure_file_priv, name, strlen(opt_secure_file_priv)))
else if (opt_secure_file_priv)
{
/* Read only allowed from within dir specified by secure_file_priv */
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--secure-file-priv");
DBUG_RETURN(TRUE);
char secure_file_real_path[FN_REFLEN];
(void) my_realpath(secure_file_real_path, opt_secure_file_priv, 0);
if (strncmp(secure_file_real_path, name, strlen(secure_file_real_path)))
{
/* Read only allowed from within dir specified by secure_file_priv */
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--secure-file-priv");
DBUG_RETURN(TRUE);
}
}
}