Handle and map errors in delete pending segments API#15673
Merged
kfaraz merged 6 commits intoapache:masterfrom Jan 15, 2024
Merged
Handle and map errors in delete pending segments API#15673kfaraz merged 6 commits intoapache:masterfrom
kfaraz merged 6 commits intoapache:masterfrom
Conversation
…ode. Currently, any errors in the delete pending segments API would result in the client not knowing about the http status and reason. This patch fixes it. This is the error from the overlord logs that don't get mapped: 2024-01-12T01:06:41,807 ERROR [qtp1757718624-150] com.sun.jersey.spi.container.ContainerResponse - The RuntimeException could not be mapped to a response, re-throwing to the HTTP container java.lang.IllegalArgumentException: Cannot delete pendingSegments because there is at least one active task created at 2024-01-12T01:06:41.318Z Also, clean up the exception messages and add tests.
kfaraz
reviewed
Jan 12, 2024
Contributor
kfaraz
left a comment
There was a problem hiding this comment.
Change makes sense, left minor comment regarding the returned HTTP status code.
...-service/src/main/java/org/apache/druid/indexing/overlord/IndexerMetadataStorageAdapter.java
Outdated
Show resolved
Hide resolved
indexing-service/src/main/java/org/apache/druid/indexing/overlord/http/OverlordResource.java
Outdated
Show resolved
Hide resolved
kfaraz
approved these changes
Jan 14, 2024
Contributor
kfaraz
left a comment
There was a problem hiding this comment.
Minor nitpicks, otherwise LGTM
...-service/src/main/java/org/apache/druid/indexing/overlord/IndexerMetadataStorageAdapter.java
Outdated
Show resolved
Hide resolved
...-service/src/main/java/org/apache/druid/indexing/overlord/IndexerMetadataStorageAdapter.java
Outdated
Show resolved
Hide resolved
| public class IndexerMetadataStorageAdapterTest | ||
| { | ||
| @Rule | ||
| public ExpectedException expectedException = ExpectedException.none(); |
...xing-service/src/test/java/org/apache/druid/indexing/overlord/http/OverlordResourceTest.java
Outdated
Show resolved
Hide resolved
kfaraz
reviewed
Jan 15, 2024
| NoopTask.create() | ||
| ), | ||
| new TaskInfo<>( | ||
| "id1", |
Contributor
Author
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.
Problem:
At present, any exception in the delete pending segments API would result in the client not knowing the correct HTTP status code and cause. Following is an error logged in the overlord logs when the delete failed, but the reason doesn't get propagated to the client:
This patch handles the exception and maps it to a 400 response with the appropriate error message.
Also, clean up the exception messages, use
DruidException, and add unit tests for these failure scenarios.This PR has: