Re: pgsql: Change how first WAL segment on new timeline after promotion is - Mailing list pgsql-committers

From Andres Freund
Subject Re: pgsql: Change how first WAL segment on new timeline after promotion is
Date
Msg-id 20150103185957.GB15316@alap3.anarazel.de
Whole thread Raw
In response to pgsql: Change how first WAL segment on new timeline after promotion is  (Heikki Linnakangas <heikki.linnakangas@iki.fi>)
List pgsql-committers
Hi Heikki,

While writing a test script for
http://archives.postgresql.org/message-id/20141205002854.GE21964%40awork2.anarazel.de
I noticed that this commit broke starting a pg_basebackup -X * without a
recovery.conf present. Which might not be the best idea, but imo is a
perfectly valid thing to do.

To me the changes to StartupXLOG() in that commit look a bit bogus. The
new startLogSegNo is initialized to XLByteToSeg(EndOfLog)? Which points
to the end of the record +1? Which thus isn't guaranteed to exist as a
segment (e.g. never if the last record was a XLOG_SWITCH).  Did you
perhaps intend to use XLogFileInit(use_existing = true) instead of
XLogFileOpen()? That works for me.

I've attached my preliminary testscript (note it's really not that
interesting at this point) that reliably reproduces the problem for me.

Greetings,

Andres Freund

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

Attachment

pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Treat negative values of recovery_min_apply_delay as having no e
Next
From: Andres Freund
Date:
Subject: pgsql: Add pg_string_endswith as the start of a string helper library i