-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🗂️ SinkConsumerFlushedWalCursor #935
base: main
Are you sure you want to change the base?
Conversation
b97df28
to
1857743
Compare
1857743
to
c6cb18d
Compare
9fa7fb8
to
8fd0786
Compare
8fd0786
to
836565c
Compare
@@ -0,0 +1,49 @@ | |||
defmodule Sequin.Consumers.SinkConsumerHighWatermarkWalCursor do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change from flushed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DurableWalCursor
@@ -66,13 +67,14 @@ defmodule Sequin.ConsumersRuntime.ConsumerProducer do | |||
@impl GenStage | |||
def handle_info(:init, state) do | |||
consumer = Repo.lazy_preload(state.consumer, postgres_database: [:replication_slot]) | |||
{:ok, low_watermark} = Replication.find_watermark(consumer.replication_slot_id, :low) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's my durable wal cursor?
less_than_low_watermark = | ||
message.commit_lsn < state.low_watermark.commit_lsn or | ||
(message.commit_lsn == state.low_watermark.commit_lsn and message.commit_idx < state.low_watermark.commit_idx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
incorrect, because failed messages can have <
:ok | ||
|
||
high_watermark_wal_cursor -> | ||
{:ok, _} = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{:ok, cursor} =
@spec put_high_watermark_wal_cursor(State.t(), Replication.wal_cursor()) :: {:ok, State.t()} | ||
def put_high_watermark_wal_cursor(%State{} = state, wal_cursor) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
slot_high_watermark
slot_non_durable_cursor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
incoming_wal_cursor
# Force update from the database so we advance the low watermark for acknowledgement | ||
replication_slot = Repo.preload(state.replication_slot, [:low_watermark_wal_cursor], force: true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this under reply == 1
messages = | ||
if reply == 1 and not is_nil(state.last_commit_lsn) do | ||
if reply == 1 and not is_nil(replication_slot.low_watermark_wal_cursor) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if reply == 1 and not is_nil(replication_slot.low_watermark_wal_cursor) do | |
if reply == 1 do |
@@ -730,7 +752,13 @@ defmodule Sequin.DatabasesRuntime.SlotProcessor do | |||
send(state.test_pid, {__MODULE__, :heartbeat_received}) | |||
end | |||
|
|||
state | |||
if accumulated_messages?(state) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you always advance this?
6657098
to
459bc87
Compare
No description provided.