Capacity Scheduler View: tolerant node label response parsing - #4150
Capacity Scheduler View: tolerant node label response parsing#4150sanrajbandre wants to merge 1 commit into
Conversation
getNodeLabels assumed the ResourceManager node-label response was always a
JSON string and chose the response shape from the stack version. That check
(stackVersion >= 2.5) is unreliable: Number('3.2.0') is NaN, so 3-part
versions silently fell through to the legacy branch.
Extract normalization into QueueAdapter#parseNodeLabels, which:
- parses only when the response is a string; accepts an already-parsed object
- unwraps an optional nodeLabelsInfo wrapper
- supports nodeLabelInfo (array or single object) and legacy nodeLabels
- coerces exclusivity to a Boolean (true / "true" -> true)
- derives the shape from the payload, not the stack version
isNodeLabelsConfiguredByRM semantics are unchanged. Adds unit tests covering
wrapper, JSON string, array, single-object, legacy, boolean/string
exclusivity, malformed JSON, and empty responses.
|
https://apache-ambari.com/dist/ambari/3.0.0/rocky9/ 这个不能下载了,有没有其他地址 |
|
Gentle follow-up on this one. It's a small, source-only fix (+162/-42, two files) @JiaLiangC would you have a moment to review, or point me to the right reviewer? |
@sanrajbandre Jira account approved. Thanks for your contribution. |
Problem
QueueAdapter#getNodeLabels(contrib/views/capacity-scheduler UI) assumes theResourceManager node-label response is always a JSON string and selects the
response shape from the stack version.
stackVersion >= 2.5is unreliablebecause
Number("3.2.0")isNaN, so 3-part versions silently take the legacybranch and mis-parse labels. It also does not tolerate a
nodeLabelsInfowrapper, a single
nodeLabelInfoobject, a legacynodeLabelsobject entry, orstring
exclusivity.Fix
Extract normalization into
QueueAdapter#parseNodeLabels:nodeLabelsInfowrappernodeLabelInfo(array or single object) and legacynodeLabelsexclusivityto a Boolean (true/"true"->true)isNodeLabelsConfiguredByRMsemantics are unchanged.Tests
Adds
test/unit/adapters/adapters_test.jscovering wrapper, JSON string, array,single-object, legacy string/object, boolean/string exclusivity, malformed JSON,
and empty-response cases.
JIRA
AMBARI-XXXXX — account approval pending; I'll update the title and this link once the key is assigned.