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

Commit 5190d57

Browse files
committed
first notes in the code
1 parent 410aa2d commit 5190d57

File tree

1 file changed

+63
-8
lines changed

1 file changed

+63
-8
lines changed

contrib/pg_probackup/backup.c

Lines changed: 63 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,14 +1207,63 @@ backup_files(void *arg)
12071207
}
12081208

12091209
/* copy the file into backup */
1210-
if (!(file->is_datafile
1211-
? backup_data_file(arguments->from_root, arguments->to_root, file, arguments->lsn)
1212-
: copy_file(arguments->from_root, arguments->to_root, file)))
1210+
if (file->is_datafile)
12131211
{
1214-
/* record as skipped file in file_xxx.txt */
1215-
file->write_size = BYTES_INVALID;
1216-
elog(LOG, "skip");
1217-
continue;
1212+
if (!backup_data_file(arguments->from_root,
1213+
arguments->to_root, file,
1214+
arguments->lsn))
1215+
{
1216+
/* record as skipped file in file_xxx.txt */
1217+
file->write_size = BYTES_INVALID;
1218+
elog(LOG, "skip");
1219+
continue;
1220+
}
1221+
}
1222+
else
1223+
{
1224+
/* Check if the file is a cfs relation's segment */
1225+
bool is_cfs_relation_segment = false;
1226+
pgFile tmp_file;
1227+
pgFile **pre_search_file;
1228+
tmp_file.path = psprintf("%s.cfm", file->path);
1229+
pre_search_file = (pgFile **) parray_bsearch(arguments->files, &tmp_file, pgFileComparePath);
1230+
if (pre_search_file != NULL)
1231+
{
1232+
is_cfs_relation_segment = true;
1233+
/* TODO If we don't have ptrack simply copy the file */
1234+
if (file->pagemap.bitmapsize == 0)
1235+
{
1236+
is_cfs_relation_segment = false;
1237+
elog(NOTICE, "1 file '%s' is a cfs relation's segment, bitmapsize == 0 \n", file->path);
1238+
}
1239+
}
1240+
pg_free(tmp_file.path);
1241+
1242+
1243+
if (is_cfs_relation_segment)
1244+
{
1245+
/*
1246+
* TODO backup cfs segment
1247+
* see backup_data_file()
1248+
*/
1249+
elog(NOTICE, "2 file '%s' is a cfs relation's segment \n", file->path);
1250+
elog(NOTICE, "2 file->pagemap.bitmapsize = %d", file->pagemap.bitmapsize);
1251+
datapagemap_iterator_t *iter;
1252+
BlockNumber blknum = 0;
1253+
1254+
iter = datapagemap_iterate(&file->pagemap);
1255+
while(datapagemap_next(iter, &blknum))
1256+
elog(NOTICE, "2 blknum %u", blknum);
1257+
}
1258+
else if (!copy_file(arguments->from_root,
1259+
arguments->to_root,
1260+
file))
1261+
{
1262+
/* record as skipped file in file_xxx.txt */
1263+
file->write_size = BYTES_INVALID;
1264+
elog(LOG, "skip");
1265+
continue;
1266+
}
12181267
}
12191268

12201269
elog(LOG, "copied %lu", (unsigned long) file->write_size);
@@ -1314,7 +1363,10 @@ add_files(parray *files, const char *root, bool add_root, bool is_pgdata)
13141363
{
13151364
if (current.backup_mode == BACKUP_MODE_DIFF_PTRACK ||
13161365
current.backup_mode == BACKUP_MODE_DIFF_PAGE)
1317-
elog(ERROR, "You can't use incremental backup with compress tablespace");
1366+
{
1367+
elog(NOTICE, "You can't use incremental backup with compress tablespace");
1368+
/* TODO Add here incremental backup for compressed tablespaces */
1369+
}
13181370
continue;
13191371
}
13201372

@@ -1351,6 +1403,9 @@ add_files(parray *files, const char *root, bool add_root, bool is_pgdata)
13511403
}
13521404

13531405
/* mark cfs relations as not data */
1406+
/* TODO
1407+
* Don't mark cfs relations as not_datafile?
1408+
* We can use similar code to check if the file is compressed */
13541409
for (i = 0; i < (int) parray_num(list_file); i++)
13551410
{
13561411
pgFile *file = (pgFile *) parray_get(list_file, i);

0 commit comments

Comments
 (0)