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.

--
Grigory Smolkin
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

diff --git a/src/backend/replication/walreceiver.c b/src/backend/replication/walreceiver.c
index 7c11e1ab44..63a3d0c1e6 100644
--- a/src/backend/replication/walreceiver.c
+++ b/src/backend/replication/walreceiver.c
@@ -761,6 +761,10 @@ WalRcvFetchTimeLineHistoryFiles(TimeLineID first, TimeLineID last)
                         */
                        writeTimeLineHistoryFile(tli, content, len);
 
+                       /* Mark history file as ready for archiving */
+                       if (XLogArchiveMode != ARCHIVE_MODE_OFF)
+                               XLogArchiveNotify(fname);
+
                        pfree(fname);
                        pfree(content);
                }

Attachment: double_switchover.sh
Description: application/shellscript

Reply via email to