feat!: split acknowledge config into autoAck + keepaliveIntervalSeconds (v3.0.1)#176
Open
kibae wants to merge 2 commits into
Open
feat!: split acknowledge config into autoAck + keepaliveIntervalSeconds (v3.0.1)#176kibae wants to merge 2 commits into
kibae wants to merge 2 commits into
Conversation
…ds (v3.0.1)
The old `acknowledge: { auto, timeoutSeconds }` shape bundled two unrelated
concerns — automatic per-message ack vs. periodic keepalive — which caused
the slot to silently advance when `auto: false` was configured (#174).
Public API changes:
- Replace nested `acknowledge` with top-level `autoAck` and `keepaliveIntervalSeconds`
- Deprecated `acknowledge` key is still accepted for v3.x with a console.warn;
scheduled for removal in v4.0
Internal changes:
- Track received LSN and acknowledged LSN separately
- Keepalive timer now reports only the last acknowledged LSN as the flushed/applied
position, so the replication slot never advances past unacknowledged work
The fire-and-forget _acknowledge(lsn) call in the copyData handler and the async setInterval callback in checkStandbyStatus both leaked promise rejections, which can crash Node on unhandled rejection. Attach .catch() to each and surface failures via the existing 'error' event.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
acknowledge: { auto, timeoutSeconds }with top-levelautoAckandkeepaliveIntervalSeconds. The old shape bundled two independent concerns — auto-ack ondata messages vs. periodic keepalive — which caused the replication slot to silently
advance past unacknowledged work when
auto: falsewas set(#174).
reports only the last manually acknowledged LSN as the flushed/applied position, so
autoAck: falseusers can rely on the slot staying put.acknowledgekey is still accepted in v3.x with aconsole.warnand valuemapping; scheduled for removal in v4.0.
Migration
Prominent notice added at the top of
README.md; full details inCHANGELOG.md.Test plan
npx tsc --noEmitpassesjest config-normalize— 4/4 unit tests pass (defaults, new keys, deprecated shimwith warning, precedence when both supplied)
autoAck: false, keepaliveIntervalSeconds: 10keeps connectionalive without advancing
pg_replication_slots.confirmed_flush_lsnacknowledge: { auto, timeoutSeconds }still workswith warning
Closes #174