Re: history file on replica and double switchover

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: Anastasia Lubennikova <a(dot)lubennikova(at)postgrespro(dot)ru>, Grigory Smolkin <g(dot)smolkin(at)postgrespro(dot)ru>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: history file on replica and double switchover
Date: 2020-09-17 17:18:45
Message-ID: 2823800f-897e-0799-a89a-75aa43f44e5d@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
history_replica_v2.patch text/plain 537 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ranier Vilela 2020-09-17 18:13:44 Re: BUG #15858: could not stat file - over 4GB
Previous Message Ranier Vilela 2020-09-17 17:12:12 Planner, check if can use consider HASH for groupings (src/backend/optimizer/plan/planner.c)