mirror of
https://github.com/MariaDB/server.git
synced 2025-07-18 23:03:28 +03:00
MDEV-12261 build failure without P_S
restore mysql_file_delete_with_symlink() but let it use new my_handler_delete_with_symlink() mysys helper.
This commit is contained in:
@ -597,8 +597,7 @@ extern File my_create_with_symlink(const char *linkname, const char *filename,
|
|||||||
myf MyFlags);
|
myf MyFlags);
|
||||||
extern int my_rename_with_symlink(const char *from,const char *to,myf MyFlags);
|
extern int my_rename_with_symlink(const char *from,const char *to,myf MyFlags);
|
||||||
extern int my_symlink(const char *content, const char *linkname, myf MyFlags);
|
extern int my_symlink(const char *content, const char *linkname, myf MyFlags);
|
||||||
extern int my_handler_delete_with_symlink(PSI_file_key key, const char *name,
|
extern int my_handler_delete_with_symlink(const char *filename, myf sync_dir);
|
||||||
const char *ext, myf sync_dir);
|
|
||||||
|
|
||||||
extern size_t my_read(File Filedes,uchar *Buffer,size_t Count,myf MyFlags);
|
extern size_t my_read(File Filedes,uchar *Buffer,size_t Count,myf MyFlags);
|
||||||
extern size_t my_pread(File Filedes,uchar *Buffer,size_t Count,my_off_t offset,
|
extern size_t my_pread(File Filedes,uchar *Buffer,size_t Count,my_off_t offset,
|
||||||
|
@ -441,6 +441,20 @@
|
|||||||
inline_mysql_file_create_with_symlink(P1, P2, P3, P4, P5)
|
inline_mysql_file_create_with_symlink(P1, P2, P3, P4, P5)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
@def mysql_file_delete_with_symlink(K, P1, P2, P3)
|
||||||
|
Instrumented delete with symbolic link.
|
||||||
|
@c mysql_file_delete_with_symlink is a replacement
|
||||||
|
for @c my_handler_delete_with_symlink.
|
||||||
|
*/
|
||||||
|
#ifdef HAVE_PSI_FILE_INTERFACE
|
||||||
|
#define mysql_file_delete_with_symlink(K, P1, P2, P3) \
|
||||||
|
inline_mysql_file_delete_with_symlink(K, __FILE__, __LINE__, P1, P2, P3)
|
||||||
|
#else
|
||||||
|
#define mysql_file_delete_with_symlink(K, P1, P2, P3) \
|
||||||
|
inline_mysql_file_delete_with_symlink(P1, P2, P3)
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@def mysql_file_rename_with_symlink(K, P1, P2, P3)
|
@def mysql_file_rename_with_symlink(K, P1, P2, P3)
|
||||||
Instrumented rename with symbolic link.
|
Instrumented rename with symbolic link.
|
||||||
@ -1294,6 +1308,7 @@ inline_mysql_file_rename(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline File
|
static inline File
|
||||||
inline_mysql_file_create_with_symlink(
|
inline_mysql_file_create_with_symlink(
|
||||||
#ifdef HAVE_PSI_FILE_INTERFACE
|
#ifdef HAVE_PSI_FILE_INTERFACE
|
||||||
@ -1324,6 +1339,35 @@ inline_mysql_file_create_with_symlink(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
inline_mysql_file_delete_with_symlink(
|
||||||
|
#ifdef HAVE_PSI_FILE_INTERFACE
|
||||||
|
PSI_file_key key, const char *src_file, uint src_line,
|
||||||
|
#endif
|
||||||
|
const char *name, const char *ext, myf flags)
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
char fullname[FN_REFLEN];
|
||||||
|
fn_format(fullname, name, "", ext, MY_UNPACK_FILENAME | MY_APPEND_EXT);
|
||||||
|
#ifdef HAVE_PSI_FILE_INTERFACE
|
||||||
|
struct PSI_file_locker *locker;
|
||||||
|
PSI_file_locker_state state;
|
||||||
|
locker= PSI_FILE_CALL(get_thread_file_name_locker)
|
||||||
|
(&state, key, PSI_FILE_DELETE, fullname, &locker);
|
||||||
|
if (likely(locker != NULL))
|
||||||
|
{
|
||||||
|
PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line);
|
||||||
|
result= my_handler_delete_with_symlink(fullname, flags);
|
||||||
|
PSI_FILE_CALL(end_file_close_wait)(locker, result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
result= my_handler_delete_with_symlink(fullname, flags);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
inline_mysql_file_rename_with_symlink(
|
inline_mysql_file_rename_with_symlink(
|
||||||
#ifdef HAVE_PSI_FILE_INTERFACE
|
#ifdef HAVE_PSI_FILE_INTERFACE
|
||||||
|
@ -170,22 +170,20 @@ int my_rename_with_symlink(const char *from, const char *to, myf MyFlags)
|
|||||||
in this case both the symlink and the symlinked file are deleted,
|
in this case both the symlink and the symlinked file are deleted,
|
||||||
but only if the symlinked file is not in the datadir.
|
but only if the symlinked file is not in the datadir.
|
||||||
*/
|
*/
|
||||||
int my_handler_delete_with_symlink(PSI_file_key key, const char *name,
|
int my_handler_delete_with_symlink(const char *filename, myf sync_dir)
|
||||||
const char *ext, myf sync_dir)
|
|
||||||
{
|
{
|
||||||
char orig[FN_REFLEN], real[FN_REFLEN];
|
char real[FN_REFLEN];
|
||||||
int res= 0;
|
int res= 0;
|
||||||
DBUG_ENTER("my_handler_delete_with_symlink");
|
DBUG_ENTER("my_handler_delete_with_symlink");
|
||||||
|
|
||||||
fn_format(orig, name, "", ext, MY_UNPACK_FILENAME | MY_APPEND_EXT);
|
if (my_is_symlink(filename))
|
||||||
if (my_is_symlink(orig))
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Delete the symlinked file only if the symlink is not
|
Delete the symlinked file only if the symlink is not
|
||||||
pointing into datadir.
|
pointing into datadir.
|
||||||
*/
|
*/
|
||||||
if (!(my_realpath(real, orig, MYF(0)) || mysys_test_invalid_symlink(real)))
|
if (!(my_realpath(real, filename, MYF(0)) || mysys_test_invalid_symlink(real)))
|
||||||
res= mysql_file_delete(key, real, MYF(MY_NOSYMLINKS | sync_dir));
|
res= my_delete(real, MYF(MY_NOSYMLINKS | sync_dir));
|
||||||
}
|
}
|
||||||
DBUG_RETURN(mysql_file_delete(key, orig, MYF(sync_dir)) || res);
|
DBUG_RETURN(my_delete(filename, MYF(sync_dir)) || res);
|
||||||
}
|
}
|
||||||
|
@ -3850,7 +3850,7 @@ int handler::delete_table(const char *name)
|
|||||||
|
|
||||||
for (const char **ext=bas_ext(); *ext ; ext++)
|
for (const char **ext=bas_ext(); *ext ; ext++)
|
||||||
{
|
{
|
||||||
if (my_handler_delete_with_symlink(key_file_misc, name, *ext, 0))
|
if (mysql_file_delete_with_symlink(key_file_misc, name, *ext, 0))
|
||||||
{
|
{
|
||||||
if (my_errno != ENOENT)
|
if (my_errno != ENOENT)
|
||||||
{
|
{
|
||||||
|
@ -815,7 +815,7 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
|
|||||||
if there exists a table with the name 'db', so let's just do it
|
if there exists a table with the name 'db', so let's just do it
|
||||||
separately. We know this file exists and needs to be deleted anyway.
|
separately. We know this file exists and needs to be deleted anyway.
|
||||||
*/
|
*/
|
||||||
if (my_handler_delete_with_symlink(key_file_misc, path, "", MYF(0)) &&
|
if (mysql_file_delete_with_symlink(key_file_misc, path, "", MYF(0)) &&
|
||||||
my_errno != ENOENT)
|
my_errno != ENOENT)
|
||||||
{
|
{
|
||||||
my_error(EE_DELETE, MYF(0), path, my_errno);
|
my_error(EE_DELETE, MYF(0), path, my_errno);
|
||||||
@ -1119,7 +1119,7 @@ static bool find_db_tables_and_rm_known_files(THD *thd, MY_DIR *dirp,
|
|||||||
We ignore ENOENT error in order to skip files that was deleted
|
We ignore ENOENT error in order to skip files that was deleted
|
||||||
by concurrently running statement like REPAIR TABLE ...
|
by concurrently running statement like REPAIR TABLE ...
|
||||||
*/
|
*/
|
||||||
if (my_handler_delete_with_symlink(key_file_misc, filePath, "", MYF(0)) &&
|
if (mysql_file_delete_with_symlink(key_file_misc, filePath, "", MYF(0)) &&
|
||||||
my_errno != ENOENT)
|
my_errno != ENOENT)
|
||||||
{
|
{
|
||||||
my_error(EE_DELETE, MYF(0), filePath, my_errno);
|
my_error(EE_DELETE, MYF(0), filePath, my_errno);
|
||||||
@ -1235,7 +1235,7 @@ long mysql_rm_arc_files(THD *thd, MY_DIR *dirp, const char *org_path)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
strxmov(filePath, org_path, "/", file->name, NullS);
|
strxmov(filePath, org_path, "/", file->name, NullS);
|
||||||
if (my_handler_delete_with_symlink(key_file_misc, filePath, "", MYF(MY_WME)))
|
if (mysql_file_delete_with_symlink(key_file_misc, filePath, "", MYF(MY_WME)))
|
||||||
{
|
{
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
@ -569,7 +569,7 @@ enum open_frm_error open_table_def(THD *thd, TABLE_SHARE *share, uint flags)
|
|||||||
{
|
{
|
||||||
DBUG_ASSERT(flags & GTS_TABLE);
|
DBUG_ASSERT(flags & GTS_TABLE);
|
||||||
DBUG_ASSERT(flags & GTS_USE_DISCOVERY);
|
DBUG_ASSERT(flags & GTS_USE_DISCOVERY);
|
||||||
my_handler_delete_with_symlink(key_file_frm, path, "", MYF(0));
|
mysql_file_delete_with_symlink(key_file_frm, path, "", MYF(0));
|
||||||
file= -1;
|
file= -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -86,11 +86,11 @@ int maria_delete_table_files(const char *name, myf sync_dir)
|
|||||||
{
|
{
|
||||||
DBUG_ENTER("maria_delete_table_files");
|
DBUG_ENTER("maria_delete_table_files");
|
||||||
|
|
||||||
if (my_handler_delete_with_symlink(key_file_kfile, name, MARIA_NAME_IEXT, MYF(MY_WME | sync_dir)) ||
|
if (mysql_file_delete_with_symlink(key_file_kfile, name, MARIA_NAME_IEXT, MYF(MY_WME | sync_dir)) ||
|
||||||
my_handler_delete_with_symlink(key_file_dfile, name, MARIA_NAME_DEXT, MYF(MY_WME | sync_dir)))
|
mysql_file_delete_with_symlink(key_file_dfile, name, MARIA_NAME_DEXT, MYF(MY_WME | sync_dir)))
|
||||||
DBUG_RETURN(my_errno);
|
DBUG_RETURN(my_errno);
|
||||||
|
|
||||||
my_handler_delete_with_symlink(key_file_dfile, name, ".TMD", MYF(0));
|
mysql_file_delete_with_symlink(key_file_dfile, name, ".TMD", MYF(0));
|
||||||
my_handler_delete_with_symlink(key_file_dfile, name, ".OLD", MYF(0));
|
mysql_file_delete_with_symlink(key_file_dfile, name, ".OLD", MYF(0));
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
@ -34,14 +34,14 @@ int mi_delete_table(const char *name)
|
|||||||
check_table_is_closed(name,"delete");
|
check_table_is_closed(name,"delete");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (my_handler_delete_with_symlink(mi_key_file_kfile, name, MI_NAME_IEXT, MYF(MY_WME)) ||
|
if (mysql_file_delete_with_symlink(mi_key_file_kfile, name, MI_NAME_IEXT, MYF(MY_WME)) ||
|
||||||
my_handler_delete_with_symlink(mi_key_file_dfile, name, MI_NAME_DEXT, MYF(MY_WME)))
|
mysql_file_delete_with_symlink(mi_key_file_dfile, name, MI_NAME_DEXT, MYF(MY_WME)))
|
||||||
DBUG_RETURN(my_errno);
|
DBUG_RETURN(my_errno);
|
||||||
|
|
||||||
|
|
||||||
// optionally present:
|
// optionally present:
|
||||||
my_handler_delete_with_symlink(mi_key_file_dfile, name, ".OLD", MYF(0));
|
mysql_file_delete_with_symlink(mi_key_file_dfile, name, ".OLD", MYF(0));
|
||||||
my_handler_delete_with_symlink(mi_key_file_dfile, name, ".TMD", MYF(0));
|
mysql_file_delete_with_symlink(mi_key_file_dfile, name, ".TMD", MYF(0));
|
||||||
|
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user