Loading sql/parse_file.cc +21 −3 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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) Loading Loading @@ -313,6 +317,7 @@ sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name, } } } #endif//FRM_ARCHIVE { // rename temporary file Loading @@ -337,6 +342,7 @@ sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name, SYNOPSIS rename_in_schema_file thd thread handler schema name of given schema old_name original file name new_name new file name Loading @@ -348,7 +354,8 @@ sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name, 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) { Loading @@ -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) ? Loading @@ -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; } Loading sql/parse_file.h +3 −2 Original line number Diff line number Diff line Loading @@ -82,7 +82,8 @@ my_bool sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name, const LEX_STRING *type, gptr base, File_option *parameters, uint versions); 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); Loading sql/sql_db.cc +13 −4 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db, const char *path, uint level, TABLE_LIST **dropped_tables); static long mysql_rm_arc_files(THD *thd, MY_DIR *dirp, const char *org_path); long mysql_rm_arc_files(THD *thd, MY_DIR *dirp, const char *org_path); static my_bool rm_dir_w_symlink(const char *org_path, my_bool send_error); /* Database options hash */ static HASH dboptions; Loading Loading @@ -906,7 +906,11 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db, else if (file->name[0] == 'a' && file->name[1] == 'r' && file->name[2] == 'c' && file->name[3] == '\0') { /* .frm archive */ /* .frm archive: Those archives are obsolete, but following code should exist to remove existent "arc" directories. See #ifdef FRM_ARCHIVE directives for obsolete code. */ char newpath[FN_REFLEN]; MY_DIR *new_dirp; strxmov(newpath, org_path, "/", "arc", NullS); Loading Loading @@ -1061,9 +1065,13 @@ static my_bool rm_dir_w_symlink(const char *org_path, my_bool send_error) RETURN > 0 number of removed files -1 error NOTE A support of "arc" directories is obsolete, however this function should exist to remove existent "arc" directories. See #ifdef FRM_ARCHIVE directives for obsolete code. */ static long mysql_rm_arc_files(THD *thd, MY_DIR *dirp, const char *org_path) long mysql_rm_arc_files(THD *thd, MY_DIR *dirp, const char *org_path) { long deleted= 0; ulong found_other_files= 0; Loading Loading @@ -1105,6 +1113,7 @@ static long mysql_rm_arc_files(THD *thd, MY_DIR *dirp, { goto err; } deleted++; } if (thd->killed) goto err; Loading sql/sql_view.cc +2 −2 Original line number Diff line number Diff line Loading @@ -1858,7 +1858,7 @@ mysql_rename_view(THD *thd, goto err; /* rename view and it's backups */ if (rename_in_schema_file(view->db, view->table_name, new_name, if (rename_in_schema_file(thd, view->db, view->table_name, new_name, view_def.revision - 1, num_view_backups)) goto err; Loading @@ -1877,7 +1877,7 @@ mysql_rename_view(THD *thd, num_view_backups)) { /* restore renamed view in case of error */ rename_in_schema_file(view->db, new_name, view->table_name, rename_in_schema_file(thd, view->db, new_name, view->table_name, view_def.revision - 1, num_view_backups); goto err; } Loading Loading
sql/parse_file.cc +21 −3 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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) Loading Loading @@ -313,6 +317,7 @@ sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name, } } } #endif//FRM_ARCHIVE { // rename temporary file Loading @@ -337,6 +342,7 @@ sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name, SYNOPSIS rename_in_schema_file thd thread handler schema name of given schema old_name original file name new_name new file name Loading @@ -348,7 +354,8 @@ sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name, 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) { Loading @@ -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) ? Loading @@ -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; } Loading
sql/parse_file.h +3 −2 Original line number Diff line number Diff line Loading @@ -82,7 +82,8 @@ my_bool sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name, const LEX_STRING *type, gptr base, File_option *parameters, uint versions); 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); Loading
sql/sql_db.cc +13 −4 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db, const char *path, uint level, TABLE_LIST **dropped_tables); static long mysql_rm_arc_files(THD *thd, MY_DIR *dirp, const char *org_path); long mysql_rm_arc_files(THD *thd, MY_DIR *dirp, const char *org_path); static my_bool rm_dir_w_symlink(const char *org_path, my_bool send_error); /* Database options hash */ static HASH dboptions; Loading Loading @@ -906,7 +906,11 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db, else if (file->name[0] == 'a' && file->name[1] == 'r' && file->name[2] == 'c' && file->name[3] == '\0') { /* .frm archive */ /* .frm archive: Those archives are obsolete, but following code should exist to remove existent "arc" directories. See #ifdef FRM_ARCHIVE directives for obsolete code. */ char newpath[FN_REFLEN]; MY_DIR *new_dirp; strxmov(newpath, org_path, "/", "arc", NullS); Loading Loading @@ -1061,9 +1065,13 @@ static my_bool rm_dir_w_symlink(const char *org_path, my_bool send_error) RETURN > 0 number of removed files -1 error NOTE A support of "arc" directories is obsolete, however this function should exist to remove existent "arc" directories. See #ifdef FRM_ARCHIVE directives for obsolete code. */ static long mysql_rm_arc_files(THD *thd, MY_DIR *dirp, const char *org_path) long mysql_rm_arc_files(THD *thd, MY_DIR *dirp, const char *org_path) { long deleted= 0; ulong found_other_files= 0; Loading Loading @@ -1105,6 +1113,7 @@ static long mysql_rm_arc_files(THD *thd, MY_DIR *dirp, { goto err; } deleted++; } if (thd->killed) goto err; Loading
sql/sql_view.cc +2 −2 Original line number Diff line number Diff line Loading @@ -1858,7 +1858,7 @@ mysql_rename_view(THD *thd, goto err; /* rename view and it's backups */ if (rename_in_schema_file(view->db, view->table_name, new_name, if (rename_in_schema_file(thd, view->db, view->table_name, new_name, view_def.revision - 1, num_view_backups)) goto err; Loading @@ -1877,7 +1877,7 @@ mysql_rename_view(THD *thd, num_view_backups)) { /* restore renamed view in case of error */ rename_in_schema_file(view->db, new_name, view->table_name, rename_in_schema_file(thd, view->db, new_name, view->table_name, view_def.revision - 1, num_view_backups); goto err; } Loading