Skip to content

Fix mark used API response serialization#18140

Merged
kfaraz merged 1 commit intoapache:masterfrom
kfaraz:fix_mark_used_api
Jun 13, 2025
Merged

Fix mark used API response serialization#18140
kfaraz merged 1 commit intoapache:masterfrom
kfaraz:fix_mark_used_api

Conversation

@kfaraz
Copy link
Copy Markdown
Contributor

@kfaraz kfaraz commented Jun 13, 2025

Bug

For some APIs, DataSourcesResource and OverlordDataSourcesResource are not able to
serialize out the JSON response.

Note that the API is handled correctly by the server, it just fails to send back an appropriate response.

This bug was introduced a while back in #17545
While most of the APIs already handled sending back a JSON response,
some APIs didn't.

error_to_update

2025-06-12T01:40:01,545 ERROR [qtp41470360-100] com.sun.jersey.spi.container.ContainerResponse - 
Mapped exception to response: 500 (Internal Server Error)
javax.ws.rs.WebApplicationException: com.sun.jersey.api.MessageException: 
A message body writer for Java class org.apache.druid.rpc.indexing.SegmentUpdateResponse, 
and Java type class org.apache.druid.rpc.indexing.SegmentUpdateResponse, 
and MIME media type application/octet-stream was not found.

Fix

  • Update all APIs in DataSourcesResource and OverlordDataSourcesResource to handle
    sending back a JSON response by annotating with @Produces(MediaType.APPLICATION_JSON)

Release note

Fix a bug with the following mark used / mark unused APIs so that they can send back a JSON response successfully.
Currently, these APIs work correctly but error out while sending back a response.

Method Path Description
POST /druid/indexer/v1/datasources/{dataSourceName} Mark all non-overshadowed segments as used
POST /druid/indexer/v1/datasources/{dataSourceName}/markUsed Mark non-overshadowed segments in an interval as used
POST /druid/indexer/v1/datasources/{dataSourceName}/segments/{segmentId} Mark a single segment as used
DELETE /druid/indexer/v1/datasources/{dataSourceName}/segments/{segmentId} Mark a single segment as unused
POST /druid/coordinator/v1/datasources/{dataSourceName} Mark all non-overshadowed segments as used
POST /druid/coordinator/v1/datasources/{dataSourceName}/markUsed Mark non-overshadowed segments in an interval as used
POST /druid/coordinator/v1/datasources/{dataSourceName}/segments/{segmentId} Mark a single segment as used
DELETE /druid/coordinator/v1/datasources/{dataSourceName}/segments/{segmentId} Mark a single segment as unused

This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • a release note entry in the PR description.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

@kfaraz
Copy link
Copy Markdown
Contributor Author

kfaraz commented Jun 13, 2025

Thanks for the prompt review, @adarshsanjeev !

@kfaraz kfaraz merged commit 9db107a into apache:master Jun 13, 2025
74 checks passed
@kfaraz kfaraz deleted the fix_mark_used_api branch June 13, 2025 06:32
jtuglu1 pushed a commit to jtuglu1/druid that referenced this pull request Jun 17, 2025
Bug:
Some APIs in `DataSourcesResource` and `OverlordDataSourcesResource` are not able to
serialize out the JSON response.

__Note that the API is handled correctly by the server, it just fails to send back an appropriate response.__

This bug was introduced a while back in apache#17545 
While most of the APIs already handled sending back a JSON response, some APIs didn't.

Fix:
Update all APIs in `DataSourcesResource` and `OverlordDataSourcesResource` to handle
sending back a JSON response by annotating with `@Produces(MediaType.APPLICATION_JSON)`
@capistrant capistrant added this to the 34.0.0 milestone Jul 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants