Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Issue 74: copy_file and backup_data_file() lax behavior#75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
gsmolk merged 1 commit intomasterfromissue_74
May 27, 2019
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletionssrc/backup.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2466,7 +2466,8 @@ backup_files(void *arg)
arguments->prev_start_lsn,
current.backup_mode,
instance_config.compress_alg,
instance_config.compress_level))
instance_config.compress_level,
true))
{
/* disappeared file not to be confused with 'not changed' */
if (file->write_size != FILE_NOT_FOUND)
Expand DownExpand Up@@ -2508,7 +2509,7 @@ backup_files(void *arg)
else
dst = arguments->to_root;
if (skip ||
!copy_file(FIO_DB_HOST, dst, FIO_BACKUP_HOST, file))
!copy_file(FIO_DB_HOST, dst, FIO_BACKUP_HOST, file, true))
{
/* disappeared file not to be confused with 'not changed' */
if (file->write_size != FILE_NOT_FOUND)
Expand Down
30 changes: 20 additions & 10 deletionssrc/data.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -521,7 +521,7 @@ bool
backup_data_file(backup_files_arg* arguments,
const char *to_path, pgFile *file,
XLogRecPtr prev_backup_start_lsn, BackupMode backup_mode,
CompressAlg calg, int clevel)
CompressAlg calg, int clevel, bool missing_ok)
{
FILE*in;
FILE*out;
Expand DownExpand Up@@ -567,9 +567,14 @@ backup_data_file(backup_files_arg* arguments,
*/
if (errno == ENOENT)
{
elog(LOG, "File \"%s\" is not found", file->path);
file->write_size = FILE_NOT_FOUND;
return false;
if (missing_ok)
{
elog(LOG, "File \"%s\" is not found", file->path);
file->write_size = FILE_NOT_FOUND;
return false;
}
else
elog(ERROR, "File \"%s\" is not found", file->path);
}

elog(ERROR, "cannot open file \"%s\": %s",
Expand DownExpand Up@@ -754,7 +759,7 @@ restore_data_file(const char *to_path, pgFile *file, bool allow_truncate,
break;

/*
* We need to truncate result file if data file ina incremental backup
* We need to truncate result file if data file inan incremental backup
* less than data file in a full backup. We know it thanks to n_blocks.
*
* It may be equal to -1, then we don't want to truncate the result
Expand DownExpand Up@@ -939,7 +944,7 @@ restore_data_file(const char *to_path, pgFile *file, bool allow_truncate,
*/
bool
copy_file(fio_location from_location, const char *to_root,
fio_location to_location, pgFile *file)
fio_location to_location, pgFile *file, bool missing_ok)
{
charto_path[MAXPGPATH];
FILE *in;
Expand All@@ -963,12 +968,17 @@ copy_file(fio_location from_location, const char *to_root,
FIN_FILE_CRC32(true, crc);
file->crc = crc;

/* maybe deleted, it's not error */
/* maybe deleted, it's not errorin case of backup*/
if (errno == ENOENT)
{
elog(LOG, "File \"%s\" is not found", file->path);
file->write_size = FILE_NOT_FOUND;
return false;
if (missing_ok)
{
elog(LOG, "File \"%s\" is not found", file->path);
file->write_size = FILE_NOT_FOUND;
return false;
}
else
elog(ERROR, "File \"%s\" is not found", file->path);
}

elog(ERROR, "cannot open source file \"%s\": %s", file->path,
Expand Down
9 changes: 5 additions & 4 deletionssrc/merge.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -489,7 +489,7 @@ merge_files(void *arg)
* of DELTA backup we should consider n_blocks to truncate the target
* backup.
*/
if (file->write_size == BYTES_INVALID && file->n_blocks ==-1)
if (file->write_size == BYTES_INVALID && file->n_blocks ==BLOCKNUM_INVALID)
{
elog(VERBOSE, "Skip merging file \"%s\", the file didn't change",
file->path);
Expand DownExpand Up@@ -605,7 +605,8 @@ merge_files(void *arg)
to_backup->start_lsn,
to_backup->backup_mode,
to_backup->compress_alg,
to_backup->compress_level);
to_backup->compress_level,
false);

file->path = prev_path;

Expand DownExpand Up@@ -645,12 +646,12 @@ merge_files(void *arg)
argument->from_external);
makeExternalDirPathByNum(to_root, argument->to_external_prefix,
new_dir_num);
copy_file(FIO_LOCAL_HOST, to_root, FIO_LOCAL_HOST, file);
copy_file(FIO_LOCAL_HOST, to_root, FIO_LOCAL_HOST, file, false);
}
else if (strcmp(file->name, "pg_control") == 0)
copy_pgcontrol_file(argument->from_root, FIO_LOCAL_HOST, argument->to_root, FIO_LOCAL_HOST, file);
else
copy_file(FIO_LOCAL_HOST, argument->to_root, FIO_LOCAL_HOST, file);
copy_file(FIO_LOCAL_HOST, argument->to_root, FIO_LOCAL_HOST, file, false);

/*
* We need to save compression algorithm type of the target backup to be
Expand Down
5 changes: 3 additions & 2 deletionssrc/pg_probackup.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -629,13 +629,14 @@ extern bool backup_data_file(backup_files_arg* arguments,
const char *to_path, pgFile *file,
XLogRecPtr prev_backup_start_lsn,
BackupMode backup_mode,
CompressAlg calg, int clevel);
CompressAlg calg, int clevel,
bool missing_ok);
extern void restore_data_file(const char *to_path,
pgFile *file, bool allow_truncate,
bool write_header,
uint32 backup_version);
extern bool copy_file(fio_location from_location, const char *to_root,
fio_location to_location, pgFile *file);
fio_location to_location, pgFile *file, bool missing_ok);

extern bool check_file_pages(pgFile *file, XLogRecPtr stop_lsn,
uint32 checksum_version, uint32 backup_version);
Expand Down
4 changes: 2 additions & 2 deletionssrc/restore.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -742,7 +742,7 @@ restore_files(void *arg)
if (backup_contains_external(external_path,
arguments->dest_external_dirs))
copy_file(FIO_BACKUP_HOST,
external_path, FIO_DB_HOST, file);
external_path, FIO_DB_HOST, file, false);
}
else if (strcmp(file->name, "pg_control") == 0)
copy_pgcontrol_file(from_root, FIO_BACKUP_HOST,
Expand All@@ -751,7 +751,7 @@ restore_files(void *arg)
else
copy_file(FIO_BACKUP_HOST,
instance_config.pgdata, FIO_DB_HOST,
file);
file, false);

/* print size of restored file */
if (file->write_size != BYTES_INVALID)
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp