Commit 0cdf9d7
authored
Treat chain_modes=None as tracking every chain to fix validator TTL (linera-io#6167)
## Motivation
PR linera-io#5991 fixed an inverted TTL assignment in `create_chain_worker`,
swapping the branches so tracked chains use the long `config.ttl` and
sender chains use the short `config.sender_chain_ttl`. Correct for
clients (PM workers, wallets) where `chain_modes=Some(...)`
distinguishes tracked from sender chains.
Validators construct WorkerState with `chain_modes=None`
(linera-service/src/server.rs:113) and have no tracked-vs-sender
distinction. With `chain_modes=None`, `is_tracked` is always false, so
post-linera-io#5991 every chain on a validator routes through
`config.sender_chain_ttl`. The validator binary has no
`--sender-chain-worker-ttl-ms` CLI flag, so `sender_chain_ttl` stays at
the `ChainWorkerConfig::default()` value of `None`.
Result: `spawn_keep_alive` is never called for any chain worker on a
validator. The `Arc<ChainWorker>` drops the moment the in-flight request
finishes, taking the per-chain `LruCachingStore` with it. Every
subsequent request reloads chain state from Scylla.
Empirical from testnet_conway V4 (running the post-linera-io#5991 no-actor code)
vs V1-V3 (still running pre-fix actor.rs on testnet_conway_debug, where
`is_tracked=false` correctly routes to `config.ttl=30s`):
- `read_value` LRU cache hit rate: V4 2.66% vs V1-V3 75%
- `find_keys_by_prefix` cache hit rate: V4 1.81% vs V1-V3 48%
- `read_multi_value` rate to Scylla: V4 ~691/s vs V1-V3 ~75/s (9.2x)
- p99 Scylla read latency: V4 42ms vs V1-V3 19-22ms; 30x worse stddev
## Proposal
Treat `chain_modes=None` as "tracking every chain this node serves" —
the validator natural semantic, since validators have no
tracked-vs-sender split. For clients, behavior is unchanged:
`chain_modes=Some(map)` still computes `is_tracked` from map membership
and Full listening mode.
One-line change: `chain_modes.as_ref().is_some_and(...)` becomes
`is_none_or`. Inner `ListeningMode::is_full` check preserved unchanged.
Restores the actor-model property (validators routed through
`config.ttl`) without re-inverting the branches that linera-io#5991 correctly
fixed for clients.
## Test Plan
CI
## Release Plan
- These changes should be backported to the latest testnet branch.
## Links
- linera-io#5991, linera-io#5992, linera-io#6000 (the inversion fix this complements for
validators)
- linera-io#6160 (companion helm change adding `--chain-worker-ttl-ms` to
validator chart)1 parent 73d02dc commit 0cdf9d7
1 file changed
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1044 | 1044 | | |
1045 | 1045 | | |
1046 | 1046 | | |
1047 | | - | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
1048 | 1051 | | |
1049 | 1052 | | |
1050 | 1053 | | |
| |||
0 commit comments