RE: POC: enable logical decoding when wal_level = 'replica' without a server restart

From: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
To: 'Masahiko Sawada' <sawada(dot)mshk(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: shveta malik <shveta(dot)malik(at)gmail(dot)com>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>, Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: RE: POC: enable logical decoding when wal_level = 'replica' without a server restart
Date: 2025-10-27 06:49:38
Message-ID: OSCPR01MB14966AF835B6EFD9862A1672DF5FCA@OSCPR01MB14966.jpnprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear Sawada-san,

> > Why can't we avoid counting invalid slots? I think this needs more
> > comments. BTW, shouldn't this patch consider changing
> > effective_wal_level when the last logical slot is invalidated?
> > Ideally, when logical decoding is not possible in the system, then we
> > can reduce the wal_level back to replica, no?
>
> Hmm, good point. I've considered this idea before but I didn't
> implement it probably because it makes the code more complex. But
> thinking of this idare carefully, it doesn't seem too complex. I've
> implemented this part as a separate patch to make reviews easy. I'll
> merge them if it looks good.

I confirmed and 0002 looks basically good. One minor comment:

```
# Drop the invalidated slot, decreasing effective_wal_level to 'replica'.
$standby4->safe_psql('postgres',
qq[select pg_drop_replication_slot('standby4_slot')]);
wait_for_logical_decoding_disabled($standby4);
test_wal_level($standby4, "replica|replica",
"effective_wal_level doesn't change after dropping the last invalidated slot"
);
```

Not sure the part is needed. Previous test has already ensured that
effective_wal_level would be replica. It might be trivial that dropping the slot
would keep the state.

Best regards,
Hayato Kuroda
FUJITSU LIMITED

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2025-10-27 07:24:29 Re: Batching in executor
Previous Message vignesh C 2025-10-27 06:48:53 Re: Logical Replication of sequences