File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
lib/sequin/runtime/slot_producer Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -547,6 +547,10 @@ defmodule Sequin.Runtime.SlotProducer do
547
547
raise "New restart cursor is behind new restart cursor: #{ inspect ( restart_wal_cursor ) } < #{ inspect ( state . restart_wal_cursor ) } "
548
548
end
549
549
550
+ if is_nil ( restart_wal_cursor ) or is_nil ( restart_wal_cursor . commit_lsn ) or is_nil ( restart_wal_cursor . commit_idx ) do
551
+ raise "[SlotProducer] restart_wal_cursor is empty"
552
+ end
553
+
550
554
Replication . put_restart_wal_cursor! ( state . id , restart_wal_cursor )
551
555
552
556
% { state | restart_wal_cursor: restart_wal_cursor }
@@ -638,7 +642,7 @@ defmodule Sequin.Runtime.SlotProducer do
638
642
case Replication . restart_wal_cursor ( state . id ) do
639
643
{ :error , % NotFoundError { } } ->
640
644
case Protocol . handle_simple ( query , [ ] , protocol ) do
641
- { :ok , [ % Postgrex.Result { rows: [ [ lsn ] ] } ] , protocol } ->
645
+ { :ok , [ % Postgrex.Result { rows: [ [ lsn ] ] } ] , protocol } when not is_nil ( lsn ) ->
642
646
cursor = % { commit_lsn: Postgres . lsn_to_int ( lsn ) , commit_idx: 0 }
643
647
{ :ok , % { state | restart_wal_cursor: cursor } , protocol }
644
648
You can’t perform that action at this time.
0 commit comments