Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Improve logging in new SQL engine (#912)
Browse files Browse the repository at this point in the history
* Remove sensitive log and add log for fallback

* Update readme
  • Loading branch information
dai-chen authored Dec 12, 2020
1 parent daee92e commit 6f9102f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ Here is a documentation list with features only available in this improved SQL q
* Improvement on Subqueries in FROM clause
* [Window functions](./docs/user/dql/window.rst): ranking window function support

To avoid impact on your side, normally you won't see any difference in query response. If you want to check if and why your query falls back to be handled by old SQL engine, please explain your query and check Elasticsearch log for "Request is falling back to old SQL engine due to ...".


## Setup

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ public RestChannelConsumer prepareRequest(SQLQueryRequest request, NodeClient no
sqlService.analyze(
sqlService.parse(request.getQuery())));
} catch (SyntaxCheckException e) {
// When explain, print info log for what unsupported syntax is causing fallback to old engine
if (request.isExplainRequest()) {
LOG.info("Request is falling back to old SQL engine due to: " + e.getMessage());
}
return NOT_SUPPORTED_YET;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@ protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient cli
sqlRequest.getSql(), request.path(), request.params());
RestChannelConsumer result = newSqlQueryHandler.prepareRequest(newSqlRequest, client);
if (result != RestSQLQueryAction.NOT_SUPPORTED_YET) {
LOG.info("[{}] Request {} is handled by new SQL query engine",
LogUtils.getRequestId(), newSqlRequest);
LOG.info("[{}] Request is handled by new SQL query engine", LogUtils.getRequestId());
return result;
}
LOG.debug("[{}] Request {} is not supported and falling back to old SQL engine",
Expand Down

0 comments on commit 6f9102f

Please sign in to comment.