-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable routing of SQL queries at Router #11566
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @kfaraz for the PR. Other than inline comments, can we also run tests for AsyncQueryForwardingServlet
with the sql routing enabled for router?
services/src/main/java/org/apache/druid/server/router/TieredBrokerHostSelector.java
Outdated
Show resolved
Hide resolved
services/src/main/java/org/apache/druid/server/AsyncQueryForwardingServlet.java
Outdated
Show resolved
Hide resolved
services/src/main/java/org/apache/druid/server/AsyncQueryForwardingServlet.java
Show resolved
Hide resolved
services/src/main/java/org/apache/druid/server/AsyncQueryForwardingServlet.java
Outdated
Show resolved
Hide resolved
services/src/main/java/org/apache/druid/server/AsyncQueryForwardingServlet.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor comments. LGTM otherwise.
services/src/main/java/org/apache/druid/server/router/TieredBrokerSelectorStrategy.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comments
@@ -377,6 +377,11 @@ | |||
<artifactId>junit</artifactId> | |||
<scope>test</scope> | |||
</dependency> | |||
<dependency> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
protobuf-java
(required while running HdfsFirehoseFactoryTest
) was initially coming as a transitive dependency through druid-server
-> avatica-core
But since avatica-core
has been removed from druid-server
in this PR, protobuf-java
has been explicitly added here.
@@ -257,6 +268,42 @@ public String getDefaultServiceName() | |||
return new Pair<>(brokerServiceName, nodesHolder.pick()); | |||
} | |||
|
|||
public Pair<String, Server> selectForSql(SqlQuery sqlQuery) | |||
{ | |||
synchronized (lock) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can part of this method be refactor to share common code with the select method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, I just realized that this block is not even required for selectForSql
since ruleManager
is not used to select the target server for sql query. @kfaraz - shall this be fixed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching this, @abhishekagarwal87 . We still need the block as we need to check on the started
field of the TieredBrokerHostSelector
but we don't need the other condition.
I have added the fix.
Thank you, @kfaraz I have merged your PR. |
Description
This PR adds a new property
druid.router.sql.enable
which allows theRouter to handle SQL queries when set to
true
.This change does not affect Avatica JDBC requests and they are still routed
by hashing the Connection ID.
To allow parsing of the request object as a
SqlQuery
(contained in module druid-sql),some classes have been moved from druid-server to druid-services with
the same package name.
Major Changes
druid.router.sql.enable
ManualTieredBrokerSelectorStrategy
based on query contextAsyncQueryForwardingServlet
QueryHostFinder
TieredBrokerHostSelector
TieredBrokerSelectorStrategy
and its implementationsRouterResource
CoordinatorRuleManager
AsyncQueryForwardingServlet
to use common code for routing native and SQL queriesQueryHostFinder
to re-use common codeThis PR has: