@@ -46,6 +46,11 @@ defmodule Sequin.Runtime.SlotProcessorServer do
46
46
@ config_schema Application . compile_env ( :sequin , [ Sequin.Repo , :config_schema_prefix ] )
47
47
@ stream_schema Application . compile_env ( :sequin , [ Sequin.Repo , :stream_schema_prefix ] )
48
48
49
+ @ slots_ids_with_old_postgres [
50
+ "59d70fc1-e6a2-4c0e-9f4d-c5ced151cec1" ,
51
+ "dcfba45f-d503-4fef-bb11-9221b9efa70a"
52
+ ]
53
+
49
54
def max_accumulated_bytes do
50
55
Application . get_env ( :sequin , :slot_processor_max_accumulated_bytes ) || @ max_accumulated_bytes
51
56
end
@@ -265,7 +270,7 @@ defmodule Sequin.Runtime.SlotProcessorServer do
265
270
{ :ok , low_watermark_wal_cursor } = Sequin.Replication . low_watermark_wal_cursor ( state . id )
266
271
267
272
query =
268
- if state . id in [ "59d70fc1-e6a2-4c0e-9f4d-c5ced151cec1" , "dcfba45f-d503-4fef-bb11-9221b9efa70a" ] do
273
+ if state . id in @ slots_ids_with_old_postgres do
269
274
"START_REPLICATION SLOT #{ state . slot_name } LOGICAL 0/0 (proto_version '1', publication_names '#{ state . publication } ')"
270
275
else
271
276
"START_REPLICATION SLOT #{ state . slot_name } LOGICAL 0/0 (proto_version '1', publication_names '#{ state . publication } ', messages 'true')"
@@ -418,7 +423,7 @@ defmodule Sequin.Runtime.SlotProcessorServer do
418
423
def handle_data ( << ?k , _wal_end :: 64 , _clock :: 64 , 0 >> , % State { } = state ) do
419
424
# Because these are <14 Postgres databases, they will not receive heartbeat messages
420
425
# temporarily mark them as healthy if we receive a keepalive message
421
- if state . id in [ "59d70fc1-e6a2-4c0e-9f4d-c5ced151cec1" , "dcfba45f-d503-4fef-bb11-9221b9efa70a" ] do
426
+ if state . id in @ slots_ids_with_old_postgres do
422
427
Health . put_event (
423
428
state . replication_slot ,
424
429
% Health.Event { slug: :replication_heartbeat_received , status: :success }
@@ -563,7 +568,7 @@ defmodule Sequin.Runtime.SlotProcessorServer do
563
568
end
564
569
565
570
@ impl ReplicationConnection
566
- def handle_info ( :emit_heartbeat , % State { id: "dcfba45f-d503-4fef-bb11-9221b9efa70a" } = state ) do
571
+ def handle_info ( :emit_heartbeat , % State { id: id } = state ) when id in @ slots_ids_with_old_postgres do
567
572
execute_timed ( :handle_info_emit_heartbeat , fn ->
568
573
# Carve out for individual cloud customer who still needs to upgrade to Postgres 14+
569
574
# This heartbeat is not used for health, but rather to advance the slot even if tables are dormant.
@@ -624,6 +629,15 @@ defmodule Sequin.Runtime.SlotProcessorServer do
624
629
next_state = schedule_heartbeat_verification ( state )
625
630
626
631
cond do
632
+ # Carve out for individual cloud customer who still needs to upgrade to Postgres 14+
633
+ state . id in @ slots_ids_with_old_postgres ->
634
+ Health . put_event (
635
+ state . replication_slot ,
636
+ % Event { slug: :replication_heartbeat_verification , status: :success }
637
+ )
638
+
639
+ { :keep_state , next_state }
640
+
627
641
# No outstanding heartbeat but we have emitted one in the last 2m
628
642
# This is the most likely clause we hit because we usually receive the heartbeat message
629
643
# pretty quickly after emitting it
0 commit comments