pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: magodo <wztdyl@sina.com>
To: pgsql-general@postgresql.org
Subject: how to know current xlog location on standby after primary is down
Date: Sun, 09 Sep 2018 22:29:08 +0800
Message-ID: <4ffcd9e665cde2a7aaaaf55a3bc85145345e485c.camel@sina.com> (raw)


Hello, 

I'm working on a high availability project for PG(v9.6).

Suppose I have a priamry-standby setup, I need to do promote once
primary is down, but only when standby is as new as primary (before it
is down). Therefore, I need a way to know the wal replay location on
standby.

I tried to set a hot standby, but it failed to run
`pg_current_xlog_location()` on it; I also tried `pg_xlogdump` on
standby, but it has following cavets:

- hard to identify latest used wal segment, since there are some
renamed reservations
- sometimes `pg_xlogdump` will raise errors like: "pg_xlogdump:
FATAL:  error in WAL record at 0/9F88F0F8: record with incorrect prev-
link 2020/20202020 at 0/9F88F130"

So I want to know what is the correct way to do it. Thank you in
advance!






view thread (2+ messages)  latest in thread

Message-ID: <4ffcd9e665cde2a7aaaaf55a3bc85145345e485c.camel@sina.com>
Permalink:  ../4ffcd9e665cde2a7aaaaf55a3bc85145345e485c.camel@sina.com/
Also on:    postgresql.org/message-id/4ffcd9e665cde2a7aaaaf55a3bc85145345e485c.camel@sina.com

 · 

reply

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-general@postgresql.org
  Cc: wztdyl@sina.com
  Subject: Re: how to know current xlog location on standby after primary is down
  In-Reply-To: <4ffcd9e665cde2a7aaaaf55a3bc85145345e485c.camel@sina.com>
  References: <4ffcd9e665cde2a7aaaaf55a3bc85145345e485c.camel@sina.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