joseluisll opened a new pull request, #9019:
URL: https://github.com/apache/hadoop/pull/9019
`TestFederationInterceptorREST#testReplaceLabelsOnNode` fails intermittently
in full-class runs with a randomly chosen subcluster (`subCluster#0`, `#1` or
`#2` instead of `#3`), while passing in isolation. Two defects in
`FederationInterceptorREST` combine:
1. `getNode(...)` fans out to the subclusters with a parallel stream and
collects into a plain `HashMap` via `forEach` — the consumer runs concurrently
on ForkJoinPool threads, and concurrent `HashMap.put` silently drops entries.
When the node owner's answer is dropped, nothing is logged; it is simply gone.
2. `getNodeSubcluster(...)` cannot distinguish "subcluster answered: node
not here" (null `NodeInfo`) from a real answer. With the owner's entry missing,
the loop returns an arbitrary subcluster that does not host the node instead of
throwing `NotFoundException`.
Changes:
- `getNode`: merge the parallel results on the calling thread (as
`invokeConcurrent` already does) and drop null answers at collection time —
this also removes a caught NPE + WARN that the public `getNode(String)` logged
for every subcluster that does not host the node.
- `getNodeSubcluster`: skip null responses and throw `NotFoundException`
when no subcluster hosts the node, so `replaceLabelsOnNode`,
`updateNodeResource` and `getActivities` fail with 404 semantics instead of
being forwarded to a non-owner subcluster.
- `replaceLabelsOnNode`: resolve the target subcluster once (it ran the node
lookup twice, and the two resolutions could disagree).
- New tests: `testGetNodeCollectsAllSubClusterAnswers` (36-subcluster
fan-out asserting no collected answer is ever lost) and NotFound tests for the
three node-scoped calls above.
`MockDefaultRequestInterceptorREST` is left untouched: its
`contains("test")` catch-all is load-bearing for other tests, and with the
collection race fixed the owner's answer can no longer disappear.
Testing: reproduced pre-fix on apache/trunk (full-class runs fail with a
random subcluster; an instrumented run showed the owner's entry missing from
the collected map, present again 1 ms later in an identical call); with the
patch, `TestFederationInterceptorREST` passes twice consecutively (Tests run:
81, Failures: 0); all 4 new tests fail on the unpatched code (Tests run: 4,
Failures: 4) and pass with it.
Found while verifying YARN-12025; the flake is pre-existing on trunk-side
code and unrelated to that patch.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]