Re: pg_rewind with cascade standby doesn't work well

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Kuwamura Masaki <kuwamura(at)db(dot)is(dot)i(dot)nagoya-u(dot)ac(dot)jp>
Cc: Aleksander Alekseev <aleksander(at)timescale(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: pg_rewind with cascade standby doesn't work well
Date: 2023-09-20 03:04:26
Message-ID: ZQphOjq8hAm-8X7w@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Sep 20, 2023 at 11:46:45AM +0900, Kuwamura Masaki wrote:
> I also found a bug (maybe). If we call `CreateRestartPoint()` during
> crash-recovery, the assertion fails at ComputeXidHorizon() in procarray.c.
> It's inherently orthogonal to the problem I already reported. So you can
> reproduce this at HEAD with this procedure.
>
> 1. Start primary and standby server
> 2. Modify checkpoint_timeout to 1h on standby
> 3. Insert 10^10 records and concurrently run CHECKPOINT every second on
> primary
> 4. Do an immediate stop on both standby and primary at the end of the insert
> 5. Modify checkpoint_timeout to 30 on standby
> 6. Remove standby.signal on standby
> 7. Restart standby (it will start crash-recovery)
> 8. Assertion failure is raised shortly
>
> I think this is because `TruncateSUBTRANS();` in `CreateRestartPoint()` is
> called but `StartupSUBTRANS()` isn't called yet. In `StartupXLOG()`, we
> call
> `StartupSUBTRANS()` if `(ArchiveRecoveryRequested && EnableHotStandby)`.
> However, in `CreateRestartPoint()`, we call `TruncateSUBTRANS()` if
> `(EnableHotStandby)`. I guess the difference causes this bug. The latter
> possibly be called even crash-recovery while former isn't.
> The attached patch 0002 fixes it. I think we could discuss about this bug
> in
> another thread if needed.

This is a known issue. I guess that the same as this thread and this
CF entry:
https://commitfest.postgresql.org/44/4244/
https://www.postgresql.org/message-id/flat/ZArVOMifjzE7f8W7(at)paquier(dot)xyz
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2023-09-20 03:07:23 Re: remaining sql/json patches
Previous Message Laurenz Albe 2023-09-20 03:02:42 Re: Disabling Heap-Only Tuples