Skip to content

Commit

Permalink
drop publications on newly created replica
Browse files Browse the repository at this point in the history
  • Loading branch information
var77 committed Nov 25, 2024
1 parent 9ec830c commit 6eb7b11
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 0 additions & 2 deletions model/lantern/lantern_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,6 @@ def mark_switchover_finish
end

def create_logical_replica(resource_name: nil, lantern_version: nil, extras_version: nil, minor_version: nil, pg_upgrade: nil)
# TODO::
# 1. If new database will be created during logical replication it won't be added automatically
ubid = LanternResource.generate_ubid
create_ddl_log
create_publication("pub_#{ubid}")
Expand Down
2 changes: 2 additions & 0 deletions prog/lantern/lantern_server_nexus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ def before_run

if lantern_server.resource.logical_replication
lantern_server.resource.drop_ddl_log_trigger
# remove publications
lantern_server.resource.delete_publication("pub_#{lantern_server.resource.ubid}")

if !lantern_server.resource.parent.representative_server.domain.nil?
# prepare for fast switchover
Expand Down
4 changes: 4 additions & 0 deletions spec/prog/lantern/lantern_server_nexus_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,8 @@
expect(lantern_server.resource).to receive(:logical_replication).and_return(true)
expect(lantern_server.resource).to receive(:allow_timeline_access_to_bucket)
expect(lantern_server.resource).to receive(:drop_ddl_log_trigger)
expect(lantern_server.resource).to receive(:ubid).and_return("test").at_least(:once)
expect(lantern_server.resource).to receive(:delete_publication).with("pub_test")
expect(lantern_server).to receive(:run_query).and_return("f")
expect(lantern_server).to receive(:timeline_id=)
expect(lantern_server).to receive(:timeline_access=).with("push")
Expand All @@ -445,6 +447,8 @@
expect(lantern_server.resource).to receive(:logical_replication).and_return(true)
expect(lantern_server.resource).to receive(:allow_timeline_access_to_bucket)
expect(lantern_server.resource).to receive(:drop_ddl_log_trigger)
expect(lantern_server.resource).to receive(:ubid).and_return("test").at_least(:once)
expect(lantern_server.resource).to receive(:delete_publication).with("pub_test")
expect(lantern_server).to receive(:add_domain_to_stack).with(parent_reosurce.representative_server.domain, nx.strand)
expect(nx).to receive(:incr_setup_ssl)
expect(lantern_server).to receive(:run_query).and_return("f")
Expand Down

0 comments on commit 6eb7b11

Please sign in to comment.