joseluisll opened a new pull request, #8907: URL: https://github.com/apache/hadoop/pull/8907
### Description of PR `TimelineEntity` and `TimelineEvent` carry the documented field names as `@XmlElement` annotations (`entitytype`, `entity`, `starttime`, `relatedentities`, `primaryfilters`, `otherinfo`, `domain`). HADOOP-15984 moved the timeline v1 readers and writers to a plain `ObjectMapper`, which ignores those annotations, so since 3.5.0 the REST calls and the v1 client have used the camelCase bean names. A server that only understands camelCase rejects the documented names with `400 Incomplete entity without entity id/type`, and every client older than 3.5.0 sends the documented names. This PR names the properties with `@JsonProperty` so the writers emit the documented names again, and keeps camelCase as `@JsonAlias` so 3.5.x clients keep working: | | Before | After | |---|---|---| | `POST /ws/v1/timeline` with `entity`/`entitytype`/`starttime` | `400` | accepted | | `POST /ws/v1/timeline` with `entityId`/`entityType`/`startTime` | accepted | accepted | | `GET` body field names | `entityType`, `entityId`, ... | `entitytype`, `entity`, ... | | Null fields in `GET` bodies | present | omitted | The null omission is set on `TimelineEntitiesWriter` and `TimelineEntityWriter`, not on the classes: a class-level `@JsonInclude(NON_NULL)` breaks the null round trip in `LevelDBCacheTimelineStore`, which has to store and return nulls. The annotations are ignored by the JAXB-based mappers, so the `FileSystemTimelineWriter` path is unaffected. ### Compatibility The output spelling goes back to what 3.4 and earlier produced. A 3.5.x server still returns camelCase, so a 3.5.x client reading a trunk server sees the documented names; in-tree the v1 client parses into the same beans, which accept both spellings on input. All seven properties are covered, `domainId` included, so the `domain` name in the documentation now matches the JSON as well. YARN-12030 (PR #8841) edits `ApplicationHistoryServer#configure()` and `TestTimelineWebServices`, which this patch does not touch, so the two do not conflict. ### How was this patch tested? Ran on the fork's build and Yetus workflows against `af2ddc02eee`, plus locally on the host. | Run | Result | |---|---| | New `TestTimelineServerRequests#testDocumentedFieldNames` and `#testCamelCaseFieldNamesAreAccepted`, without the fix | `testDocumentedFieldNames` failed: expected `<200>` but was `<400>` | | New tests with the fix | pass | | Timeline tests in `hadoop-yarn-api` + `hadoop-yarn-server-applicationhistoryservice` with the fix | 169 tests, 0 failures | | [Build 41182680572](https://github.com/joseluisll/hadoop/actions/runs/41182680572) | success | | [Yetus 41182690927](https://github.com/joseluisll/hadoop/actions/runs/41182690927) | `+1 overall`, all subsystems +1 (compile/javac on JDK 17 and 21, checkstyle, javadoc, spotbugs, shadedclient, unit for both modules, asflicense) | ### 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]
