Repository navigation
perf(gateway): read Character state through maintained indexes - #712
Merged
Merged
Conversation
This was referenced Oct 16, 2026
Mathih13
force-pushed
the
perf/simulation-candidates
branch
from
October 16, 2026 06:21
64abed4 to
9d24f1c
Compare
Mathih13
force-pushed
the
perf/gateway-read-indexes
branch
from
October 16, 2026 06:21
4b93fe1 to
4149e71
Compare
Contributor
Author
|
Merged after adversarial review and repairs. Added real Coordinator tests for subscription population, owner changes, deletion, duplicate membership rows, Store reads during SDK callbacks, and fresh indexes after reconnect. All nine checks passed at Comment review passed. No real-client or capacity measurement is claimed. |
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.
Inventory, skill, quest and armor reads copy whole SDK tables before selecting one Character's rows. Loot projections repeat membership scans for each viewer.
Maintain connection-owned indexes for inventory, skills, quest state, loot entitlement, target auras and enchantments. Materialize matching rows through primary keys. Protect cache publication and index callbacks with one snapshot lock, and rebuild indexes on reconnect. SDK callbacks queue the guarded projections so they do not acquire the read lock on the pump thread.
Part 3 of 6. Follows #711. Merged in stack order. Next: #713.
Verification
CI now tests real SDK subscriptions, owner changes, duplicate-row deletion, a Store read paused across SDK callbacks, and fresh indexes after reconnect.
Two independent adversarial review rounds are complete. No actionable finding remains. The reviewed stack passed offline binding generation, formatting, workspace Clippy with all targets and features, and the Gateway unit and integration test targets. The Gateway binary passed 2,148 tests. Local builds used one job; no local SpacetimeDB instance or load test ran.
All nine checks passed at
4149e715: Module durable tests and Gateway bindings, Runtime Scripts, Rust.Comment review passed for the final changed source, tests, scripts and configuration. Retained protocol and ordering contracts match the code.
Verification limits
The snapshot lock keeps index selection and keyed materialization consistent; it does not make an entire multi-read projection atomic. No memory or capacity measurements were run. No capacity gain is claimed.
Risk
The indexes must match the SDK cache generation. The publication lock must remain outside synchronous SDK callbacks. The tests cover ownership changes, deletion, duplicate membership rows and fresh index generations.
Models: GPT-6 Astra and GPT-6.1 Sol. Harness: Codex in T3 Code.