Commit bb7ab405 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

mariabackup : Fix enumerate_ibd_files() to include .isl

parent a8b3c603
...@@ -594,7 +594,6 @@ trim_dotslash(const char *path) ...@@ -594,7 +594,6 @@ trim_dotslash(const char *path)
/************************************************************************ /************************************************************************
Check if string ends with given suffix. Check if string ends with given suffix.
@return true if string ends with given suffix. */ @return true if string ends with given suffix. */
static
bool bool
ends_with(const char *str, const char *suffix) ends_with(const char *str, const char *suffix)
{ {
......
...@@ -2771,14 +2771,12 @@ static dberr_t enumerate_ibd_files(process_single_tablespace_func_t callback) ...@@ -2771,14 +2771,12 @@ static dberr_t enumerate_ibd_files(process_single_tablespace_func_t callback)
ret = fil_file_readdir_next_file(&err, fil_path_to_mysql_datadir, dir, ret = fil_file_readdir_next_file(&err, fil_path_to_mysql_datadir, dir,
&dbinfo); &dbinfo);
while (ret == 0) { while (ret == 0) {
size_t len = strlen(dbinfo.name);
/* General tablespaces are always at the first level of the /* General tablespaces are always at the first level of the
data home dir */ data home dir */
if (dbinfo.type == OS_FILE_TYPE_FILE && len > 4) { if (dbinfo.type == OS_FILE_TYPE_FILE) {
bool is_isl = !strcmp(dbinfo.name + len - 4, ".isl"); bool is_isl = ends_with(dbinfo.name, ".isl");
bool is_ibd = !is_isl bool is_ibd = !is_isl && ends_with(dbinfo.name,".ibd");
&& !strcmp(dbinfo.name + len - 4, ".ibd");
if (is_isl || is_ibd) { if (is_isl || is_ibd) {
(*callback)(NULL, dbinfo.name, is_isl); (*callback)(NULL, dbinfo.name, is_isl);
...@@ -2794,7 +2792,7 @@ static dberr_t enumerate_ibd_files(process_single_tablespace_func_t callback) ...@@ -2794,7 +2792,7 @@ static dberr_t enumerate_ibd_files(process_single_tablespace_func_t callback)
/* We found a symlink or a directory; try opening it to see /* We found a symlink or a directory; try opening it to see
if a symlink is a directory */ if a symlink is a directory */
len = strlen(fil_path_to_mysql_datadir) size_t len = strlen(fil_path_to_mysql_datadir)
+ strlen (dbinfo.name) + 2; + strlen (dbinfo.name) + 2;
if (len > dbpath_len) { if (len > dbpath_len) {
dbpath_len = len; dbpath_len = len;
...@@ -2837,16 +2835,16 @@ static dberr_t enumerate_ibd_files(process_single_tablespace_func_t callback) ...@@ -2837,16 +2835,16 @@ static dberr_t enumerate_ibd_files(process_single_tablespace_func_t callback)
size_t len = strlen(fileinfo.name); size_t len = strlen(fileinfo.name);
/* We found a symlink or a file */ /* We found a symlink or a file */
if (len > 4 if (len > 4) {
&& !strcmp(fileinfo.name + len - 4, bool is_isl= false;
".ibd")) { if (ends_with(fileinfo.name, ".ibd") || ((is_isl = ends_with(fileinfo.name, ".ibd"))))
(*callback)(dbinfo.name, fileinfo.name, false); (*callback)(dbinfo.name, fileinfo.name, is_isl);
} }
} }
if (0 != os_file_closedir(dbdir)) { if (0 != os_file_closedir(dbdir)) {
fprintf(stderr, "InnoDB: Warning: could not" fprintf(stderr, "InnoDB: Warning: could not"
" close database directory %s\n", " close database directory %s\n",
dbpath); dbpath);
err = DB_ERROR; err = DB_ERROR;
......
...@@ -196,5 +196,5 @@ xb_get_copy_action(const char *dflt = "Copying"); ...@@ -196,5 +196,5 @@ xb_get_copy_action(const char *dflt = "Copying");
void mdl_lock_init(); void mdl_lock_init();
void mdl_lock_table(ulint space_id); void mdl_lock_table(ulint space_id);
void mdl_unlock_all(); void mdl_unlock_all();
bool ends_with(const char *str, const char *suffix);
#endif /* XB_XTRABACKUP_H */ #endif /* XB_XTRABACKUP_H */
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