docs: does insert/delete invalidate iterators?
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 68/100
- issue の種類
- ドキュメント
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- rust, typescript
調査の方向性
issueで挙げられているdatastoreのスキャンとイテレータのバッファリングのパスから始めてください: crates/core/src/host/instance_env.rs および crates/core/src/host/v8/syscall/common.rs。ドキュメントに記載されたイテレータの動作がこれらのパスとどう関係するかを確認し、該当するイテレータのドキュメントを更新して、選択肢A~Dのどれに当てはまるかを明記してください。完了の条件は、挿入や削除がアクティブなイテレータに影響するか、該当する場合は行がスナップショットかどうかをドキュメントで答えることです。
索引モデルが issue の本文から書いたものです。
説明
The question
The docs don't specify whether iterators are invalidated by insert and delete, leaving this code with questionable correctness:
for (const queuer of ctx.db.game_queue.public_game.filter(true)) {
if (logic(queuer)) {
ctx.db.game_queue.id.delete(queuer.id);
// Should we break here and filter again or is it safe to continue?
}
}
// Will this loop forever, or double the table size?
for (const _ of ctx.db.game_queue.iter()) {
ctx.db.game_queue.insert(createUniqueRow());
}
Current state
AI states that iterators hold full snapshots of the data, so the above exampeles are safe.
- crates/core/src/host/instance_env.rs:724,748,774: datastore_*_scan_bsatn_chunks calls ChunkedWriter::
collect_iter eagerly.
- crates/core/src/host/v8/syscall/common.rs:299,320: scan syscalls buffer chunks then env.iters.insert(chunks.
into_iter()).
▄
So the iterator is a snapshot taken at filter(true) creation; deleting the current game_queue row
mid-iteration cannot invalidate it.
Request
Specify in the docs one of the following:
A. Insert/delete iterator invalidation is undefined and may change in the future.
B. Insert/delete should be treated as if they invalidate iterators.
C. Insert/delete does not invalidate iterators, but the data of a iterator row may change during a reducer (iterators hold references).
D. Insert/delete does not invalidate iterators. Iterators contain a snapshot of rows.
- 主要言語
- Rust
- スター
- 25.3k
- フォーク
- 1.1k
- 平均マージ
- 4日 6時間
- マージ済み PR(30日)
- 43
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
clockworklabs/SpacetimeDB のほかの issue
-
TS SDK: `t.result()` is typed `Ok | Err`, but the runtime expects `{ ok } | { err }`対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
clockworklabs/SpacetimeDB#6127 ·
メンテナーはふだん 1 日以内に返信
-
TS SDK: `ctx.http.fetch` throws for status codes the `statuses` package doesn't know対応中かも @kshanxs が 2 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
clockworklabs/SpacetimeDB#6126 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
clockworklabs/SpacetimeDB#6124 ·
メンテナーはふだん 1 日以内に返信
-
TS SDK: `ctx.http.fetch` splits header values that contain commas対応中かも @kshanxs が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
clockworklabs/SpacetimeDB#6123 ·
メンテナーはふだん 1 日以内に返信
-
TS SDK: `Result` errors are serialized with the `ok` type (instance crash)対応中かも @Tyagiquamar が 2 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
clockworklabs/SpacetimeDB#6122 ·
メンテナーはふだん 1 日以内に返信
clockworklabs/SpacetimeDB の issue をすべて見る
似ている issue
-
Add Mimirオープン
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
slavakurilyak/awesome-ai-agents#759 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
compiler-explorer/compiler-explorer#9272 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 63/100
pop-os/cosmic-files#2117 ·
メンテナーはふだん 2 日以内に返信
-
L: java:gradle L: java:maven L: ruby:bundler T: bug 🐞
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
dependabot/dependabot-core#16547 ·
メンテナーはふだん 1 日以内に返信
-
bug status:ready-for-test
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
UniClipboard/UniClipboard#1985 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信