Skip to content
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

fix: Handle replication slot conflicts #1762

Merged
merged 33 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
5453e37
Use advisory lock to handle rolling deploys
msfstef Sep 26, 2024
a6dfec4
Configurable replication stream ID
msfstef Sep 26, 2024
7cf3f38
Quote all publication and replication slot names
msfstef Sep 26, 2024
3b0dba8
Implement utility for resetting the publication
msfstef Sep 26, 2024
a7ef1b5
Fix utils quoting test
msfstef Sep 26, 2024
09db776
Use hash of slot name for lock
msfstef Sep 26, 2024
20285c4
Fix integration test
msfstef Sep 26, 2024
51291ae
Add changeset
msfstef Sep 26, 2024
0acac52
Basic replication status work
msfstef Sep 26, 2024
4e34836
Remove connection manager as required opt
msfstef Sep 30, 2024
fbaa5a6
Use an independent connection lock
msfstef Sep 30, 2024
67dc96d
Add backoff retries
msfstef Sep 30, 2024
267d471
Check pool id as well for status
msfstef Sep 30, 2024
a1836a7
Fix integration test and lock restarting
msfstef Sep 30, 2024
b653044
Rename connection lock atom
msfstef Sep 30, 2024
3f47fbd
Fix health check endpoint to return correct messages
msfstef Sep 30, 2024
4e8e3e6
Add basic unit tests for health check endpoint
msfstef Sep 30, 2024
3bba4e2
Add integration test for rolling deploy
msfstef Sep 30, 2024
b203953
Fix weird formatting
msfstef Sep 30, 2024
a7e1897
Return 503 for stopping state
msfstef Sep 30, 2024
017ed32
Transform start link keyword argument
msfstef Sep 30, 2024
f2d6250
Mock lock connection under Postgres
msfstef Sep 30, 2024
934c35d
Add basic lock connection tests
msfstef Sep 30, 2024
4655e00
Add comments explaining seemingly unnecessary pattern matching
msfstef Sep 30, 2024
49d6620
Update changeset
msfstef Sep 30, 2024
3269786
Add basic integration test for health endoint
msfstef Sep 30, 2024
3ac6845
Add health check plug to integration testing for rolling deploys
msfstef Sep 30, 2024
50e95f0
Assert electric process exits
msfstef Oct 1, 2024
685bc4f
Log periodic messages while lock is not acquired
msfstef Oct 1, 2024
f22c669
Add crash recovery integration test
msfstef Oct 1, 2024
c024581
Replace positional matching on a keyword list with Keyword.pop()
alco Oct 1, 2024
b0d928b
Remove a noop "with" from ServiceStatus.check()
alco Oct 1, 2024
dc8c980
Adress PR comments
msfstef Oct 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Mock lock connection under Postgres
msfstef committed Sep 30, 2024
commit f2d6250803f12ee2c4dc5fd90b782a378bd5da2d
2 changes: 1 addition & 1 deletion packages/sync-service/lib/electric/connection_manager.ex
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ defmodule Electric.ConnectionManager do
end

def handle_continue(:start_lock_connection, state) do
case Electric.LockConnection.start_link(
case Electric.Postgres.LockConnection.start_link(
connection_opts: state.connection_opts,
connection_manager: self(),
lock_name: Keyword.fetch!(state.replication_opts, :slot_name)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule Electric.LockConnection do
defmodule Electric.Postgres.LockConnection do
@moduledoc """
A Postgres connection that ensures an advisory lock is held for its entire duration,
useful for ensuring only a single sync service instance can be using a single
Expand Down