apache / apache/druid

Response code for DataSourcesResource on non-existent dataSource or segmentId

Open
#7,652 2 comments 0 reactions 0 assignees View on GitHub
Discuss Stable API
Dominant language
Java
Stars
14.1k
Forks
3.8k
Avg merge
2d 58m
Merged PRs (30d)
233

Description

#7490 introduced 404 (not found) response in `DataSourcesResource` for non-existent segment ids. As minimum, I think it would be consistent to return 404 instead of 204 (no content) for non-existent segment id for `/{dataSourceName}/segments/{segmentId}` as well.

As maximum, all endpoints in this resources should return 404 on non-existent data source.

There is a [heated discussion on SO](https://stackoverflow.com/q/11746894) regarding whether it's semantically more correct to return 204 or 404 in these situations. To me, it feels that 404 is better.

FYI @dampcake @jon-wei

Contributor guide

Open the contributing guide

Research direction

Start by reading DataSourcesResource and the 404 behavior introduced by #7490, then inspect the endpoint for /{dataSourceName}/segments/{segmentId}. Determine whether the change should cover that endpoint only or all resource endpoints; done means the agreed non-existent data source or segment cases return the expected 404 response instead of 204.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.