fix(nodemeta): preserve admin-configured MaxMvmNum across cubelet restarts#348
fix(nodemeta): preserve admin-configured MaxMvmNum across cubelet restarts#348chenggui53 wants to merge 1 commit into
Conversation
|
Claude finished @chenggui53's task in 49s —— View job Code Review: fix(nodemeta): preserve admin-configured MaxMvmNum across cubelet restartsOverviewThis PR addresses a real problem: when a cubelet restarts and re-registers with the scheduler, Changed files:
The FixThe logic in
The TestsFour test cases in
Potential Concerns1. Tests test inline logic rather than
2. No negative MaxMvmNum test 3. Minute race window between VerdictThe fix is minimal, well-scoped, and correct. The core logic properly distinguishes "admin has set a value" from "cubelet is sending its default" and preserves the former. The code is clean and the comment at line 133 explains the "why" clearly. Ship it with the minor test coverage improvement noted above. |
…tarts When a cubelet registers with the scheduler, RegisterNode unconditionally overwrites MaxMvmNum from the request. This means any admin-configured limit (set directly in the database) is lost when the cubelet restarts, because the cubelet calculates its own value from available memory. The fix preserves the existing MaxMvmNum when the incoming request doesn't specify one (<=0), allowing scheduler-side limits to survive cubelet restarts. Extract the decision logic into a standalone resolveMaxMvmNum helper so it can be unit-tested directly without duplicating the condition inline. Add table-driven tests covering zero, negative, positive, nil-existing, and zero-existing edge cases. Signed-off-by: chenggui53 <chenggui53@gmail.com>
67fa4ed to
d60a9a0
Compare
|
Claude finished @chenggui53's task in 1m 0s —— View job Code Review: Updated PR (synchronize event)Task Checklist
Previous Review Feedback — Status
Updated ReviewThe PR has been updated and all previous review feedback has been addressed: 1. The 2. The test file (service_maxmvm_test.go) now has:
All test cases call 3. Integration with VerdictThis PR is clean and complete. All review suggestions have been addressed. The fix is minimal, the test coverage is thorough, and the |
|
Claude finished @chenggui53's task in 1m 26s —— View job Review: fix(nodemeta): preserve admin-configured MaxMvmNum across cubelet restarts
Previous Review Feedback — Status
All previous review feedback has been addressed. The nodemeta logic is solid. Nodemeta Changes — Verified CorrectThe core fix in effectiveMaxMvmNum := resolveMaxMvmNum(global.getNode(req.NodeID), req.MaxMvmNum)The
The result ( Tests ( Build Changes — New Since Last ReviewTwo additional files changed (separate from the core fix): 1.
2.
Observationsa) b) Redundant c) VerdictThe nodemeta fix is minimal, well-scoped, correct, and thoroughly tested. The build changes are reasonable — just note the forced image rebuild point ( |
200c437 to
d60a9a0
Compare
|
Claude finished @chenggui53's task in 3m 32s —— View job Review: fix(nodemeta): preserve admin-configured MaxMvmNum across cubelet restarts
Previous Review Feedback — Status
All prior review feedback has been addressed. The The Fix — What It Doesfunc resolveMaxMvmNum(existing *NodeSnapshot, reqMaxMvmNum int64) int64 {
if existing != nil && existing.MaxMvmNum > 0 && reqMaxMvmNum <= 0 {
return existing.MaxMvmNum
}
return reqMaxMvmNum
}When Tests — 5 table-driven cases
Thorough. Code and tests are clean, well-structured, and match the stated implementation. Concern: Fix doesn't match the described problemThe PR description says:
The fix preserves
The cubelet always sends Concrete scenario where this breaks:
The Options to address thisA. Extend the condition to always preserve a positive existing value (simplest): func resolveMaxMvmNum(existing *NodeSnapshot, reqMaxMvmNum int64) int64 {
if existing != nil && existing.MaxMvmNum > 0 {
return existing.MaxMvmNum
}
return reqMaxMvmNum
}This is a behavioral change: the cubelet's auto-calculated value would never overwrite an admin-set limit. If the cubelet legitimately needs to increase or decrease the limit (e.g., memory changes), it would require admin action or a workflow where the cubelet first clears the existing limit. B. Keep the fix as-is, but update the cubelet to send
C. Correct and narrow the PR description to accurately describe the guard as "defensive — preserve existing MaxMvmNum when the request doesn't specify one" rather than "fix cubelet restart overwrite." Minor:
|
|
Thanks for the PR! I have a question about the usage scenario. How do you currently set the cubelet's If you're setting it via direct DB edits, we should also consider whether a proper API/UI for this configuration would be a better long-term approach. |
When a cubelet registers with the scheduler, RegisterNode unconditionally overwrites MaxMvmNum from the request. This means any admin-configured limit (set directly in the database) is lost when the cubelet restarts, because the cubelet calculates its own value from available memory.
The fix preserves the existing MaxMvmNum when the incoming request doesn't specify one (<=0), allowing scheduler-side limits to survive cubelet restarts.