Feature request: lock the data directory so a second PGlite in another process fails fast instead of corrupting it
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 52/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- node.js, postgresql, typescript
- 領域
- database
調査の方向性
new PGlite(dataDir) が使用する Node filesystem VFS パスから始め、open、close、process-exit のライフサイクルを追跡します。2 プロセスのケースを再現し、live lock がそのプロセスを識別し、stale lock が引き継がれ、data directory を破損させずに lock が解放されることを確認します。
索引モデルが issue の本文から書いたものです。
説明
New feature requestPostgres refuses to start on a data directory another postmaster holds (postmaster.pid). PGlite on the Node filesystem VFS takes no such lock, so two processes opening the same dataDir both succeed, both write, and the directory ends up unreadable. The next open then dies with RuntimeError: Aborted() (the symptom in #884) or a checkpoint panic (#327), with nothing pointing at the cause.
The two openers in our case were ordinary: a dev server running with --hot, and a script that imported the same database module. A rm -rf of the data directory under a running server ends the same way.
Describe the solution you'd like
new PGlite(dataDir) on the Node filesystem writes a lock file in the directory holding its process id, and a second open throws when that process is alive, naming it. A stale file (process gone) is taken over. Released on close and on process exit. Same idea as postmaster.pid, scoped to what PGlite can know in one process.
Describe alternatives you've considered
- We wrote this lock in the application (pid file beside the directory,
process.kill(pid, 0)for liveness). It works, but every PGlite user with more than one process hits the same corruption and rediscovers it fromAborted(). - A documentation note. It does not stop the second open.
Additional context
The lock request in #85 is for the IndexedDB VFS. This one is the Node filesystem VFS, where the second opener is another OS process.
- 主要言語
- TypeScript
- スター
- 16.3k
- フォーク
- 474
- 平均マージ
- 23時間 53分
- マージ済み PR(30日)
- 53
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
electric-sql/pglite のほかの issue
-
Feature request: Nitro 3 support (`unwasm` export condition)再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
electric-sql/pglite#1120 · コメント 16 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
electric-sql/pglite#1200 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 54/100
electric-sql/pglite#1192 ·
メンテナーはふだん 1 日以内に返信
-
[BUG]: syncToFs() resolves immediately, without syncing, when another sync is already queued対応中かも @PrabalParihar が 11 日前に担当しました。 オープンbug
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
electric-sql/pglite#1191 ·
メンテナーはふだん 1 日以内に返信
-
Feature request: live: allow pausing the notify triggers during bulk writes (e.g. pglite-sync applies) and refresh once on resume対応中かも @tdrz が 13 日前に担当しました。 オープンenhancement
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
electric-sql/pglite#1184 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
electric-sql/pglite の issue をすべて見る
似ている issue
-
Out of order / duplicate key error shows the key bytes as decimal or UTF-8, not hex対応中かも @bardrop が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
-
`/leaderboard`, the page and the share image say "be the first" for a program that hasn't startedオープンbug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
codercops/discord-bot#152 ·
メンテナーはふだん 1 日以内に返信
-
bug i18n
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
endora-commerce/endora-commerce#1315 ·
メンテナーはふだん 1 日以内に返信
-
area:data-quality importer size:S
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
enorm-labs/event-junkie#5136 ·
メンテナーはふだん 1 日以内に返信
-
fix(scripts): set-device-owner.ps1 fails to parse on Windows PowerShell 5.1 (UTF-8 without BOM)オープン
難易度 1/5 1時間未満 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信