perf(cache): derive worker node affinity during status construction to avoid duplicate read #6200
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.39) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 245 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.329
Real PR Conversation Timeline
1 comments
"Review active on #6200"
general
weight: 0.35
cheyang
Ⅰ. Describe what this PR does
Previously, each
CacheRuntimestatus update cycle read the workerAdvancedStatefulSettwice:1. In
manager.ConstructComponentStatus(...)to build worker replica status.2. Immediately after in
manager.GetNodeAffinity(...)to compute worker node affinity.This PR extends
ComponentManagerwithConstructComponentStatusAndAffinity(...)so that worker node affinity is derived directly from the single workload read that status construction already performs.This addresses #5879 by cutting the lookup count in half (from 2 down to 1 Get per status cycle) with:
nodeSelectorare immediately reflected instatus.CacheAffinityon the very next reconcile cycle (self-healing, without stale affinity reaching thenodeaffinitywithcachewebhook).Ⅱ. Does this pull request fix one issue?
fixes #5879
Ⅲ. List the added test cases (unit test/integration test) if any, please explain if no tests are needed.
pkg/ddc/cache/component/component_test.go:- Added test verifying
ConstructComponentStatusAndAffinityreturns both status and affinity forAdvancedStatefulSetManager.- Added test verifying
ConstructComponentStatusAndAffinityreturns both status and affinity forDaemonSetManager.pkg/ddc/cache/engine/status_test.go:- Added test verifying worker workload is read exactly once per status cycle (1 Get per cycle).
- Added test pinning zero staleness: out-of-band updates to the worker StatefulSet's
nodeSelectorimmediately updatestatus.CacheAffinityon the subsequent cycle.- Added test verifying error propagation when the worker component is not found.
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews
None