Re: Bug in writeTimeLineHistory - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: Bug in writeTimeLineHistory
Date
Msg-id 1287080255.1725.1091.camel@ebony
Whole thread Raw
In response to Bug in writeTimeLineHistory  (Fujii Masao <masao.fujii@gmail.com>)
List pgsql-hackers
Agreed, committed and backpatched.

On Thu, 2010-10-14 at 14:11 +0900, Fujii Masao wrote:
> Hi,
> 
> --------------
>     if (recoveryTarget == RECOVERY_TARGET_XID)
>         snprintf(buffer, sizeof(buffer),
>                  "%s%u\t%s\t%s transaction %u\n",
>                  (srcfd < 0) ? "" : "\n",
>                  parentTLI,
>                  xlogfname,
>                  recoveryStopAfter ? "after" : "before",
>                  recoveryStopXid);
>     if (recoveryTarget == RECOVERY_TARGET_TIME)
>         snprintf(buffer, sizeof(buffer),
>                  "%s%u\t%s\t%s %s\n",
>                  (srcfd < 0) ? "" : "\n",
>                  parentTLI,
>                  xlogfname,
>                  recoveryStopAfter ? "after" : "before",
>                  timestamptz_to_str(recoveryStopTime));
>     else
>         snprintf(buffer, sizeof(buffer),
>                  "%s%u\t%s\tno recovery target specified\n",
>                  (srcfd < 0) ? "" : "\n",
>                  parentTLI,
>                  xlogfname);
> --------------
> 
> In writeTimeLineHistory, the result of the above first snprintf is always
> overwritten by the following snprintf wrongly. I guess we forgot putting
> "else" in the second "if" statement. I attached the very simple patch.
> 
> Since this bug was introduced in v9.0, the patch needs to be backported
> to 9.0.
> 
> Regards,
> 

-- Simon Riggs           www.2ndQuadrant.comPostgreSQL Development, 24x7 Support, Training and Services



pgsql-hackers by date:

Previous
From: Dean Rasheed
Date:
Subject: Re: Re: starting to review the Extend NOT NULL representation to pg_constraint patch
Next
From: Simon Riggs
Date:
Subject: Re: signal and startup process