Re: recovery_target_time = 'now' is not an error but still impractical setting

From: Simon Riggs <simon(at)2ndquadrant(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Piotr Stefaniak <postgres(at)piotr-stefaniak(dot)me>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: recovery_target_time = 'now' is not an error but still impractical setting
Date: 2017-08-18 08:21:47
Message-ID: CANP8+jJdKA+BkkYLWz9zAm16Y0s2ExBv0WfpAwXdTpPfWnA9Bg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 18 August 2017 at 07:30, Michael Paquier <michael(dot)paquier(at)gmail(dot)com> wrote:
> On Thu, Aug 17, 2017 at 6:24 PM, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:
>> On 15 August 2017 at 15:37, Piotr Stefaniak <postgres(at)piotr-stefaniak(dot)me> wrote:
>>
>>> One thing I tried was a combination of recovery_target_action =
>>> 'shutdown' and recovery_target_time = 'now'. The result is surprising
>>
>> Indeed, special timestamp values were never considered in the design,
>> so I'm not surprised they don't work and have never been tested.
>
> We could always use a TRY/CATCH block and add an error in
> GetCurrentDateTime and GetCurrentTimeUsec if they are called out of a
> transaction context. Rather-safe-than-sorry.
>
>> Your suggestion of "furthest" is already the default behaviour.
>>
>> Why are you using 'now'? Why would you want to pick a randomly
>> selected end time?
>
> "now" is not much interesting, targets in the past are more, like
> 'yesterday'. This could create back an instance back to the beginning
> of the previous day, simplifying scripts creating recovery.conf a bit,
> even if that's not much simplification as we are talking about
> creating a timestamp string.

I can't see any value in allowing imprecise and effective random timestamps.

ISTM if we care, it would be better to simply exclude the 7 named
timestamps prior to their being sent, as in the attached patch.

--
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
exclude_special_values_in_recovery_target_time.v1.patch application/octet-stream 863 bytes

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Piotr Stefaniak 2017-08-18 08:39:10 Re: recovery_target_time = 'now' is not an error but still impractical setting
Previous Message vinayak 2017-08-18 08:20:18 Re: ECPG: WHENEVER statement with DO CONTINUE action