Configuring a different replication slot in dev and test.
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
Bắt đầu bằng cách lần theo thiết lập sao chép tích hợp của Phoenix.Sync và cách nó suy ra hoặc cấu hình replication slot electric_slot_default cho các cơ sở dữ liệu tasks_dev và tasks_test. Tái hiện lỗi với các cơ sở dữ liệu development và test riêng biệt, sau đó xác nhận rằng cấu hình được chọn cho phép mỗi cơ sở dữ liệu sử dụng một slot hợp lệ riêng mà không làm hỏng quá trình khởi động hiện có ở embedded-mode.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I have a Phoenix app with Phoenix.Sync configured in embedded mode.
config :phoenix_sync,
mode: :embedded,
repo: Tasks.Repo
The Repo is configured to connect to a local (system) Postgres. I.e.: I'm running the same Postgres database process for dev and test, configured to use the tasks_dev and tasks_test database name respectively.
As part of my development workflow, I've run the app manually in dev, e.g.:
➜ tasks git:(main) ✗ iex -S mix
Erlang/OTP 27 [erts-15.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]
[info] Loading 158 CA(s) from :otp store
[info] Starting Electric replication stream using Elixir.Tasks.Repo configuration
[info] Setting electric instance_id: f5de52eb-536e-4d84-b760-7388d08c293a
[debug] The single StackSupervisor is initializing...
[info] Acquiring lock from postgres with name electric_slot_default
[info] Lock acquired from postgres with name electric_slot_default
[debug] Starting replication client for stack electric-embedded
Interactive Elixir (1.18.1) - press Ctrl+C to exit (type h() ENTER for help)
[debug] ReplicationClient step: pg_info_query
[info] Postgres server version = 170004, system identifier = 7465390237532881212, timeline_id = 1
[debug] ReplicationClient step: create_publication_query
[debug] ReplicationClient step: create_slot
[debug] Created new slot at lsn=0/18A95E78
[debug] ReplicationClient step: set_display_setting
[debug] ReplicationClient step: set_display_setting
[debug] ReplicationClient step: set_display_setting
[debug] ReplicationClient step: set_display_setting
[debug] ReplicationClient step: set_display_setting
[info] Connected to Postgres 7465390237532881212 and timeline 1
[info] Starting shape replication pipeline
[debug] Starting Elixir.Electric.Shapes.DynamicConsumerSupervisor
[debug] SchemaReconciler started
[info] Starting replication from postgres
[debug] ReplicationClient step: start_streaming
[debug] ReplicationClient step: start_replication_slot
[debug] Primary Keepalive: wal_end=413752952 (0/18A95E78) reply=0
[debug] Primary Keepalive: wal_end=413752952 (0/18A95E78) reply=0
I.e.: works fine, the tasks_dev database has a replication slot called electric_slot_default.
Now, when I then run the tests, I get this error logged:
22:59:52.561 [error] :gen_statem {:"Elixir.Electric.ProcessRegistry:electric-embedded", {Electric.Postgres.ReplicationClient, nil}} terminating
** (Postgrex.Error) ERROR 55000 (object_not_in_prerequisite_state) replication slot "electric_slot_default" was not created in this database
(stdlib 6.2) gen_statem.erl:3864: :gen_statem.loop_state_callback_result/11
(stdlib 6.2) proc_lib.erl:329: :proc_lib.init_p_do_apply/3
Process Label: {:replication_client, "electric-embedded"}
Queue: [info: :start_streaming]
Postponed: []
22:59:52.582 [error] Electric.DBConnection unknown error: %Postgrex.Error{message: nil, postgres: %{code: :object_not_in_prerequisite_state, line: "530", message: "replication slot \"electric_slot_default\" was not created in this database", file: "logical.c", unknown: "ERROR", severity: "ERROR", routine: "CreateDecodingContext", pg_code: "55000"}, connection_id: 86741, query: nil}
And this warning:
22:59:52.582 [warning] Database connection in replication mode failed: %Postgrex.Error{message: nil, postgres: %{code: :object_not_in_prerequisite_state, line: "530", message: "replication slot \"electric_slot_default\" was not created in this database", file: "logical.c", unknown: "ERROR", severity: "ERROR", routine: "CreateDecodingContext", pg_code: "55000"}, connection_id: 86741, query: nil} (PG code: 55000, PG routine: CreateDecodingContext)
Retrying...
22:59:52.582 [warning] Reconnecting in 2000ms
This is because the tasks_test database can't create a slot with the same name because it already exists in the tasks_dev database.
What's the best solution here? Do we want to use the mix env in the slot name? Or should the slot name be configured?
- Ngôn ngữ chính
- Elixir
- Star
- 290
- Fork
- 18
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của electric-sql/phoenix_sync
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 52/100
electric-sql/phoenix_sync#128 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
electric-sql/phoenix_sync#126 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
electric-sql/phoenix_sync#119 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
electric-sql/phoenix_sync#118 · 8 reaction ·
-
0.6.0 -> 0.6.1: protocol Phoenix.Sync.Adapter.PlugApi not implemented for Electric.Shapes.ApiĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
electric-sql/phoenix_sync#117 · 5 bình luận ·
Tất cả issue của electric-sql/phoenix_sync
Issue tương tự
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
taskforcesh/bullmq#4905 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 63/100
intellij-elixir/intellij-elixir#4387 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
elixir-lang/elixir#15975 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
@electric-sql/client throws SecurityError on import when the browser blocks site storage (typeof localStorage outside try)Có thể đã có người làm @mohanedmoh đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
electric-sql/electric#4826 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày