kfaraz commented on a change in pull request #11566:
URL: https://github.com/apache/druid/pull/11566#discussion_r686535216
##########
File path:
services/src/main/java/org/apache/druid/server/router/TieredBrokerHostSelector.java
##########
@@ -257,6 +267,37 @@ public String getDefaultServiceName()
return new Pair<>(brokerServiceName, nodesHolder.pick());
}
+ public Pair<String, Server> selectForSql(SqlQuery sqlQuery)
+ {
+ synchronized (lock) {
+ if (!ruleManager.isStarted() || !started) {
+ return getDefaultLookup();
+ }
+ }
+
+ // Resolve brokerServiceName using Tier selector strategies
+ String brokerServiceName = null;
+ for (TieredBrokerSelectorStrategy strategy : strategies) {
+ final Optional<String> optionalName =
strategy.getBrokerServiceName(tierConfig, sqlQuery);
+ if (optionalName.isPresent()) {
+ brokerServiceName = optionalName.get();
+ break;
+ }
+ }
+
+ // Use defaut if not resolved by strategies
+ if (brokerServiceName == null) {
+ log.error(
+ "No brokerServiceName found for SQL Query [%s]. Using default
selector for [%s].",
Review comment:
Sounds good.
--
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]