posting: rollup commits parent and split KVs in separate transactions, leaving crash windows
メンテナーはふだん 10 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 55/100
調査の方向性
Start with posting/writer.go and trace List.Rollup writes through the callers in posting/mvcc.go and posting/index.go. Check how TxnWriter.Write uses Badger transactions and how finite readTs rollups preserve distinct timestamps. Done means retained and new split parts are committed at newMinTs, while the parent and removed split tombstones are committed together at parentVersion, with historical reads preserved.
索引モデルが issue の本文から書いたものです。
説明
Summary
List.Rollup returns the parent posting list plus its split parts as separate KVs, and TxnWriter.Write (posting/writer.go) commits each KV in its own Badger transaction. A crash between those commits can leave on-disk state that the parent doesn't agree with. This has been the case since multi-part posting lists landed (#3105). It isn't new.
Crash windows
The KVs are sorted by key, so the parent (DefaultPrefix) is written before any split key (ByteSplit). Badger replays a strict prefix after a crash, so the parent can survive without the KVs that follow it.
- Parent written, new split part not written. The parent at
newMinTs+1references a part with a newstartUidthat has no version yet.readListPartdoes atxn.Getat the parent's version, gets key-not-found, and reads of that list fail. This is the more serious case. - Parent written, removed-split tombstones not written. With #9825, rollup writes
BitEmptyPostingtombstones for splits the parent no longer references. If the crash lands before those commit, the old split payload stays the latest value for its key. The new parent doesn't list it, so no later rollup will rediscover it and the space leaks indefinitely (same outcome as #9824, but only on a crash).
Proposed fix
Group the rollup's writes by version instead of committing per KV:
- Write retained/new split parts at
newMinTsfirst. They're invisible to readers still resolving the old parent, so this is safe on its own. - Then commit the parent and all removed-split tombstones in a single transaction at
parentVersion(they already share that version).
Keep the distinct timestamps for finite readTs rollups. Collapsing everything to one version would break historical reads at newMinTs.
This needs a TxnWriter API (or a rollup-specific writer) that can commit several KVs in one CommitAt, plus updating the callers in posting/mvcc.go and posting/index.go.
References
- #9825 (CodeRabbit raised the tombstone case in review)
- #9824
- 主要言語
- Go
- スター
- 21.8k
- フォーク
- 1.6k
- 平均マージ
- 11日 7時間
- マージ済み PR(30日)
- 5
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
dgraph-io/dgraph のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
メンテナーはふだん 10 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 76/100
メンテナーはふだん 10 日以内に返信
-
Stale
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
dgraph-io/dgraph#9811 · コメント 1 件 ·
メンテナーはふだん 10 日以内に返信
-
Stale
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
dgraph-io/dgraph#9810 · コメント 1 件 ·
メンテナーはふだん 10 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 10 日以内に返信
dgraph-io/dgraph の issue をすべて見る
似ている issue
-
enhancement
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
DaoCloud/DaoCloud-docs#7839 ·
メンテナーはふだん 1 日以内に返信
-
Type: Enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
projectdiscovery/urlfinder#167 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
peterstace/simplefeatures#726 ·
-
area: import bug go good first issue priority: low
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
fukubie/StockLlama#69 ·
-
enhancement help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
cloverworks-hq/rumpty-cli#95 ·
メンテナーはふだん 1 日以内に返信