From c5dc624a79da2198229b0c7ab3a34c94ffcba836 Mon Sep 17 00:00:00 2001 From: Grigory Smolkin Date: Sun, 31 May 2020 14:42:06 +0300 Subject: [PATCH 1/3] cleanup the leftovers from page fixing via pg_ptrack_get_block() --- src/data.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/src/data.c b/src/data.c index 83e95c86..6bdb6028 100644 --- a/src/data.c +++ b/src/data.c @@ -353,17 +353,6 @@ prepare_page(ConnectionArgs *conn_arg, Assert(false); } } - - /* - * If ptrack support is available, use it to get invalid block - * instead of rereading it 99 times - */ - if (!page_is_valid && strict && ptrack_version_num > 0) - { - elog(WARNING, "File \"%s\", block %u, try to fetch via shared buffer", - from_fullpath, blknum); - break; - } } /* @@ -385,7 +374,7 @@ prepare_page(ConnectionArgs *conn_arg, /* Error out in case of merge or backup without ptrack support; * issue warning in case of checkdb or backup with ptrack support */ - if (!strict || (strict && ptrack_version_num > 0)) + if (!strict) elevel = WARNING; if (errormsg) @@ -396,16 +385,12 @@ prepare_page(ConnectionArgs *conn_arg, from_fullpath, blknum); pg_free(errormsg); + return PageIsCorrupted; } /* Checkdb not going futher */ if (!strict) - { - if (page_is_valid) - return PageIsOk; - else - return PageIsCorrupted; - } + return PageIsOk; } /* From 122f88ba56473ba9561961045c874ac07df6f139 Mon Sep 17 00:00:00 2001 From: Grigory Smolkin Date: Sun, 31 May 2020 22:49:45 +0300 Subject: [PATCH 2/3] [PBCKP-101] fix accessing already freed memory --- src/restore.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/restore.c b/src/restore.c index 749f3557..5d50da01 100644 --- a/src/restore.c +++ b/src/restore.c @@ -99,7 +99,7 @@ do_restore_or_validate(time_t target_backup_id, pgRecoveryTarget *rt, { int i = 0; int j = 0; - parray *backups; + parray *backups = NULL; pgBackup *tmp_backup = NULL; pgBackup *current_backup = NULL; pgBackup *dest_backup = NULL; @@ -475,13 +475,14 @@ do_restore_or_validate(time_t target_backup_id, pgRecoveryTarget *rt, /* ssh connection to longer needed */ fio_disconnect(); + elog(INFO, "%s of backup %s completed.", + action, base36enc(dest_backup->start_time)); + /* cleanup */ parray_walk(backups, pgBackupFree); parray_free(backups); parray_free(parent_chain); - elog(INFO, "%s of backup %s completed.", - action, base36enc(dest_backup->start_time)); return 0; } From 5699b137561d396a3ef88b1e937e855f26ab30d0 Mon Sep 17 00:00:00 2001 From: Grigory Smolkin Date: Sun, 31 May 2020 22:56:02 +0300 Subject: [PATCH 3/3] [PBCKP-98] initialize result variable in get_next_record_lsn --- src/parsexlog.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/parsexlog.c b/src/parsexlog.c index e9410c88..5a33d304 100644 --- a/src/parsexlog.c +++ b/src/parsexlog.c @@ -691,7 +691,8 @@ get_next_record_lsn(const char *archivedir, XLogSegNo segno, { XLogReaderState *xlogreader; XLogReaderData reader_data; - XLogRecPtr startpoint, found, res; + XLogRecPtr startpoint, found; + XLogRecPtr res = InvalidXLogRecPtr; char wal_segment[MAXFNAMELEN]; int attempts = 0;