From 878a66d99aac8acc9a2cfd7d9976ffbeed60ee75 Mon Sep 17 00:00:00 2001 From: Varik Matevosyan Date: Sat, 29 Jun 2024 01:09:17 +0400 Subject: [PATCH] pass immediately_reserve as true when creating physical replication slot --- model/lantern/lantern_resource.rb | 2 +- spec/model/lantern/lantern_resource_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/model/lantern/lantern_resource.rb b/model/lantern/lantern_resource.rb index 9439a28cb..3cca21879 100644 --- a/model/lantern/lantern_resource.rb +++ b/model/lantern/lantern_resource.rb @@ -97,7 +97,7 @@ def create_logical_replication_slot(name) end def create_physical_replication_slot(name) - representative_server.run_query("SELECT lsn FROM pg_create_physical_replication_slot('#{name}');").chomp.strip + representative_server.run_query("SELECT lsn FROM pg_create_physical_replication_slot('#{name}', true);").chomp.strip end def delete_replication_slot(name) diff --git a/spec/model/lantern/lantern_resource_spec.rb b/spec/model/lantern/lantern_resource_spec.rb index 59ca2a53a..72b5c4e5b 100644 --- a/spec/model/lantern/lantern_resource_spec.rb +++ b/spec/model/lantern/lantern_resource_spec.rb @@ -180,7 +180,7 @@ it "creates new physical replication slot" do representative_server = instance_double(LanternServer) expect(lantern_resource).to receive(:representative_server).and_return(representative_server).at_least(:once) - expect(lantern_resource.representative_server).to receive(:run_query).with("SELECT lsn FROM pg_create_physical_replication_slot('test');").and_return("0/6002748 \n") + expect(lantern_resource.representative_server).to receive(:run_query).with("SELECT lsn FROM pg_create_physical_replication_slot('test', true);").and_return("0/6002748 \n") expect(lantern_resource.create_physical_replication_slot("test")).to eq("0/6002748") end end