Skip to content

Commit b97f4ce

Browse files
accoRTLS
andcommitted
If we receive an keepalive reply=1 with no last_commit_lsn, fallback to low watermark wal cursor
Co-authored-by: Carter Pedersen <carter.e.pedersen@gmail.com>
1 parent fafb027 commit b97f4ce

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/sequin/databases_runtime/slot_processor.ex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,8 +384,9 @@ defmodule Sequin.DatabasesRuntime.SlotProcessor do
384384
reply == 1 ->
385385
# If we don't have a last_commit_lsn, we're still processing the first xaction
386386
# we received on boot. This can happen if we're processing a very large xaction.
387-
# It is therefore safe to send an ack with the current_xaction_lsn
388-
ack_message(state.current_xaction_lsn)
387+
# It is therefore safe to send an ack with the last LSN we processed.
388+
{:ok, low_watermark} = Replication.low_watermark_wal_cursor(state.id)
389+
ack_message(low_watermark.commit_lsn)
389390

390391
true ->
391392
[]

0 commit comments

Comments
 (0)