Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion addons/postgresql/dataprotection/common-scripts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function DP_purge_expired_files() {
if [[ -z ${DP_TTL_SECONDS} || ${diff_time} -lt ${interval_seconds} ]]; then
return
fi
local expiredUnix=$((${currentUnix}-${DP_TTL_SECONDS}))
local expiredUnix=$((${currentUnix}-10#${DP_TTL_SECONDS}))
local files
if ! files=$(datasafed list -f --recursive --older-than ${expiredUnix} ${root_path}); then
DP_error_log "failed to list expired WAL files" >&2
Expand Down
8 changes: 8 additions & 0 deletions addons/postgresql/scripts-ut-spec/pitr_backup_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,14 @@ EOF
The path "${DP_BACKUP_INFO_FILE}" should not be exist
End

It "treats a digit-only retention TTL as decimal when it has leading zeros"
export DATE_EPOCH_OUT=10000 DP_TTL_SECONDS=03600 DATASAFED_LIST_OUT=""
When call purge_and_report_checkpoint
The status should eq 0
The output should include "purge-checkpoint=10000"
The contents of file "${CALL_LOG}" should include "datasafed list -f --recursive --older-than 6400 /"
End

It "fails without advancing the checkpoint when the expired-WAL listing fails"
export DP_TTL_SECONDS=3600 DATASAFED_LIST_EXIT=17
When call purge_and_report_checkpoint
Expand Down
Loading