Skip to content

Commit 6240c9f

Browse files
committed
bugfix: fix incorrect pg_control reading (as per comment by Roman Zharkov)
1 parent 1ab642a commit 6240c9f

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/catchup.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,9 @@ catchup_preflight_checks(PGNodeInfo *source_node_info, PGconn *source_conn,
211211
{
212212
char backup_label_filename[MAXPGPATH];
213213

214-
join_path_components(backup_label_filename, dest_pgdata, "backup_label");
214+
join_path_components(backup_label_filename, dest_pgdata, PG_BACKUP_LABEL_FILE);
215215
if (fio_access(backup_label_filename, F_OK, FIO_LOCAL_HOST) == 0)
216-
elog(ERROR, "Destination directory contains \"backup_label\" file");
216+
elog(ERROR, "Destination directory contains \"" PG_BACKUP_LABEL_FILE "\" file");
217217
}
218218

219219
if (current.from_replica && exclusive_backup)
@@ -414,7 +414,7 @@ do_catchup_instance(const char *source_pgdata, const char *dest_pgdata, PGconn *
414414
true, true, false, backup_logs, true, 0, FIO_LOCAL_HOST);
415415

416416
// fill dest_redo.lsn and dest_redo.tli
417-
get_redo(dest_pgdata, &dest_redo);
417+
get_redo(dest_pgdata, FIO_LOCAL_HOST, &dest_redo);
418418
elog(INFO, "syncLSN = %X/%X", (uint32) (dest_redo.lsn >> 32), (uint32) dest_redo.lsn);
419419
}
420420

src/pg_probackup.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,7 @@ extern uint64 get_remote_system_identifier(PGconn *conn);
11771177
extern uint32 get_data_checksum_version(bool safe);
11781178
extern pg_crc32c get_pgcontrol_checksum(const char *pgdata_path);
11791179
extern uint32 get_xlog_seg_size(const char *pgdata_path);
1180-
extern void get_redo(const char *pgdata_path, RedoParams *redo);
1180+
extern void get_redo(const char *pgdata_path, fio_location pgdata_location, RedoParams *redo);
11811181
extern void set_min_recovery_point(pgFile *file, const char *backup_path,
11821182
XLogRecPtr stop_backup_lsn);
11831183
extern void copy_pgcontrol_file(const char *from_fullpath, fio_location from_location,

src/restore.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ do_restore_or_validate(InstanceState *instanceState, time_t target_backup_id, pg
485485
{
486486
RedoParams redo;
487487
parray *timelines = NULL;
488-
get_redo(instance_config.pgdata, &redo);
488+
get_redo(instance_config.pgdata, FIO_DB_HOST, &redo);
489489

490490
if (redo.checksum_version == 0)
491491
elog(ERROR, "Incremental restore in 'lsn' mode require "

src/util.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,14 +352,14 @@ get_pgcontrol_checksum(const char *pgdata_path)
352352
}
353353

354354
void
355-
get_redo(const char *pgdata_path, RedoParams *redo)
355+
get_redo(const char *pgdata_path, fio_location pgdata_location, RedoParams *redo)
356356
{
357357
ControlFileData ControlFile;
358358
char *buffer;
359359
size_t size;
360360

361361
/* First fetch file... */
362-
buffer = slurpFile(pgdata_path, XLOG_CONTROL_FILE, &size, false, FIO_DB_HOST);
362+
buffer = slurpFile(pgdata_path, XLOG_CONTROL_FILE, &size, false, pgdata_location);
363363

364364
digestControlFile(&ControlFile, buffer, size);
365365
pg_free(buffer);

0 commit comments

Comments
 (0)