pg_rewind succeed but postgresql showing error when trying to make standby with common ancestor

From: niraj nandane <niraj(dot)nandane(at)gmail(dot)com>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: pg_rewind succeed but postgresql showing error when trying to make standby with common ancestor
Date: 2022-12-15 09:33:28
Message-ID: CALpWO+CBOp3HtZM9mxfYhYCv3UCz9gLRjhtUdo__EOqNWfjx9w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Have 3 node setup: node1(50.2), node2(50.3) and node3(50.4). node1(50.2) is
primary and node2(50.3) and node3(50.4) are standby. I promoted node3 first
and then node2 to make them independent. When i try to make the node3 slave
of node2, using pg_rewind, it says below:

pg_rewind: connected to server
pg_rewind: source and target cluster are on the same timeline
pg_rewind: no rewind required

After this, when i start postgresql on the node3 in standby mode, i get
below:

Dec 15 07:57:33 fsrstandby.for.com postmaster[15411]: 2022-12-15
07:57:33 UTCLOG: entering standby modeDec 15 07:57:33
fsrstandby.for.com postmaster[15411]: 2022-12-15 07:57:33 UTCLOG:
consistent recovery state reached at 0/2F164268Dec 15 07:57:33
fsrstandby.for.com postmaster[15411]: 2022-12-15 07:57:33 UTCLOG:
invalid record length at 0/2F164268: wanted 24, got 0Dec 15 07:57:33
fsrstandby.for.com postmaster[15410]: 2022-12-15 07:57:33 UTCLOG:
database system is ready to accept read-only connectionsDec 15
07:57:33 fsrstandby.for.com systemd[1]: Started PostgreSQL 14 database
server.Dec 15 07:57:33 fsrstandby.for.com postmaster[15415]:
2022-12-15 07:57:33 UTCLOG: started streaming WAL from primary at
0/2F000000 on timeline 2Dec 15 07:57:33 fsrstandby.for.com
postmaster[15415]: 2022-12-15 07:57:33 UTCFATAL: could not receive
data from WAL stream: ERROR: requested WAL segment
00000002000000000000002F has already been removedDec 15 07:57:33
fsrstandby.for.com postmaster[15418]: 2022-12-15 07:57:33 UTCLOG:
started streaming WAL from primary at 0/2F000000 on timeline 2Dec 15
07:57:33 fsrstandby.for.com postmaster[15418]: 2022-12-15 07:57:33
UTCFATAL: could not receive data from WAL stream: ERROR: requested
WAL segment 00000002000000000000002F has already been removedDec 15
07:57:38 fsrstandby.for.com postmaster[15465]: 2022-12-15 07:57:38
UTCLOG: started streaming WAL from primary at 0/2F000000 on timeline
2Dec 15 07:57:38 fsrstandby.for.com postmaster[15465]: 2022-12-15
07:57:38 UTCFATAL: could not receive data from WAL stream: ERROR:
requested WAL segment 00000002000000000000002F has already been
removedDec 15 07:57:43 fsrstandby.for.com postmaster[16087]:
2022-12-15 07:57:43 UTCLOG: started streaming WAL from primary at
0/2F000000 on timeline 2

There is no WAL archiving set. This is PostgreSQL 14.4. Does this means
PostgreSQL pg_rewind can't be used when forming cluster between two
independent primary having common ancestor?

Note: If i just promote node2 and run pg_rewind on node3 to join with
node2, then it works correctly.

You can find more details here
https://dba.stackexchange.com/questions/320997/pg-rewind-succeed-but-postgresql-showing-error-when-trying-to-make-standby-with?noredirect=1#comment626002_320997
--

Thanks,
Niraj Nandane

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Etsuro Fujita 2022-12-15 12:33:31 Re: BUG #17713: Assert with postgres_fdw in v12
Previous Message David Rowley 2022-12-15 05:45:34 Re: BUG #17721: A completely unused CTE negatively affect Query Plan