Re-archive the WAL on standby with archive_mode=always?

From: Japin Li <japinli(at)hotmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re-archive the WAL on standby with archive_mode=always?
Date: 2025-07-21 05:38:11
Message-ID: ME0P300MB0445CFEF72BF6D2030769F6EB65DA@ME0P300MB0445.AUSP300.PROD.OUTLOOK.COM
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hi, hackers,

I was recently reviewing the KeepFileRestoredFromArchive() function and came
across a section that raised a question for me:

/*
* Create .done file forcibly to prevent the restored segment from being
* archived again later.
*/
if (XLogArchiveMode != ARCHIVE_MODE_ALWAYS)
XLogArchiveForceDone(xlogfname);
else
XLogArchiveNotify(xlogfname);

My understanding is that the WAL segment in this context has just been
restored from the archive.

However, for archive_mode=always, the code calls XLogArchiveNotify(xlogfname),
which, if I understand correctly, signals the archiver to re-archive this
already-archived WAL segment.

Is there a specific scenario or benefit I'm overlooking?

--
Regards,
Japin Li

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2025-07-21 05:45:33 Re: Logical Replication of sequences
Previous Message Amit Kapila 2025-07-21 05:34:15 Re: Document slot's restart_lsn can go backward