Re: Proposal for changes to recovery.conf API

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Abhijit Menon-Sen <ams(at)2ndquadrant(dot)com>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>, 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 05:40:54
Message-ID: CAB7nPqSGrdWKXCzAgWTP2ZMTY1b=6H0C6q8Nq7=YVcDqj0TfyQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 6, 2016 at 2:18 PM, Abhijit Menon-Sen <ams(at)2ndquadrant(dot)com> wrote:
> One open issue is the various assign_recovery_target_xxx functions,
> which Michael noted in his earlier review:
> [...]
> 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.

By moving all the recovery parameters to GUC, we will need to define a
hierarchy among the target types. I see no way to avoid that except by
changing the parametrization but that would be more confusing for the
users. So that will not be anymore the last one wins, but the first
one listed wins in all the ones enabled that wins. I think that we
could leverage that a little bit though and reduce the complexity of
the patch: my best advice here is to make all those recovery_target_*
parameters PGC_POSTMASTER so as they are loaded only once when the
server starts, and then we define the recovery target type used in the
startup process instead of trying to do so at GUC level. This does not
change the fact that we'd still need a hierarchy among the target
types, but it slightly reduces the complexity of the patch. And this
does not prevent further enhancements by switching them later to be
PGC_SIGHUP, really. I'd really like to see this improvement, but I
don't think that this applies to this change, which is complicated
enough, and will likely introduce its lot of bugs even after several
reviews.

> 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.

Interesting ideas, particularly the last one. Mixing both:
recovery_target_type = 'foo' # can be 'immediate'
recovery_target_value = 'value_of_foo' # does not matter for 'immediate'

> Alternatively, the do-nothing option is to move the tests from guc.c to
> StartupXLOG and do it only once in some defined order (which would also
> break the current last-mention-wins behaviour).

My vote goes in favor of that..

+ else if (recovery_target_lsn != 0)
+ recovery_target = RECOVERY_TARGET_LSN;
This needs to check for InvalidXLogRecPtr.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2016-09-06 06:45:45 Re: Vacuum: allow usage of more than 1GB of work mem
Previous Message Abhijit Menon-Sen 2016-09-06 05:18:15 Re: Proposal for changes to recovery.conf API