kfaraz commented on code in PR #19120:
URL: https://github.com/apache/druid/pull/19120#discussion_r2910209247
##########
server/src/main/java/org/apache/druid/client/coordinator/CoordinatorClientImpl.java:
##########
@@ -257,16 +259,23 @@ public ListenableFuture<CoordinatorDynamicConfig>
getCoordinatorDynamicConfig()
@Override
public ListenableFuture<BrokerDynamicConfig> getBrokerDynamicConfig()
{
- return FutureUtils.transform(
- client.asyncRequest(
- new RequestBuilder(HttpMethod.GET,
"/druid/coordinator/v1/broker/config"),
- new BytesFullResponseHandler()
+ // Older coordinators may not support this endpoint; fall back to an empty
config on 404.
+ return Futures.catching(
+ FutureUtils.transform(
+ client.asyncRequest(
+ new RequestBuilder(HttpMethod.GET,
"/druid/coordinator/v1/broker/config"),
+ new BytesFullResponseHandler()
+ ),
+ holder -> JacksonUtils.readValue(jsonMapper, holder.getContent(),
BrokerDynamicConfig.class)
),
- holder -> JacksonUtils.readValue(
- jsonMapper,
- holder.getContent(),
- BrokerDynamicConfig.class
- )
+ HttpResponseException.class,
+ e -> {
+ if (e != null && e.getResponse().getStatus().getCode() == 404) {
+ return BrokerDynamicConfig.builder().build();
+ }
+ throw new RuntimeException(e);
Review Comment:
Maybe just propagate the original exception instead of wrapping it in
another `RuntimeException`.
--
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]