Re: pgsql: Change how first WAL segment on new timeline after promotion is

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
Cc: pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: Change how first WAL segment on new timeline after promotion is
Date: 2015-01-03 18:59:57
Message-ID: 20150103185957.GB15316@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

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 Content-Type Size
basebackup_test.sh application/x-sh 1.5 KB

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2015-01-03 20:40:52 pgsql: Prevent WAL files created by pg_basebackup -x/X from being archi
Previous Message Tom Lane 2015-01-03 18:14:20 pgsql: Treat negative values of recovery_min_apply_delay as having no e

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2015-01-03 19:36:50 Re: Small doc patch about pg_service.conf
Previous Message David Fetter 2015-01-03 18:03:32 Re: Small doc patch about pg_service.conf