From 960b4ebf3ad3959d8961b07b54dcde663abf1c62 Mon Sep 17 00:00:00 2001 From: Amber Date: Mon, 17 Aug 2026 07:16:08 +0800 Subject: [PATCH 1/2] test(postgresql): cover current PITR timeline history --- addons/postgresql/scripts-ut-spec/pitr_restore_spec.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/addons/postgresql/scripts-ut-spec/pitr_restore_spec.sh b/addons/postgresql/scripts-ut-spec/pitr_restore_spec.sh index bb756dfed3..34e5ffe361 100644 --- a/addons/postgresql/scripts-ut-spec/pitr_restore_spec.sh +++ b/addons/postgresql/scripts-ut-spec/pitr_restore_spec.sh @@ -286,6 +286,16 @@ EOF The path "${tmpdir}/dest/00000002.history" should be exist End + It "fetches current timeline history even when it sorts below the start WAL" + export DATASAFED_LIST_ROOT="20260816/" + export DATASAFED_LIST_DIR="00000002.history.zst +000000020000000000000001.zst" + When call fetch-wal-log "${tmpdir}/dest" "000000020000000000000001" "2026-01-01 00:00:00" true + The status should eq 0 + The path "${tmpdir}/dest/00000002.history" should be exist + The result of function call_log should include "datasafed pull -d zstd 00000002.history.zst" + End + It "stops at the first WAL pull failure instead of crossing an archive gap" export DATASAFED_LIST_ROOT="20260816/" export DATASAFED_LIST_DIR="000000010000000000000002.zst From 27005b6de023481eeda77c580b6cd3555f06323a Mon Sep 17 00:00:00 2001 From: Amber Date: Mon, 17 Aug 2026 07:19:46 +0800 Subject: [PATCH 2/2] fix(postgresql): retain current PITR timeline history --- addons/postgresql/dataprotection/postgresql-fetch-wal-log.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/postgresql/dataprotection/postgresql-fetch-wal-log.sh b/addons/postgresql/dataprotection/postgresql-fetch-wal-log.sh index 7e44973fee..740738130c 100644 --- a/addons/postgresql/dataprotection/postgresql-fetch-wal-log.sh +++ b/addons/postgresql/dataprotection/postgresql-fetch-wal-log.sh @@ -54,7 +54,7 @@ function fetch-wal-log(){ if [[ ! $wal_name =~ ^[0-9A-F]{24}$ && ! $wal_name =~ ^[0-9A-F]{8}\.history$ ]]; then continue fi - if [[ $wal_name < $start_wal_name ]]; then + if [[ ! $wal_name =~ \.history$ && $wal_name < $start_wal_name ]]; then continue fi if [[ $pitr != "true" && $file =~ ".history" ]]; then