Repository navigation
Description
Summary
performance.read_ahead is a 20-key configuration block that is documented, validated, shipped in
five example preset files — and read by nothing. internal/fuse/filesystem.go constructs its
read-ahead manager with a nil config, so every mount uses the manager's own built-in defaults
regardless of what the user wrote.
Same shape as #156, different subsystem: a setting accepted by every layer that reads
configuration and consulted by no layer that acts on it.
Evidence
internal/fuse/filesystem.go:164:
filesystem.readAhead = NewReadAheadManager(filesystem, nil)
filesystem.writeCoalescer = NewWriteCoalescer(filesystem, nil)NewReadAheadManager then substitutes hardcoded values (internal/fuse/optimizations.go:51-60):
if config == nil {
config = &ReadAheadConfig{
Enabled: true,
WindowSize: 64 * 1024, // 64KB
MaxDistance: 1024 * 1024, // 1MB
MinSequential: 3,
ConcurrentReads: 4,
TTL: 5 * time.Minute,
}
}Two separate ReadAheadConfig types exist and they are not the same struct:
internal/config.ReadAheadConfig |
internal/fuse.ReadAheadConfig |
|
|---|---|---|
| fields | 20 (size, strategy, sequential_threshold, prefetch_ahead, confidence_threshold, enable_ml_prediction, ml_model_path, pattern_depth, …) |
6 (Enabled, WindowSize, MaxDistance, MinSequential, ConcurrentReads, TTL) |
| read on the mount path | no | yes, but only its nil defaults |
There is no field-name overlap beyond Enabled, so this is not a plumbing omission that can be
fixed by passing the value through — the two designs disagree about what read-ahead is. The
config block describes a strategy selector with ML hooks; the implementation is a sequential-access
detector with a fixed window.
config.validateReadAheadConfig (internal/config/config.go:727) validates all 20 keys
thoroughly — rejecting an out-of-range sequential_threshold, requiring ml_model_path when
enable_ml_prediction is set — which makes the block look more load-bearing than it is. A user
whose file is rejected for an invalid learning_rate reasonably concludes the valid values do
something.
internal/cache.PredictiveConfig has a third overlapping set of these fields
(confidence_threshold, prefetch_ahead) and is likewise never constructed from
config.Configuration — grep 'PredictiveConfig{' finds only its own package defaults.
Shipped presets
examples/config/ ships five files that exist only to tune this block:
readahead-simple.yamlreadahead-predictive.yamlreadahead-streaming.yamlreadahead-ml.yamlreadahead-low-bandwidth.yaml
Nothing in the repository references them. All five have no effect on a mount. Worse,
readahead-predictive.yaml is value-for-value identical to config.NewDefault(), so even if the
block were wired it would be a no-op file — which is how it was found: the new
TestShippedConfigsSetWhatTheySay guard asserts a shipped config differs from the defaults, and
that one does not.
readahead-ml.yaml sets strategy: ml and points ml_model_path at
/var/lib/objectfs/models/access-prediction.bin. No model loader exists; enable_ml_prediction
reaches no code that reads a model file.
Proposed resolution
Not a straight plumbing job, and the decision comes before the code:
- Decide what read-ahead is. Either the 20-key strategy model is the intended design and
internal/fuse's 6-field detector is a placeholder to be replaced, or the detector is the real
thing and the config block should shrink to the knobs it actually has. Landing this inside
internal/vfsis the natural place — read-ahead is a VFS-layer policy, not a FUSE-binding one. - Delete
strategy: mland the ML keys unless a model loader is planned.enable_ml_prediction
with a validated-but-unused path is the same class of claim assecurity.encryption.at_rest
(audit finding P-7). - Reduce the presets to ones that differ from each other and from the defaults, once the block
is wired. A preset identical to the defaults should not ship. - Until then
examples/config.yamlmarks the whole blocknot yet wired, and the preset files
carry a header saying so, so the gap is disclosed rather than implied away.
Acceptance
- A single owner for read-ahead configuration; the duplicate
ReadAheadConfigtypes reconciled
or one deleted - A table test asserting the manager's effective settings against the loaded config — assert
output values, not the mapping expression - Every shipped preset differs from
NewDefault()and from the other presets -
TestShippedConfigsSetWhatTheySaypasses with no preset excused
Activity
fix: the cluster.redis block selects the cache a mount actually uses (#…
fix: cost_optimization keeps one key, and it reaches the object (#260)