Capacity Scheduler View: tolerant node label response parsing#4150
Open
sanrajbandre wants to merge 1 commit into
Open
Capacity Scheduler View: tolerant node label response parsing#4150sanrajbandre wants to merge 1 commit into
sanrajbandre 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/ 这个不能下载了,有没有其他地址 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.