Skip to content

Block DROP EXTENSION when logical slots have pending catalog changes#10016

Draft
zilder wants to merge 3 commits into
timescale:mainfrom
zilder:zilder/user-catalog-slot-guard
Draft

Block DROP EXTENSION when logical slots have pending catalog changes#10016
zilder wants to merge 3 commits into
timescale:mainfrom
zilder:zilder/user-catalog-slot-guard

Conversation

@zilder

@zilder zilder commented Jun 9, 2026

Copy link
Copy Markdown
Member

Since _timescaledb_catalog.hypertable and chunk were marked as user_catalog_tables, dropping the extension while a logical replication slot still has unconsumed WAL referencing these tables leaves the slot permanently broken: subsequent pg_logical_slot_get_changes() calls fail with "could not find pg_class entry for ...".

Add a guard in process_drop_start that refuses DROP EXTENSION timescaledb when any in-use logical slot's confirmed_flush_lsn is behind the latest modification to those tables.

zilder added 3 commits May 29, 2026 15:03
Since `_timescaledb_catalog.hypertable` and `chunk` were marked as
user_catalog_tables, dropping the extension while a logical replication
slot still has unconsumed WAL referencing these tables leaves the slot
permanently broken: subsequent `pg_logical_slot_get_changes()` calls
fail with "could not find pg_class entry for ...".

Add a guard in `process_drop_start` that refuses `DROP EXTENSION
timescaledb` when any in-use logical slot's `confirmed_flush_lsn` is
behind the latest modification to those tables.

@svenklemm svenklemm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be done in timescaledb extension we want extension updates to be quick and predictable so any required slot management needs to happen outside of the extension since they are not managed by timescaledb.

@zilder

zilder commented Jun 22, 2026

Copy link
Copy Markdown
Member Author

At very least we should provide a tool to verify the state of a slot against the catalog, would you agree?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants