Skip to content

Commit d40e299

Browse files
committed
fix dest backup search
1 parent 419008d commit d40e299

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

backup.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,7 @@ pg_stop_backup(pgBackup *backup)
876876
fwrite(PQgetvalue(res, 0, 1), 1, strlen(PQgetvalue(res, 0, 1)), fp);
877877
fclose(fp);
878878

879+
/* TODO What for do we save the file into backup_list? */
879880
file = pgFileNew(backup_label, true);
880881
calc_file_checksum(file);
881882
free(file->path);

data.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ restore_file_partly(const char *from_root,const char *to_root, pgFile *file)
319319
int errno_tmp;
320320
struct stat st;
321321
char to_path[MAXPGPATH];
322-
char buf[8192];
322+
char buf[BLCKSZ];
323323
size_t write_size = 0;
324324

325325
join_path_components(to_path, to_root, file->path + strlen(from_root) + 1);
@@ -562,7 +562,6 @@ is_compressed_data_file(pgFile *file)
562562
}
563563

564564
/*
565-
* TODO Don't use buffer.
566565
* Add check that file is not bigger than RELSEG_SIZE.
567566
* WARNING compressed file can be exceed this limit.
568567
* Add compression.
@@ -575,7 +574,7 @@ copy_file(const char *from_root, const char *to_root, pgFile *file)
575574
FILE *out;
576575
size_t read_len = 0;
577576
int errno_tmp;
578-
char buf[8192];
577+
char buf[BLCKSZ];
579578
struct stat st;
580579
pg_crc32 crc;
581580

@@ -705,7 +704,7 @@ copy_file_partly(const char *from_root, const char *to_root,
705704
size_t read_len = 0;
706705
int errno_tmp;
707706
struct stat st;
708-
char buf[8192];
707+
char buf[BLCKSZ];
709708

710709
/* reset size summary */
711710
file->read_size = 0;
@@ -823,15 +822,14 @@ copy_file_partly(const char *from_root, const char *to_root,
823822
* Calculate checksum of various files which are not copied from PGDATA,
824823
* but created in process of backup, such as stream XLOG files,
825824
* PG_TABLESPACE_MAP_FILE and PG_BACKUP_LABEL_FILE.
826-
* TODO Why do we read them into a buffer of blocksize?
827825
*/
828826
bool
829827
calc_file_checksum(pgFile *file)
830828
{
831829
FILE *in;
832830
size_t read_len = 0;
833831
int errno_tmp;
834-
char buf[8192];
832+
char buf[BLCKSZ];
835833
struct stat st;
836834
pg_crc32 crc;
837835

restore.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,9 @@ do_restore_or_validate(time_t target_backup_id,
135135
* We found target backup. Check its status and
136136
* ensure that it satisfies recovery target.
137137
*/
138-
if (target_backup_id == current_backup->start_time
138+
if ((target_backup_id == current_backup->start_time
139139
|| target_backup_id == INVALID_BACKUP_ID)
140+
&& !dest_backup)
140141
{
141142
if (current_backup->status != BACKUP_STATUS_OK)
142143
elog(ERROR, "given backup %s is in %s status",

0 commit comments

Comments
 (0)