Skip to content

Commit f3c62d6

Browse files
committed
Fix remote backup validate
1 parent 1b58ec8 commit f3c62d6

File tree

6 files changed

+18
-12
lines changed

6 files changed

+18
-12
lines changed

src/backup.c

+3
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,10 @@ do_backup(time_t start_time)
999999
// current.data_bytes);
10001000

10011001
if (is_remote_agent)
1002+
{
10021003
fio_transfer(FIO_BACKUP_START_TIME);
1004+
fio_transfer(FIO_BACKUP_STOP_LSN);
1005+
}
10031006
else
10041007
complete_backup();
10051008

src/fetch.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
*
2626
*/
2727
char *
28-
slurpFile(const char *datadir, const char *path, size_t *filesize, bool safe)
28+
slurpFile(const char *datadir, const char *path, size_t *filesize, bool safe, fio_location location)
2929
{
3030
int fd;
3131
char *buffer;
@@ -34,7 +34,7 @@ slurpFile(const char *datadir, const char *path, size_t *filesize, bool safe)
3434
int len;
3535
snprintf(fullpath, sizeof(fullpath), "%s/%s", datadir, path);
3636

37-
if ((fd = fio_open(fullpath, O_RDONLY | PG_BINARY, FIO_DB_HOST)) == -1)
37+
if ((fd = fio_open(fullpath, O_RDONLY | PG_BINARY, location)) == -1)
3838
{
3939
if (safe)
4040
return NULL;

src/pg_probackup.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,8 @@ extern int do_delete_instance(void);
454454
extern char *slurpFile(const char *datadir,
455455
const char *path,
456456
size_t *filesize,
457-
bool safe);
457+
bool safe,
458+
fio_location location);
458459
extern char *fetchFile(PGconn *conn, const char *filename, size_t *filesize);
459460

460461
/* in help.c */

src/util.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ get_current_timeline(bool safe)
154154

155155
/* First fetch file... */
156156
buffer = slurpFile(instance_config.pgdata, "global/pg_control", &size,
157-
safe);
157+
safe, FIO_DB_HOST);
158158
if (safe && buffer == NULL)
159159
return 0;
160160

@@ -212,7 +212,7 @@ get_system_identifier(const char *pgdata_path)
212212
size_t size;
213213

214214
/* First fetch file... */
215-
buffer = slurpFile(pgdata_path, "global/pg_control", &size, false);
215+
buffer = slurpFile(pgdata_path, "global/pg_control", &size, false, FIO_DB_HOST);
216216
if (buffer == NULL)
217217
return 0;
218218
digestControlFile(&ControlFile, buffer, size);
@@ -263,7 +263,7 @@ get_xlog_seg_size(char *pgdata_path)
263263
size_t size;
264264

265265
/* First fetch file... */
266-
buffer = slurpFile(pgdata_path, "global/pg_control", &size, false);
266+
buffer = slurpFile(pgdata_path, "global/pg_control", &size, false, FIO_DB_HOST);
267267
if (buffer == NULL)
268268
return 0;
269269
digestControlFile(&ControlFile, buffer, size);
@@ -284,7 +284,7 @@ get_data_checksum_version(bool safe)
284284

285285
/* First fetch file... */
286286
buffer = slurpFile(instance_config.pgdata, "global/pg_control", &size,
287-
safe);
287+
safe, FIO_DB_HOST);
288288
if (buffer == NULL)
289289
return 0;
290290
digestControlFile(&ControlFile, buffer, size);
@@ -301,7 +301,7 @@ get_pgcontrol_checksum(const char *pgdata_path)
301301
size_t size;
302302

303303
/* First fetch file... */
304-
buffer = slurpFile(pgdata_path, "global/pg_control", &size, false);
304+
buffer = slurpFile(pgdata_path, "global/pg_control", &size, false, FIO_BACKUP_HOST);
305305
if (buffer == NULL)
306306
return 0;
307307
digestControlFile(&ControlFile, buffer, size);
@@ -324,7 +324,7 @@ set_min_recovery_point(pgFile *file, const char *backup_path,
324324
char fullpath[MAXPGPATH];
325325

326326
/* First fetch file content */
327-
buffer = slurpFile(instance_config.pgdata, XLOG_CONTROL_FILE, &size, false);
327+
buffer = slurpFile(instance_config.pgdata, XLOG_CONTROL_FILE, &size, false, FIO_DB_HOST);
328328
if (buffer == NULL)
329329
elog(ERROR, "ERROR");
330330

@@ -367,7 +367,7 @@ copy_pgcontrol_file(const char *from_root, const char *to_root, pgFile *file, fi
367367
size_t size;
368368
char to_path[MAXPGPATH];
369369

370-
buffer = slurpFile(from_root, XLOG_CONTROL_FILE, &size, false);
370+
buffer = slurpFile(from_root, XLOG_CONTROL_FILE, &size, false, FIO_DB_HOST);
371371

372372
digestControlFile(&ControlFile, buffer, size);
373373

src/utils/file.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ static int fio_stdin = 0;
1818

1919
static fio_binding fio_bindings[] =
2020
{
21-
{&current.start_time, sizeof(current.start_time)}
21+
{&current.start_time, sizeof(current.start_time)},
22+
{&current.stop_lsn, sizeof(current.stop_lsn)}
2223
};
2324

2425
#define fio_fileno(f) (((size_t)f - 1) | FIO_PIPE_MARKER)

src/utils/file.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ typedef enum
3838

3939
typedef enum
4040
{
41-
FIO_BACKUP_START_TIME
41+
FIO_BACKUP_START_TIME,
42+
FIO_BACKUP_STOP_LSN
4243
} fio_shared_variable;
4344

4445
#define FIO_FDMAX 64

0 commit comments

Comments
 (0)