Fix compaction status API response#17006
Merged
kfaraz merged 3 commits intoapache:masterfrom Sep 5, 2024
Merged
Conversation
abhishekagarwal87
approved these changes
Sep 5, 2024
gargvishesh
reviewed
Sep 5, 2024
| snapshots = Collections.singleton(autoCompactionSnapshot); | ||
| } | ||
| return Response.ok(Collections.singletonMap("latestStatus", snapshots)).build(); | ||
| return Response.ok(new CompactionStatusResponse(snapshots)).build(); |
Contributor
There was a problem hiding this comment.
Is there a reason that raw map isn't compatible but a class works? I believe both would be serialised in the same manner.
Contributor
Author
There was a problem hiding this comment.
Yes, that's true. The problem wasn't that I had used a map instead of a dedicated POJO. Instead, I had forgotten to use anything at all 😛 .
The Overlord REST endpoint returns a response that looks like
{
"latestStatus": [{snapshot1object}, {snapshot2object}, {snapshot3object}]
}
but in the Overlord client, I was just reading the internal list
[{snapshot1object}, {snapshot2object}, {snapshot3object}]
instead of the whole object.
Contributor
Author
There was a problem hiding this comment.
to avoid such mistakes in the future and to keep the code simple, I decided to use a model POJO instead of maps everywhere.
Contributor
There was a problem hiding this comment.
Agree. Makes it so much cleaner.
gargvishesh
approved these changes
Sep 5, 2024
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.
Description
#16768 introduces new compaction APIs on the Overlord
/compact/statusand/compact/progress.But the corresponding
OverlordClientmethods do not return an object compatible with the actual endpoints defined inOverlordCompactionResource.This patch ensures that the objects are compatible.
Changes
CompactionStatusResponseandCompactionProgressResponseOverlordClientmethods and as the response entity inOverlordCompactionResourceSupervisorCleanupModulebound on the Coordinator to perform cleanup of supervisors. Without this module, Coordinator cannot deserialize compaction supervisors.Testing