effective_wal_level is not decreasing after using REPACK (CONCURRENTLY)
Imran Zaheer <imran.zhir@gmail.com>
From: Imran Zaheer <imran.zhir@gmail.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2026-05-21T16:32:36Z
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 051_effective_wal_level.pl on builds without injection points.
- 47ad2233fad4 19 (unreleased) landed
-
Disable logical decoding after REPACK (CONCURRENTLY)
- 2af1dc89282b 19 (unreleased) landed
Attachments
- v1-0001-Disable-logical-decoding-after-REPACK-CONCURRENTL.patch (text/x-patch) patch v1-0001
Hi The recent support for dynamic toggling of logical decoding (67c2097) disables logical decoding if no logical slots are present. But the repack command doesn't seem to coordinate with this toggling. The effective_wal_level is not decreasing after using repack concurrently. postgres=# show effective_wal_level; effective_wal_level --------------------- replica (1 row) postgres=# create table foo(a int primary key); CREATE TABLE postgres=# REPACK (CONCURRENTLY) foo; 2026-05-21 20:46:25.423 PKT [1591896] LOG: logical decoding is enabled upon creating a new logical replication slot 2026-05-21 20:46:25.634 PKT [1591896] LOG: logical decoding found consistent point at 0/018F36D0 2026-05-21 20:46:25.634 PKT [1591896] DETAIL: There are no running transactions. REPACK postgres=# select slot_name from pg_replication_slots; slot_name ----------- (0 rows) postgres=# show effective_wal_level; effective_wal_level --------------------- logical (1 row) The server has to be restarted in order to decrease the effective_wal_level. REPACK CONCURRENTLY uses a temporary slot that is dropped at the time of cleanup, but logical decoding is not disabled. This may be related to both commits, 28d534e and 67c2097 The attached patch adds the `RequestDisableLogicalDecoding` call to `repack_cleanup_logical_decoding` after the replication slot is dropped so the checkpointer will take care of it.. Thanks Imran Zaheer