RE: POC: enable logical decoding when wal_level = 'replica' without a server restart
Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com>
From: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
To: 'Masahiko Sawada' <sawada.mshk@gmail.com>
Cc: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2025-02-03T11:40:13Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix regression test failure when wal_level is set to minimal.
- 0de5f0d869d1 19 (unreleased) landed
-
Toggle logical decoding dynamically based on logical slot presence.
- 67c20979ce72 19 (unreleased) landed
-
Disallow server start with sync_replication_slots = on and wal_level < logical.
- 12da45742cfd 19 (unreleased) cited
Attachments
- add_check_hook.patch (application/octet-stream) patch
Dear Sawada-san, > I'm concerned that users could be confused if two different names > refer to substantially the same thing. > > Having said that, I guess that we need to drastically change the > messages. For example, I think that the wal_level worker should say > something like "successfully made 'logical' wal_level effective" > instead of saying something like "changed wal_level value". Also, > users might not need gradual messages when increasing 'minimal' to > 'logical' or decreasing 'logical' to 'minimal'. +1 for something like "successfully made 'logical' wal_level effective", and removing gradual messages. > > 6. > > With the patch present, the wal_level can be changed to the minimal even when > the > > streaming replication is going. If we do that, the walsender exits immediately > and > > the below FATAL appears periodically until the standby stops. Same things can > be > > said for the logical replication: > > > > ``` > > FATAL: streaming replication receiver "walreceiver" could not connect to the > primary server: > > connection to server on socket "/tmp/.s.PGSQL.oooo" failed: > > FATAL: WAL senders require "wal_level" to be "replica" or "logical > > ``` > > > > I know this is not a perfect, but can we avoid the issue by reject the GUC update > > if the walsender exists? Another approach is not to update the value when > replication > > slots need to be invalidated. > > Does it mean that we reject the config file from being reloaded in > that case? I have no idea how to reject it in a case where the > wal_level in postgresql.conf changed and the user did 'pg_ctl reload'. I imagined like attached. When I modified wal_level to minimal and send SIGHUP, postmaster reported below lines and failed to update wal_level. ``` LOG: received SIGHUP, reloading configuration files LOG: wal_level cannot be set to "minimal" while walsender exists LOG: configuration file "...postgresql.conf" contains errors; unaffected changes were applied ``` Best regards, Hayato Kuroda FUJITSU LIMITED