Configuring a different replication slot in dev and test.
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
調査の方向性
まず、Phoenix.Sync の埋め込みレプリケーション設定と、tasks_dev および tasks_test データベース向けのレプリケーションスロット electric_slot_default をどのように導出または設定しているかを追跡します。開発用データベースとテスト用データベースを分けて障害を再現し、そのうえで、選択した設定によって各データベースが異なる有効なスロットを使用でき、既存の埋め込みモードでの起動を壊さないことを確認します。
索引モデルが issue の本文から書いたものです。
説明
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?
- 主要言語
- Elixir
- スター
- 290
- フォーク
- 17
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトの環境構築ファイルはまだ確認していません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
electric-sql/phoenix_sync のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 52/100
electric-sql/phoenix_sync#128 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
electric-sql/phoenix_sync#126 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
electric-sql/phoenix_sync#119 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
electric-sql/phoenix_sync#118 · リアクション 8 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
electric-sql/phoenix_sync#117 · コメント 5 件 ·
electric-sql/phoenix_sync の issue をすべて見る
似ている issue
-
TS2502 in shipped .d.ts: `compileHighlightConfig` parameter shadows the de-aliased `Query` typeオープンbug javascript
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
L: javascript T: bug 🐞
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
dependabot/dependabot-core#16397 ·
メンテナーはふだん 1 日以内に返信
-
Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
wintermeyer/vutuv#2297 ·
メンテナーはふだん 1 日以内に返信
-
high priority tachyon protocol
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
beyond-all-reason/teiserver#1616 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
erlef/mix_sbom#157 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 7 日以内に返信