This is an automated email from the ASF dual-hosted git repository.
abhishek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git
The following commit(s) were added to refs/heads/master by this push:
new c641657 Fix router documentation for `druid.router.sql.enable`
(#11716)
c641657 is described below
commit c641657bae2e2738baa1dba2b8409a4fd599a4b7
Author: Kashif Faraz <[email protected]>
AuthorDate: Tue Sep 28 22:54:13 2021 +0530
Fix router documentation for `druid.router.sql.enable` (#11716)
* Rename field, fix router documentation
* Add more lines to doc
* Apply doc suggestions from code review
Co-authored-by: Charles Smith <[email protected]>
Co-authored-by: Charles Smith <[email protected]>
---
docs/configuration/index.md | 2 +-
docs/design/router.md | 14 +++++++-------
.../apache/druid/server/AsyncQueryForwardingServlet.java | 6 +++---
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/docs/configuration/index.md b/docs/configuration/index.md
index 7e170f4..52b77e1 100644
--- a/docs/configuration/index.md
+++ b/docs/configuration/index.md
@@ -2055,7 +2055,7 @@ Supported query contexts:
|`druid.router.tierToBrokerMap`|Queries for a certain tier of data are routed
to their appropriate Broker. This value should be an ordered JSON map of tiers
to Broker names. The priority of Brokers is based on the
ordering.|{"_default_tier": "<defaultBrokerServiceName>"}|
|`druid.router.defaultRule`|The default rule for all datasources.|"_default"|
|`druid.router.pollPeriod`|How often to poll for new rules.|PT1M|
-|`druid.router.sql.enable`|Enable routing of SQL queries. Possible values are
`true` and `false`. When set to `true`, the Router uses the provided strategies
to determine the broker service for a given SQL query.|`false`|
+|`druid.router.sql.enable`|Enable routing of SQL queries using strategies.
When`true`, the Router uses the strategies defined in
`druid.router.strategies` to determine the broker service for a given SQL
query. When `false`, the Router uses the `defaultBrokerServiceName`.|`false`|
|`druid.router.strategies`|Please see [Router
Strategies](../design/router.md#router-strategies) for
details.|[{"type":"timeBoundary"},{"type":"priority"}]|
|`druid.router.avatica.balancer.type`|Class to use for balancing Avatica
queries across Brokers. Please see [Avatica Query
Balancing](../design/router.md#avatica-query-balancing).|rendezvousHash|
|`druid.router.managementProxy.enabled`|Enables the Router's [management
proxy](../design/router.md#router-as-management-proxy) functionality.|false|
diff --git a/docs/design/router.md b/docs/design/router.md
index 06d1e1f..5010b80 100644
--- a/docs/design/router.md
+++ b/docs/design/router.md
@@ -138,18 +138,18 @@ Allows defining arbitrary routing rules using a
JavaScript function. The functio
> JavaScript-based functionality is disabled by default. Please refer to the
> Druid [JavaScript programming guide](../development/javascript.md) for
> guidelines about using Druid's JavaScript functionality, including
> instructions on how to enable it.
-### Routing of SQL queries
+### Routing of SQL queries using strategies
-To enable routing of SQL queries, set `druid.router.sql.enable` to `true`
(`false` by default). The broker service for a
+To enable routing of SQL queries using strategies, set
`druid.router.sql.enable` to `true`. The broker service for a
given SQL query is resolved using only the provided Router strategies. If not
resolved using any of the strategies, the
Router uses the `defaultBrokerServiceName`. This behavior is slightly
different from native queries where the Router
first tries to resolve the broker service using strategies, then load rules
and finally using the `defaultBrokerServiceName`
-if still not resolved.
+if still not resolved. When `druid.router.sql.enable` is set to `false`
(default value), the Router uses the
+`defaultBrokerServiceName`.
-Routing of native queries is always enabled.
-
-Setting `druid.router.sql.enable` does not affect Avatica JDBC requests. They
are routed based on connection ID as
-explained in the next section.
+Setting `druid.router.sql.enable` does not affect either Avatica JDBC requests
or native queries.
+Druid always routes native queries using the strategies and load rules as
documented.
+Druid always routes Avatica JDBC requests based on connection ID.
### Avatica query balancing
diff --git
a/services/src/main/java/org/apache/druid/server/AsyncQueryForwardingServlet.java
b/services/src/main/java/org/apache/druid/server/AsyncQueryForwardingServlet.java
index e39b7b1..8365ba1 100644
---
a/services/src/main/java/org/apache/druid/server/AsyncQueryForwardingServlet.java
+++
b/services/src/main/java/org/apache/druid/server/AsyncQueryForwardingServlet.java
@@ -130,7 +130,7 @@ public class AsyncQueryForwardingServlet extends
AsyncProxyServlet implements Qu
private final AuthenticatorMapper authenticatorMapper;
private final ProtobufTranslation protobufTranslation;
- private final boolean routeSqlQueries;
+ private final boolean routeSqlByStrategy;
private HttpClient broadcastClient;
@@ -160,7 +160,7 @@ public class AsyncQueryForwardingServlet extends
AsyncProxyServlet implements Qu
this.queryMetricsFactory = queryMetricsFactory;
this.authenticatorMapper = authenticatorMapper;
this.protobufTranslation = new ProtobufTranslationImpl();
- this.routeSqlQueries = Boolean.parseBoolean(
+ this.routeSqlByStrategy = Boolean.parseBoolean(
properties.getProperty(PROPERTY_SQL_ENABLE,
PROPERTY_SQL_ENABLE_DEFAULT)
);
}
@@ -259,7 +259,7 @@ public class AsyncQueryForwardingServlet extends
AsyncProxyServlet implements Qu
handleException(response, objectMapper, e);
return;
}
- } else if (routeSqlQueries && isSqlQueryEndpoint &&
HttpMethod.POST.is(method)) {
+ } else if (routeSqlByStrategy && isSqlQueryEndpoint &&
HttpMethod.POST.is(method)) {
try {
SqlQuery inputSqlQuery =
objectMapper.readValue(request.getInputStream(), SqlQuery.class);
request.setAttribute(SQL_QUERY_ATTRIBUTE, inputSqlQuery);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]