Re: history file on replica and double switchover
Fujii Masao <masao.fujii@oss.nttdata.com>
From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: Anastasia Lubennikova <a.lubennikova@postgrespro.ru>,
Grigory Smolkin <g.smolkin@postgrespro.ru>,
Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2020-09-17T17:18:45Z
Lists: pgsql-hackers
Attachments
- history_replica_v2.patch (text/plain) patch v2
On 2020/09/04 13:53, Fujii Masao wrote: > > > On 2020/09/04 8:29, Anastasia Lubennikova wrote: >> On 27.08.2020 16:02, Grigory Smolkin wrote: >>> Hello! >>> >>> I`ve noticed, that when running switchover replica to master and back to replica, new history file is streamed to replica, but not archived, >>> which is not great, because it breaks PITR if archiving is running on replica. The fix looks trivial. >>> Bash script to reproduce the problem and patch are attached. >>> >> Thanks for the report. I agree that it looks like a bug. > > +1 > > + /* Mark history file as ready for archiving */ > + if (XLogArchiveMode != ARCHIVE_MODE_OFF) > + XLogArchiveNotify(fname); > > I agree that history file should be archived in the standby when > archive_mode=always. But why do we need to do when archive_mode=on? > I'm just concerned about the case where the primary and standby > have the shared archive area, and archive_mode is on. So I updated the patch so that walreceiver marks the streamed history file as ready for archiving only when archive_mode=always. Patch attached. Thought? Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION
Commits
-
Archive timeline history files in standby if archive_mode is set to "always".
- 40a8fb1e0f41 9.5.24 landed
- 7be02a3bf03a 9.6.20 landed
- 33441753820b 10.15 landed
- 462ff7966997 11.10 landed
- 4d342b9d4153 12.5 landed
- 059caf36c307 13.1 landed
- fd26f7823183 14.0 landed