effective_wal_level is not decreasing after using REPACK (CONCURRENTLY)

From: Imran Zaheer <imran(dot)zhir(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: effective_wal_level is not decreasing after using REPACK (CONCURRENTLY)
Date: 2026-05-21 16:32:36
Message-ID: CA+UBfaktds57dw2M8BEv_kS-=ixph3w+3MxKixtaDQMi_k7Ybg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
v1-0001-Disable-logical-decoding-after-REPACK-CONCURRENTL.patch text/x-patch 2.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Álvaro Herrera 2026-05-21 17:17:58 Re: Pg upgrade bug with NOT NULL NOT VALID
Previous Message Junwang Zhao 2026-05-21 15:18:54 Re: Rename Postgres 19 to Postgres 26 (year-based)?