From 1bacc62bb721f96464aeb3b405248dd44e29f372 Mon Sep 17 00:00:00 2001 From: Pavol Ipoth Date: Tue, 24 Jan 2023 12:28:58 +0100 Subject: [PATCH] Fix clone restore time --- postgres-appliance/bootstrap/clone_with_wale.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/postgres-appliance/bootstrap/clone_with_wale.py b/postgres-appliance/bootstrap/clone_with_wale.py index e8d31962d..d1d905bb2 100755 --- a/postgres-appliance/bootstrap/clone_with_wale.py +++ b/postgres-appliance/bootstrap/clone_with_wale.py @@ -70,11 +70,16 @@ def choose_backup(backup_list, recovery_target_time): match_timestamp = match = None for backup in backup_list: - last_modified = parse(backup['last_modified']) - if last_modified < recovery_target_time: - if match is None or last_modified > match_timestamp: + backup_time_field = 'last_modified' + + if os.getenv('USE_WALG_RESTORE') == 'true': + backup_time_field = 'start_time' + + backup_time = parse(backup[backup_time_field]) + if backup_time < recovery_target_time: + if match is None or backup_time > match_timestamp: match = backup - match_timestamp = last_modified + match_timestamp = backup_time if match is not None: return match['name']