From: Christopher Pereira <kripper@imatronix.cl>
To: pgsql-general@postgresql.org
Subject: Prevent pg_rewind destroying the data
Date: Sun, 20 Dec 2020 16:11:25 -0300
Message-ID: <f4fb86c6-b219-5cad-5dc3-c9c1a720fdb2@imatronix.cl> (raw)
Hi,
When pg_rewind is interrupted due to network errors, the cluster gets
corrupted:
Running pg_rewind for a second time returns "pg_rewind: fatal: target
server must be shut down cleanly".
Trying to fix the cluster with "/usr/pgsql-12/bin/postmaster' --single
-F -D '/var/lib/pgsql/12/mydb' -c archive_mode=on -c
archive_command=false" throws:
LOG: could not read from log segment 0000003B000000000000003E,
offset 0: read 0 of 8192
LOG: invalid primary checkpoint record
PANIC: could not locate a valid checkpoint record
When a cluster failsover because of a network problem, chances are high
that another network problem may occur while we run pg_rewind.
It would be nice if pg_rewind wouldn't destroy the data and leave the
cluster in a state where retrying pg_rewind can succeed.
As a workaround we are thinking in taking a LVM snapshot or do a "cp
--reflink" before running pg_rewind and restore if there is a failure,
but it would be nice if pg_rewind were "non destructive".
Is this possible?
Am I missing something?
We are using PG 12.
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: kripper@imatronix.cl
Subject: Re: Prevent pg_rewind destroying the data
In-Reply-To: <f4fb86c6-b219-5cad-5dc3-c9c1a720fdb2@imatronix.cl>
References: <f4fb86c6-b219-5cad-5dc3-c9c1a720fdb2@imatronix.cl>
* 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