Use ReadOnly transaction when managing replication slots. #548
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Postgres 16 introduced the ability to create logical replication slots directly on read only standby instances. Unfortunately, a read/write transaction cannot be started on a read only standby instance. This change introduces the ability to create a read only transaction and ensures that all operations involving logical replication slots use said transaction type.
This change is backwards compatible with older versions of Postgres and will work on both primary and standby instances.
This change does alter the error users receive on versions older than 16 when attempting to manage a logical replication slot on a read only standby instance. Today, all resources supported by this provider trigger the following error when attempting to create them on a read only standby:
After this change, this continues to be the case for all resources except replication slots, which will instead show the following error for Postgres versions < 16: