Select broker based on query context parameter brokerService#11495
Select broker based on query context parameter brokerService#11495abhishekagarwal87 merged 7 commits intoapache:masterfrom
brokerService#11495Conversation
brokerServiceName and corresponding broker selector strategybrokerServiceName and corresponding broker selector strategy
brokerServiceName and corresponding broker selector strategybrokerService and corresponding broker selector strategy
brokerService and corresponding broker selector strategybrokerService
abhishekagarwal87
left a comment
There was a problem hiding this comment.
@kfaraz - LGTM except some minor comments. can we rename queryContext strategy to something less implementation specific e.g. manual?
| if (isValidBrokerService(contextBrokerService, tierConfig)) { | ||
| // If the broker service in the query context is valid, use that | ||
| return Optional.of(contextBrokerService); | ||
| } else if (isValidBrokerService(fallbackBrokerService, tierConfig)) { |
There was a problem hiding this comment.
could we perform this check in the constructor itself? your class would have Optional broker that would either be Optional.absent() or Optional.of(fallbackBrokerService). you can return the field as it is.
There was a problem hiding this comment.
We don't have the TieredBrokerConfig in the constructor, because the object is being constructed from deserialization of config and not by Guice.
|
|
||
| #### queryContext | ||
|
|
||
| This strategy reads the parameter `brokerService` from the query context and routes the query accordingly. If no valid `brokerService` is specified in the query context, the field `fallbackBrokerService` is used if set to a valid non-null value. |
There was a problem hiding this comment.
can we call fallbackBrokerService defaultBrokerService instead? Latter looks more common in druid codebase.
There was a problem hiding this comment.
Renamed to defaultManualBrokerService
Co-authored-by: Abhishek Agarwal <1477457+abhishekagarwal87@users.noreply.github.com>
| // If the fallbackBrokerService is valid, use that | ||
| return Optional.of(defaultManualBrokerService); | ||
| } else { | ||
| log.debug( |
There was a problem hiding this comment.
Should this be error level or at least warning to indicate that some config (either queryContext and/or defaultManualBrokerService) are set incorrect?
| ```json | ||
| { | ||
| "type": "manual", | ||
| "defaultManualBrokerService": "druid:broker-hot" |
There was a problem hiding this comment.
is defaultManualBrokerService required?
There was a problem hiding this comment.
No, it is an optional field.
maytasm
left a comment
There was a problem hiding this comment.
Minor comments but overall LGTM
…uid into select_broker_by_query_context
|
Merging since CI failure (kafka integration test) is unrelated |
Description
This change allows the selection of a specific broker service (or broker tier) by the Router.
The newly added
ManualTieredBrokerSelectorStrategyworks as follows:brokerServicein the query context. If this is a valid broker service, use it.defaultManualBrokerServicehas been set in the strategy. If this is a valid broker service, use it.Changes in this PR
ManualTieredBrokerSelectorStrategybrokerServiceinQueryContextsThis PR has: