Repository navigation
Conversation
This comment has been minimized.
This comment has been minimized.
Owner
Author
|
End-to-end on the railgun soak fleet (3 workers, 16 slots each,
Four passes clean on the final row, no scheduler timeouts, only the three first-touch "no such index" lines at startup. |
`RedisStore::search_by_index_prefix` created its search index over the schema's bare key prefix (`aa_`, `fc_`, …) and named it the same way, ignoring the store's own `key_prefix`. Every key the store writes carries that prefix, so with `key_prefix: "sched:"` the index covered nothing: `FT.INFO` reported `num_docs 0` beside thirteen `sched:aa_…` hashes, the matcher's `FT.AGGREGATE` found no queued action, and a Redis-backed scheduler queued everything and dispatched nothing. A `bazel build //...` sat at `(17 actions, 0 running)` until killed (railgun soak, 2026-10-22). The index's `PREFIX` is now `<key_prefix><schema prefix>`, and its name sits under the store's prefix too, so two stores with different prefixes on one Redis cannot share an index whose `PREFIX` only one of them wrote. With an empty `key_prefix` both are unchanged, byte for byte. The test drives the create path on a prefixed mock store: the first `FT.AGGREGATE` answers "No such index", and the `FT.CREATE` that follows must name the prefixed index and cover `sched:test:`. Without the fix it fails on the unprefixed `FT.CREATE`. Co-Authored-By: Claude Fable 5.1 <[email protected]>
The store publishes a key-change notice with the key as Redis holds it, behind `key_prefix`; `RedisSubscriptionManager` keeps subscriptions under the bare store key and looked the notice up as published. With a prefix the two never met, so no notice woke anyone and every state change waited for the subscriber's own timeout re-read. On the soak fleet that was the same `bazel build //...` taking 385–443 s on a prefixed scheduler store against 150–197 s without the prefix, on one binary. The manager now strips its store's prefix off a notice before the lookup, and drops a notice from outside the prefix, which is another store's on a shared channel. With an empty prefix nothing changes. The test subscribes a bare key on a manager with `key_prefix: "sched:"`, consumes the subscription's initial change, publishes the prefixed key and expects the wake within five seconds. Without the fix it times out. Co-Authored-By: Claude Fable 5.1 <[email protected]>
b7r6
force-pushed
the
fix/redis-index-prefix-honours-key-prefix
branch
from
October 22, 2026 20:36
1f5d6e2 to
59fd922
Compare
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.
What and why
RedisStore::search_by_index_prefixcreated its search index over the schema's bare key prefix (aa_,fc_, …) and named it the same way, ignoring the store's ownkey_prefix. Every key the store writes carries that prefix, so withkey_prefix: "sched:"the index covered nothing:FT.INFOreportednum_docs 0beside thirteensched:aa_…hashes, the matcher'sFT.AGGREGATEfound no queued action, and a Redis-backed scheduler queued everything and dispatched nothing. Abazel build //...sat at(17 actions, 0 running)until killed.The index's
PREFIXis now<key_prefix><schema prefix>, and its name sits under the store's prefix too, so two stores with different prefixes on one Redis cannot share an index whosePREFIXonly one of them wrote. With an emptykey_prefixboth are unchanged, byte for byte.Second commit, same root. The store publishes a key-change notice with the key as Redis holds it, behind the prefix, while
RedisSubscriptionManagerkeeps subscriptions under the bare store key. With a prefix no notice ever woke a subscriber, so every state change waited for the subscriber's own timeout re-read: the same build took 385–443 s on a prefixed scheduler store against 150–197 s without, on one binary. The manager now strips its store's prefix off a notice before the lookup and ignores notices from outside it.How was this verified?
test_search_by_index_covers_the_store_key_prefixdrives the create path on a prefixed mock store: the firstFT.AGGREGATEanswers "No such index", and theFT.CREATEthat follows must name the prefixed index and coversched:test:. Red without the fix (unprefixedFT.CREATE), green with it.a_notice_behind_the_store_prefix_wakes_the_bare_key_subscriber: subscribes a bare key on a manager withkey_prefix: "sched:", publishes the prefixed key, expects the wake. Times out without the fix, passes with it.cargo test -p nativelink-store --test redis_store_test: 70 passed.cargo test -p nativelink-scheduler --test store_awaited_action_db_test: 14 passed.cargo clippy -p nativelink-store --testsclean.experimental_backend.redis,key_prefix: "sched:"): the scheduler wedged on the first build. The same fleet with nokey_prefixruns the build clean, which is what every upstream example and test does, so the bug only shows when a prefix is set.Risk
Low. The default (empty prefix) produces identical commands. A deployment that already runs a prefixed Redis scheduler store cannot exist in a working state, since it never dispatched; after this change its index is created fresh under the prefixed name.
AI assistance
Written with Claude Code (Claude Fable 5.1); the author reproduced the wedge on a soak fleet, reviewed the fix and the test, and ran the verification above.
🤖 Generated with Claude Code