joseluisll opened a new pull request, #8841:
URL: https://github.com/apache/hadoop/pull/8841
### Description of PR
`ApplicationHistoryServer#configure` registers both `JettisonFeature` and
`YarnJacksonJaxbJsonProvider`. Only `TimelineEntitiesWriter` and
`TimelineEntityWriter` are registered as dedicated writers; the
`config.packages("org.apache.hadoop.yarn.api.records.writer")` scan that looks
meant to pick up the others names a package that does not exist. Everything
else is written by whichever generic provider Jersey picks at startup, so the
same request answers in a different shape from one start to the next:
| Response | Jackson | Jettison |
|---|---|---|
| `POST /ws/v1/timeline`, no errors | `{"errors":[]}` | `{"response":""}` |
| `GET .../apps` | `{"app":[...]}` | `{"apps":{"app":[...]}}` |
| `GET .../apps/{appid}` | `{"appId":...}` | `{"app":{"appId":...}}` |
| `GET .../containers/{id}/logs` | `[{...}]` |
`{"containerLogsInfoes":{"containerLogsInfo":...}}` |
The put row was observed on a live server; the other Jettison bodies are the
shapes the old `TestAHSWebServices` asserted. Without a JAXB context, Jettison
also collapses a one-element list to an object.
On branch-3.4 `AHSWebApp` bound only `YarnJacksonJaxbJsonProvider`, and
`TimelineServer.md` documents the Jackson shape.
`LogsCLI#getAMContainerInfoForAHSWebService` reads a top-level `"appAttempt"`
array, so `yarn logs -am` against the AHS needs the Jackson shape too.
This PR:
- registers only `YarnJacksonJaxbJsonProvider` in
`ApplicationHistoryServer`, and drops the scan of the nonexistent package. That
scan is left alone rather than pointed at `...records.timeline.writer`, whose
writers use a plain `ObjectMapper` without the JAXB introspector and would
introduce a third shape;
- aligns `TestTimelineWebServices`, which registered the same pair;
- moves `TestAHSWebServices` to the documented shape. It registered
`JettisonFeature` with the AHS `JAXBContextResolver` and read log metadata
through `ContainerLogsInfoListReader`, which parses only the Jettison wrapper.
Both classes were used by nothing else and are removed;
- adds `TestTimelineServerRequests#testPutResponseIsWrittenByJackson`, which
posts an empty entity list to a live `ApplicationHistoryServer` and checks the
body.
Compatibility: on trunk, and likely on 3.5.x, which has the same
registration, the AHS answers with either shape depending on the start. This
restores the 3.4 and documented shape. Clients that adapted to the Jettison
wrapper on 3.5 would see the same change as on any restart that happened to
pick Jackson. One more field changes with it: container `allocatedResources` is
written as a plain map (`{"yarn.io/gpu":2}`) instead of
`{"entry":[{"key":...,"value":...}]}`.
`TimelineReaderServer` and `NodeTimelineCollectorManager` (ATS v2) have the
same pair and are handled in YARN-12026 (#8837). #8745 (YARN-11989) edits the
same `configure` block; whichever lands second needs a trivial rebase.
### How was this patch tested?
WSL2 Ubuntu 24.04, OpenJDK 17, on trunk 9ede2e95c6f.
| Run | Result |
|---|---|
| New `TestTimelineServerRequests#testPutResponseIsWrittenByJackson`,
without the fix, 6 fresh JVMs | 2 of 6 failed, body `{"response":""}` |
| `mvn clean test` on `hadoop-yarn-server-applicationhistoryservice`, with
the fix | Tests run: 213, Failures: 0, Errors: 0, Skipped: 0 |
| `checkstyle:checkstyle` on the module | no violations on changed lines |
### 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?
- [ ] 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)?
- [ ] If applicable, have you updated the `LICENSE`, `LICENSE-binary`,
`NOTICE-binary` files?
### AI Tooling
- [x] The PR includes the phrase "Contains content generated by Claude Code"
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]