From: Heikki Linnakangas <hlinnakangas@vmware.com>
To: Pg Bugs <pgsql-bugs@postgresql.org>
Subject: pg_receivexlog sometimes fails on first start
Date: Thu, 5 Feb 2015 23:17:46 +0200
Message-ID: <54D3DDFA.1030509@vmware.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
When starting pg_receivexlog for the first time, i.e. with an empty
directory, it sometimes fails like this:
pg_receivexlog: unexpected termination of replication stream: ERROR:
requested starting point 56/70000000 is ahead of the WAL flush position
of this server 56/6FFC4000
This is easier to reproduce if you have a steady stream of updates, with
no commits, running concurrently. A bulk load, for example.
The problem is that pg_receivexlog issues the IDENTIFY_SYSTEM command,
which returns the current WAL insert position. It then requests to start
streaming from that position. Or to be precise, from the beginning of
the WAL segment containing that position. That's wrong; the WAL might
not be flushed up to the insert position yet.
I think returning the insert position in IDENTIFY_SYSTEM is a bad idea.
We even mention in the documentation that that field is "useful to get a
known location in the transaction log where streaming can start", but
the insert position is wrong for that purpose.
Any objections to changing IDENTIFY_SYSTEM to return the flush position,
instead of insert position? We haven't heard any complaints from the
field about this, but IMHO that should also be back-patched. It's a
design bug, and the fix is simple and unlikely to cause any harm.
- Heikki
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: hlinnakangas@vmware.com
Subject: Re: pg_receivexlog sometimes fails on first start
In-Reply-To: <54D3DDFA.1030509@vmware.com>
References: <54D3DDFA.1030509@vmware.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox