Re: Proposal for changes to recovery.conf API

From: Petr Jelinek <petr(at)2ndquadrant(dot)com>
To: Abhijit Menon-Sen <ams(at)2ndQuadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Subject: Re: Proposal for changes to recovery.conf API
Date: 2016-09-06 08:56:53
Message-ID: 5d0522e7-f6c6-df4e-49d6-e8829cc8bcca@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 06/09/16 07:18, Abhijit Menon-Sen wrote:
>
> One open issue is the various assign_recovery_target_xxx functions,
> which Michael noted in his earlier review:
>
> +static void
> +assign_recovery_target_xid(const char *newval, void *extra)
> +{
> + recovery_target_xid = *((TransactionId *) extra);
> +
> + if (recovery_target_xid != InvalidTransactionId)
> + recovery_target = RECOVERY_TARGET_XID;
> + else if (recovery_target_name && *recovery_target_name)
> + recovery_target = RECOVERY_TARGET_NAME;
> + else if (recovery_target_time != 0)
> + recovery_target = RECOVERY_TARGET_TIME;
> + else if (recovery_target_lsn != 0)
> + recovery_target = RECOVERY_TARGET_LSN;
> + else
> + recovery_target = RECOVERY_TARGET_UNSET;
> +}
>
> (Note how recovery_target_lsn caused this—and three other functions
> besides—to grow an extra branch.)
>
> I don't like this code, but I'm not yet sure what to replace it with. I
> think we should address the underlying problem—that the UI doesn't map
> cleanly to what the code wants. There's been some discussion about this
> earlier, but not any consensus that I could see.
>
> Do we want something like this (easy to implement and document, perhaps
> not especially convenient to use):
>
> recovery_target = 'xid' # or 'time'/'name'/'lsn'/'immediate'
> recovery_target_xid = xxx? # the only setting we care about now
> recovery_target_otherthings = parsed_but_ignored
>
> Or something like this (a bit harder to implement):
>
> recovery_target = 'xid:xxx' # or 'time:xxx' etc.
>

Personally, I never liked the fact that we have several config variables
for this and then the last one is chosen (even when it was in
recovery.conf). We support one recovery_target at a time so it would
make sense to have single config option for it IMHO.

So +1 on the recovery_target = 'xid:xxx' idea.

--
Petr Jelinek http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stas Kelvich 2016-09-06 08:58:02 Re: Speedup twophase transactions
Previous Message Christian Ullrich 2016-09-06 08:36:45 Re: pgsql: Add putenv support for msvcrt from Visual Studio 2013