Skip to content

Commit bb7ab40

Browse files
committed
mariabackup : Fix enumerate_ibd_files() to include .isl
1 parent a8b3c60 commit bb7ab40

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

extra/mariabackup/backup_copy.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,6 @@ trim_dotslash(const char *path)
594594
/************************************************************************
595595
Check if string ends with given suffix.
596596
@return true if string ends with given suffix. */
597-
static
598597
bool
599598
ends_with(const char *str, const char *suffix)
600599
{

extra/mariabackup/xtrabackup.cc

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2771,14 +2771,12 @@ static dberr_t enumerate_ibd_files(process_single_tablespace_func_t callback)
27712771
ret = fil_file_readdir_next_file(&err, fil_path_to_mysql_datadir, dir,
27722772
&dbinfo);
27732773
while (ret == 0) {
2774-
size_t len = strlen(dbinfo.name);
27752774

27762775
/* General tablespaces are always at the first level of the
27772776
data home dir */
2778-
if (dbinfo.type == OS_FILE_TYPE_FILE && len > 4) {
2779-
bool is_isl = !strcmp(dbinfo.name + len - 4, ".isl");
2780-
bool is_ibd = !is_isl
2781-
&& !strcmp(dbinfo.name + len - 4, ".ibd");
2777+
if (dbinfo.type == OS_FILE_TYPE_FILE) {
2778+
bool is_isl = ends_with(dbinfo.name, ".isl");
2779+
bool is_ibd = !is_isl && ends_with(dbinfo.name,".ibd");
27822780

27832781
if (is_isl || is_ibd) {
27842782
(*callback)(NULL, dbinfo.name, is_isl);
@@ -2794,7 +2792,7 @@ static dberr_t enumerate_ibd_files(process_single_tablespace_func_t callback)
27942792
/* We found a symlink or a directory; try opening it to see
27952793
if a symlink is a directory */
27962794

2797-
len = strlen(fil_path_to_mysql_datadir)
2795+
size_t len = strlen(fil_path_to_mysql_datadir)
27982796
+ strlen (dbinfo.name) + 2;
27992797
if (len > dbpath_len) {
28002798
dbpath_len = len;
@@ -2837,16 +2835,16 @@ static dberr_t enumerate_ibd_files(process_single_tablespace_func_t callback)
28372835
size_t len = strlen(fileinfo.name);
28382836

28392837
/* We found a symlink or a file */
2840-
if (len > 4
2841-
&& !strcmp(fileinfo.name + len - 4,
2842-
".ibd")) {
2843-
(*callback)(dbinfo.name, fileinfo.name, false);
2838+
if (len > 4) {
2839+
bool is_isl= false;
2840+
if (ends_with(fileinfo.name, ".ibd") || ((is_isl = ends_with(fileinfo.name, ".ibd"))))
2841+
(*callback)(dbinfo.name, fileinfo.name, is_isl);
28442842
}
28452843
}
28462844

28472845
if (0 != os_file_closedir(dbdir)) {
28482846
fprintf(stderr, "InnoDB: Warning: could not"
2849-
" close database directory %s\n",
2847+
" close database directory %s\n",
28502848
dbpath);
28512849

28522850
err = DB_ERROR;

extra/mariabackup/xtrabackup.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,5 +196,5 @@ xb_get_copy_action(const char *dflt = "Copying");
196196
void mdl_lock_init();
197197
void mdl_lock_table(ulint space_id);
198198
void mdl_unlock_all();
199-
199+
bool ends_with(const char *str, const char *suffix);
200200
#endif /* XB_XTRABACKUP_H */

0 commit comments

Comments
 (0)