Re: pg_rewind WAL segments deletion pitfall

From: Alexander Kukushkin <cyberdemn(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Sutou Kouhei <kou(at)clear-code(dot)com>, smithpb2250(at)gmail(dot)com, torikoshia(at)oss(dot)nttdata(dot)com, horikyota(dot)ntt(at)gmail(dot)com, michael(at)paquier(dot)xyz, pgsql-hackers(at)postgresql(dot)org, bungina(at)gmail(dot)com, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: pg_rewind WAL segments deletion pitfall
Date: 2024-11-14 14:38:20
Message-ID: CAFh8B=kr3umY1c-jfUeG1LbdP__Rv4nb=6zpozxJQsmFXr07YQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Hi Alvaro,

The commit message looks good to me, except maybe using a "master" word,
which I would suggest to replace with "primary".

And a small nitpick:
+/*
+ * Initialize a hash table to store WAL file names that must be kept.
+ */
+void
+keepwal_init(void)
+{
+ /*
+ * This hash table is empty in the vast majority of cases, so set an
+ * initial size of 0.
+ */
+ keepwal = keepwal_create(0, NULL);
+}

I don't think that the hash table will be empty. It needs to hold all WAL
filenames starting from the last checkpoint and up to divergent point.
On loaded clusters it could be hundreds and thousands of files.

On Tue, 12 Nov 2024 at 20:18, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
wrote:

> Hello
>
> After reading the whole thread a couple of times to make sure I
> understood the problem correctly, I think the approach in the v10 patch
> is a reasonable one. I agree that it's better for maintainability to
> keep a separate hash table. I made some cosmetic adjustments -- didn't
> find any fault in the code. I also verified that the test is hitting
> the problematic case.
>
> So here's v11, which I'll try to get out tomorrow.
>
> I also assessed back-patching this. There's some conflicts, but nothing
> serious, back to 14. Unfortunately, 13 lacks requisite infrastructure,
> so I think it'll have to stay as it is. (12 is dead.)
>
> Can you please verify that my explanation in the commit message is
> sound?
>
> Thanks
>
> --
> Álvaro Herrera 48°01'N 7°57'E —
> https://www.EnterpriseDB.com/
> "Cada quien es cada cual y baja las escaleras como quiere" (JMSerrat)
>

Regards,
--
Alexander Kukushkin

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tomas Vondra 2024-11-14 14:48:36 Re: Sorting Discrepancy in PostgreSQL 14.13
Previous Message Aleksander Alekseev 2024-11-14 14:20:22 Re: Regression from postgresql14 to postgresql17 with postgis (osm2pgsql)

Browse pgsql-hackers by date

  From Date Subject
Next Message Ants Aasma 2024-11-14 15:23:48 Re: Potential ABI breakage in upcoming minor releases
Previous Message Noah Misch 2024-11-14 14:35:24 Re: Potential ABI breakage in upcoming minor releases