Repository navigation
PostgreSQLの並行配送・SQL・履歴保持を改善 - #1
Merged
Merged
Conversation
送信を共有ロックへ変更し、受信と初回再生のSQLを改善する。任意の保持期限と負荷に応じた掃除を追加し、世代付きACKで古い受領情報による誤削除を防ぐ。競合・キャンセル・移行・IPCの回帰試験とコンテナの耐久測定を整備する。
本文参照のchannelをInitPlanで受け取り、UUIDとの主キー探索を安定させる。統計の偏りを再現する実行計画検証を追加し、PostgreSQL 16/17/18のCIで走査件数の回帰を検出する。
aida0710
marked this pull request as ready for review
September 27, 2026 08:11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
同じchannelの送信が排他ロックで直列になり、履歴や古い統計によって受信・再生が遅くなるため、送信を共有ロックへ変更し、本文の主キー参照と期間索引を使うSQLへ改善します。登録との排他とREAD COMMITTEDを明示し、待機中に登録したノードへの配送を維持します。
保持期限は既定で無効です。channel内の全登録ノードが有効にした場合だけ、最長の保持・再生期間を過ぎたACK済みフレームを削除します。未ACKは維持し、SQL予算を超えたときは削除件数を半減します。受領情報に配送の世代を含め、削除前の古いACKが新しい同一UUIDの配送を消さないようにしました。既存DBには更新版schema.sqlの再適用が必要です。
検証:
速度はPostgreSQL 17.11の4CPU/2GiBコンテナ、loopback/TLSなし、fsync/synchronous_commit=onで測った3ノード合計です。本体パイプライン・IPC・NICの帯域は含みません。保持期間は最低保持時間で、容量上限ではありません。DB再起動後の自動復旧とOS隔離は追加していません。v0.2.0の版・更新手順とタグのCI公開ジョブを追加しました。公開前にバイナリ・manifest・SQLと全配布物のSHA256を照合し、公開済み版は上書きしません。公開手順の回帰試験6件も成功しています。