mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Fixed bug #17823: 'arc' directories inside database directories.
Server created "arc" directories inside database directories and maintained there useless copies of .frm files. Creation and renaming procedures of those copies as well as creation of "arc" directories has been discontinued. Removal procedure has been kept untouched to be able to cleanup existent database directories by the DROP DATABASE query. Also view renaming procedure has been updated to remove these directories.
This commit is contained in:
@@ -21,6 +21,9 @@
|
||||
#include <my_sys.h>
|
||||
#include <my_dir.h>
|
||||
|
||||
/* from sql_db.cc */
|
||||
extern long mysql_rm_arc_files(THD *thd, MY_DIR *dirp, const char *org_path);
|
||||
|
||||
|
||||
/*
|
||||
write string with escaping
|
||||
@@ -265,8 +268,9 @@ sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name,
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
// archive copies management
|
||||
path[path_end]='\0';
|
||||
#ifdef FRM_ARCHIVE
|
||||
// archive copies management: disabled unused feature (see bug #17823).
|
||||
if (!access(path, F_OK))
|
||||
{
|
||||
if (old_version != ULONGLONG_MAX && max_versions != 0)
|
||||
@@ -313,6 +317,7 @@ sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name,
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif//FRM_ARCHIVE
|
||||
|
||||
{
|
||||
// rename temporary file
|
||||
@@ -337,6 +342,7 @@ err_w_file:
|
||||
|
||||
SYNOPSIS
|
||||
rename_in_schema_file
|
||||
thd thread handler
|
||||
schema name of given schema
|
||||
old_name original file name
|
||||
new_name new file name
|
||||
@@ -348,7 +354,8 @@ err_w_file:
|
||||
1 - Error (only if renaming of frm failed)
|
||||
|
||||
*/
|
||||
my_bool rename_in_schema_file(const char *schema, const char *old_name,
|
||||
my_bool rename_in_schema_file(THD *thd,
|
||||
const char *schema, const char *old_name,
|
||||
const char *new_name, ulonglong revision,
|
||||
uint num_view_backups)
|
||||
{
|
||||
@@ -365,10 +372,11 @@ my_bool rename_in_schema_file(const char *schema, const char *old_name,
|
||||
if (my_rename(old_path, new_path, MYF(MY_WME)))
|
||||
return 1;
|
||||
|
||||
/* check if arc_dir exists */
|
||||
/* check if arc_dir exists: disabled unused feature (see bug #17823). */
|
||||
strxnmov(arc_path, FN_REFLEN, mysql_data_home, "/", schema, "/arc", NullS);
|
||||
(void) unpack_filename(arc_path, arc_path);
|
||||
|
||||
#ifdef FRM_ARCHIVE
|
||||
if (revision > 0 && !access(arc_path, F_OK))
|
||||
{
|
||||
ulonglong limit= ((revision > num_view_backups) ?
|
||||
@@ -384,6 +392,16 @@ my_bool rename_in_schema_file(const char *schema, const char *old_name,
|
||||
my_rename(old_path, new_path, MYF(0));
|
||||
}
|
||||
}
|
||||
#else//FRM_ARCHIVE
|
||||
{ // remove obsolete 'arc' directory and files if any
|
||||
MY_DIR *new_dirp;
|
||||
if ((new_dirp = my_dir(arc_path, MYF(MY_DONT_SORT))))
|
||||
{
|
||||
DBUG_PRINT("my",("Archive subdir found: %s", arc_path));
|
||||
(void) mysql_rm_arc_files(thd, new_dirp, arc_path);
|
||||
}
|
||||
}
|
||||
#endif//FRM_ARCHIVE
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user