joseluisll opened a new pull request, #8839: URL: https://github.com/apache/hadoop/pull/8839
### Description of PR JIRA: https://issues.apache.org/jira/browse/YARN-12031 `FederationInterceptorREST#getSchedulerConfiguration` fans out through `DefaultRequestInterceptorREST#getSchedulerConfiguration`. That forwards with `genericForward(..., Response.class, ...)` and returns the Jersey client's inbound `Response` unread. Its `getEntity()` is the raw entity stream (`HttpUrlConnector$2`), never a `ConfInfo`: - A sub-cluster that answers 200 (a mutable-conf CapacityScheduler) throws `ClassCastException` at `(ConfInfo) response.getEntity()`. The catch-all turns that into `400 getSchedulerConfiguration error.` for the whole federation. - A sub-cluster that answers 400 contributes `String.valueOf(stream)`, such as `org.glassfish.jersey.client.internal.HttpUrlConnector$2@74b97416`, to `errorMsgs` instead of the RM's message. Changes: - Read both entities with `response.readEntity(...)`, which also closes the response. - `MockDefaultRequestInterceptorREST#getSchedulerConfiguration` returned an outbound `Response.entity(ConfInfo)`, whose `getEntity()` is the `ConfInfo`. That is why `TestFederationInterceptorREST#testGetSchedulerConfiguration` passed. It now returns a response that, like a forwarded one, can only be read with `readEntity`. This is independent of YARN-12025: `clone(hsr)` pins the fan-out's `Accept` header to XML, so the Router never has to read JSON on this path. ### How was this patch tested? On Ubuntu 24.04 (WSL2), OpenJDK 17, Maven 3.9.16, `hadoop-yarn-server-router`: - `mvn test -Dtest='TestFederationInterceptorREST*,TestRouterWebServices' -Dsurefire.rerunFailingTestsCount=0 -Dmaven.test.failure.ignore=false`: 102 tests run, 0 failures, 0 errors. - With only the mock change, `TestFederationInterceptorREST#testGetSchedulerConfiguration` fails with `expected: <200> but was: <400>`. - Against a real federation (ZooKeeper, two MiniYARNCluster RMs, one with a mutable-conf store, and the Router, each in its own JVM), using the repro test attached to the JIRA: - Before: `GET /ws/v1/cluster/scheduler-conf` on the Router returns 400 `getSchedulerConfiguration error.` for both XML and JSON. - After: 200, with SC-1's configuration and SC-2's real error message, for both XML and JSON. - `PUT scheduler-conf` behaves the same before and after. - Checkstyle: no violations on the changed files. ### For code changes: - [x] Does the title of this PR start with the corresponding JIRA issue id (e.g. 'HADOOP-17799. Your PR title ...')? - [ ] Object storage: Have the integration tests been executed and the endpoint declared according to the connector-specific documentation? (Not applicable: no object storage changes.) - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? (Not applicable: no new dependencies.) - [ ] If applicable, have you updated the `LICENSE`, `LICENSE-binary`, `NOTICE-binary` files? (Not applicable.) ### AI Tooling If an AI tool was used: - [x] The PR includes the phrase "Contains content generated by <tool>" where <tool> is the name of the AI tool used. - [x] My use of AI contributions follows the ASF legal policy https://www.apache.org/legal/generative-tooling.html Contains content generated by Claude Code. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
