amaechler opened a new pull request, #14355:
URL: https://github.com/apache/druid/pull/14355

   ### Description
   
   When calling the Sampler API `POST /druid/indexer/v1/sampler`, the sampler 
creates an input source to sample records from. When the input source has to be 
created (i.e. a parser hasn't been provided, usually Kafka or Kinesis), we 
create one by instantiating a new `RecordSupplierInputSource`.
   
   The constructor of `RecordSupplierInputSource` seeks the beginning (or end) 
of the Kafka partitions / Kinesis shards. While doing so, things can go wrong - 
Network issues, authentication problems, etc. Any exceptions that occur are 
wrapped with a `StreamException` (done via the `wrapExceptions` helper 
function).
   
   The Sampler, however, deals with `SamplerException`s only. To that end, a 
`SamplerExceptionMapper` has been registered which maps such exceptions to a 
`400 Bad Request` response.
   
   The above-mentioned `RecordSupplierInputSource` already catches a 
`InterruptedException` and maps it to a `SamplerException`, but ignores any 
`StreamException`. This causes the sampler API to return a `500 Internal server 
error` (with the message "The RuntimeException could not be mapped to a 
response, re-throwing to the HTTP container").
   
   This PR addresses this issue by handling `StreamException`s accordingly.
   
   ### Alternatives
   
   We could also catch any exception (instead of exceptions of a specific type).
   
   #### Release note
   
   Handle exceptions while sampling from streaming sources. We could also omit 
this since the Sampler API isn't currently documented (#14125).
   
   <hr>
   
   <!-- Check the items by putting "x" in the brackets for the done things. Not 
all of these items apply to every PR. Remove the items which are not done or 
not relevant to the PR. None of the items from the checklist below are strictly 
necessary, but it would be very helpful if you at least self-review the PR. -->
   
   This PR has:
   
   - [ ] been self-reviewed.
   - [ ] a release note entry in the PR description.
   - [ ] added unit tests or modified existing tests to cover new code paths, 
ensuring the threshold for [code 
coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md)
 is met.
   - [ ] added integration tests.
   - [ ] been tested in a test Druid cluster.
   


-- 
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]

Reply via email to