Specifying both recovery_target_xid and recovery_target_time

Started by Heikki Linnakangasabout 12 years ago3 messages
#1Heikki Linnakangas
hlinnakangas@vmware.com

The docs say:

At most one of recovery_target_time, recovery_target_name or recovery_target_xid can be specified

However, the code actually allows them all to be specified at the same time:

else if (strcmp(item->name, "recovery_target_name") == 0)
{
/*
* if recovery_target_xid specified, then this overrides
* recovery_target_name
*/
if (recoveryTarget == RECOVERY_TARGET_XID)
continue;
recoveryTarget = RECOVERY_TARGET_NAME;

The precedence is XID, time, name.

I think the documented behavior would make more sense, ie. throw an
error if you try to specify multiple targets. Anyone remember if that
was intentional? Any objections to change the code to match the docs, in
master?

- Heikki

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Heikki Linnakangas (#1)
Re: Specifying both recovery_target_xid and recovery_target_time

Heikki Linnakangas <hlinnakangas@vmware.com> writes:

The docs say:

At most one of recovery_target_time, recovery_target_name or recovery_target_xid can be specified

However, the code actually allows them all to be specified at the same time:

else if (strcmp(item->name, "recovery_target_name") == 0)
{
/*
* if recovery_target_xid specified, then this overrides
* recovery_target_name
*/
if (recoveryTarget == RECOVERY_TARGET_XID)
continue;
recoveryTarget = RECOVERY_TARGET_NAME;

The precedence is XID, time, name.

I think the documented behavior would make more sense, ie. throw an
error if you try to specify multiple targets. Anyone remember if that
was intentional? Any objections to change the code to match the docs, in
master?

Hm. I can see potential uses for specifying more than one if the behavior
were "OR", that is stop as soon as any of the specified conditions is
satisfied.

It looks like the actual behavior is to randomly choose one specified
mode and ignore the others, which I concur is bogus. But maybe we
should try to do something useful instead of just throwing an error.

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Simon Riggs
simon@2ndQuadrant.com
In reply to: Heikki Linnakangas (#1)
Re: Specifying both recovery_target_xid and recovery_target_time

On 8 January 2014 15:38, Heikki Linnakangas <hlinnakangas@vmware.com> wrote:

The docs say:

At most one of recovery_target_time, recovery_target_name or
recovery_target_xid can be specified

However, the code actually allows them all to be specified at the same time:

else if (strcmp(item->name, "recovery_target_name") == 0)
{
/*
* if recovery_target_xid specified, then this
overrides
* recovery_target_name
*/
if (recoveryTarget == RECOVERY_TARGET_XID)
continue;
recoveryTarget = RECOVERY_TARGET_NAME;

The precedence is XID, time, name.

I think the documented behavior would make more sense, ie. throw an error if
you try to specify multiple targets. Anyone remember if that was
intentional? Any objections to change the code to match the docs, in master?

It seems like I was grasping at some meaning but didn't quite achieve it.

Changing it to mean OR would make sense, but that would be more work.

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

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers