Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 510508a

Browse files
committed
Mark compress files by cfs as not data.
1 parent 6d6a584 commit 510508a

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

backup.c

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1201,7 +1201,7 @@ add_files(parray *files, const char *root, bool add_root, bool is_pgdata)
12011201
dir_list_file(list_file, root, pgdata_exclude, true, add_root);
12021202

12031203
/* mark files that are possible datafile as 'datafile' */
1204-
for (i = 0; i < parray_num(list_file); i++)
1204+
for (i = 0; i < (int) parray_num(list_file); i++)
12051205
{
12061206
pgFile *file = (pgFile *) parray_get(list_file, i);
12071207
char *relative;
@@ -1221,6 +1221,8 @@ add_files(parray *files, const char *root, bool add_root, bool is_pgdata)
12211221
continue;
12221222

12231223
path_len = strlen(file->path);
1224+
1225+
/* Get link ptrack file to realations files */
12241226
if (path_len > 6 && strncmp(file->path+(path_len-6), "ptrack", 6) == 0)
12251227
{
12261228
pgFile *search_file;
@@ -1254,6 +1256,10 @@ add_files(parray *files, const char *root, bool add_root, bool is_pgdata)
12541256
continue;
12551257
}
12561258

1259+
/* compress map file it is not data file */
1260+
if (path_len > 4 && strncmp(file->path+(path_len-4), ".cfm", 4) == 0)
1261+
continue;
1262+
12571263
/* name of data file start with digit */
12581264
fname = last_dir_separator(relative);
12591265
if (fname == NULL)
@@ -1286,6 +1292,27 @@ add_files(parray *files, const char *root, bool add_root, bool is_pgdata)
12861292
file->segno = (int) strtol(text_segno, NULL, 10);
12871293
}
12881294
}
1295+
1296+
/* mark cfs relations as not data */
1297+
for (i = 0; i < (int) parray_num(list_file); i++)
1298+
{
1299+
pgFile *file = (pgFile *) parray_get(list_file, i);
1300+
int path_len = (int) strlen(file->path);
1301+
1302+
if (path_len > 4 && strncmp(file->path+(path_len-4), ".cfm", 4) == 0)
1303+
{
1304+
pgFile **pre_search_file;
1305+
pgFile tmp_file;
1306+
tmp_file.path = pg_strdup(file->path);
1307+
tmp_file.path[path_len-4] = '\0';
1308+
pre_search_file = (pgFile **) parray_bsearch(list_file, &tmp_file, pgFileComparePath);
1309+
if (pre_search_file != NULL)
1310+
{
1311+
(*pre_search_file)->is_datafile = false;
1312+
}
1313+
pg_free(tmp_file.path);
1314+
}
1315+
}
12891316
parray_concat(files, list_file);
12901317
}
12911318

0 commit comments

Comments
 (0)