Thread: pgsql: Forbid using pg_xlogfile_name() and pg_xlogfile_name_offset()

pgsql: Forbid using pg_xlogfile_name() and pg_xlogfile_name_offset()

From
heikki@postgresql.org (Heikki Linnakangas)
Date:
Log Message:
-----------
Forbid using pg_xlogfile_name() and pg_xlogfile_name_offset() during
recovery. We might want to relax this in the future, but ThisTimeLineID
isn't currently correct in backends during recovery, so the filename
returned was wrong.

Modified Files:
--------------
    pgsql/doc/src/sgml:
        func.sgml (r1.512 -> r1.513)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/func.sgml?r1=1.512&r2=1.513)
    pgsql/src/backend/access/transam:
        xlog.c (r1.389 -> r1.390)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/transam/xlog.c?r1=1.389&r2=1.390)

Re: pgsql: Forbid using pg_xlogfile_name() and pg_xlogfile_name_offset()

From
Simon Riggs
Date:
On Wed, 2010-04-07 at 06:12 +0000, Heikki Linnakangas wrote:
> Log Message:
> -----------
> Forbid using pg_xlogfile_name() and pg_xlogfile_name_offset() during
> recovery. We might want to relax this in the future, but ThisTimeLineID
> isn't currently correct in backends during recovery, so the filename
> returned was wrong.

Any reason why we couldn't just do this:

if (RecoveryInProgress())
{
    volatile XLogCtlData *xlogctl = XLogCtl;
    XLogFileName(xlogfilename, xlogctl->ThisTimeLineID,
            xlogid, xlogseg);
}
else
    XLogFileName(xlogfilename, ThisTimeLineID, xlogid, xlogseg);


rather than preventing access to those functions completely?

--
 Simon Riggs           www.2ndQuadrant.com


Re: pgsql: Forbid using pg_xlogfile_name() and pg_xlogfile_name_offset()

From
David Fetter
Date:
On Wed, Apr 07, 2010 at 06:12:52AM +0000, Heikki Linnakangas wrote:
> Log Message:
> -----------
> Forbid using pg_xlogfile_name() and pg_xlogfile_name_offset() during
> recovery. We might want to relax this in the future, but ThisTimeLineID
> isn't currently correct in backends during recovery, so the filename
> returned was wrong.

Is this Fujii Masao's patch?  If so, please make sure to mention this
in your commit messages :)

Cheers,
David.
>
> Modified Files:
> --------------
>     pgsql/doc/src/sgml:
>         func.sgml (r1.512 -> r1.513)
>         (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/func.sgml?r1=1.512&r2=1.513)
>     pgsql/src/backend/access/transam:
>         xlog.c (r1.389 -> r1.390)
>         (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/transam/xlog.c?r1=1.389&r2=1.390)
>
> --
> Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-committers

--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

Re: pgsql: Forbid using pg_xlogfile_name() and pg_xlogfile_name_offset()

From
Heikki Linnakangas
Date:
David Fetter wrote:
> On Wed, Apr 07, 2010 at 06:12:52AM +0000, Heikki Linnakangas wrote:
>> Log Message:
>> -----------
>> Forbid using pg_xlogfile_name() and pg_xlogfile_name_offset() during
>> recovery. We might want to relax this in the future, but ThisTimeLineID
>> isn't currently correct in backends during recovery, so the filename
>> returned was wrong.
>
> Is this Fujii Masao's patch?  If so, please make sure to mention this
> in your commit messages :)

Yes. Sorry.

--
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com