You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ro...@apache.org on 2023/11/03 20:09:29 UTC

(pinot) branch master updated: adding catch all logging for exception during DQL/DML process (#11944)

This is an automated email from the ASF dual-hosted git repository.

rongr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new ee4b834e5f adding catch all logging for exception during DQL/DML process (#11944)
ee4b834e5f is described below

commit ee4b834e5fc718da3675a7c211015df0a8ea9250
Author: Rong Rong <ro...@apache.org>
AuthorDate: Fri Nov 3 13:09:23 2023 -0700

    adding catch all logging for exception during DQL/DML process (#11944)
    
    * adding catch all logging for exception during DQL/DML process
    * change wording based on comments
    
    ---------
    
    Co-authored-by: Rong Rong <ro...@startree.ai>
---
 .../pinot/broker/api/resources/PinotClientRequest.java | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotClientRequest.java b/pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotClientRequest.java
index 33de745c52..989bf6b580 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotClientRequest.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotClientRequest.java
@@ -316,12 +316,22 @@ public class PinotClientRequest {
         try (RequestScope requestStatistics = Tracing.getTracer().createRequestScope()) {
           return _requestHandler.handleRequest(sqlRequestJson, sqlNodeAndOptions, httpRequesterIdentity,
               requestStatistics, httpHeaders);
+        } catch (Exception e) {
+          LOGGER.error("Error handling DQL request:\n{}\nException: {}", sqlRequestJson,
+              QueryException.getTruncatedStackTrace(e));
+          throw e;
         }
       case DML:
-        Map<String, String> headers = new HashMap<>();
-        httpRequesterIdentity.getHttpHeaders().entries()
-            .forEach(entry -> headers.put(entry.getKey(), entry.getValue()));
-        return _sqlQueryExecutor.executeDMLStatement(sqlNodeAndOptions, headers);
+        try {
+          Map<String, String> headers = new HashMap<>();
+          httpRequesterIdentity.getHttpHeaders().entries()
+              .forEach(entry -> headers.put(entry.getKey(), entry.getValue()));
+          return _sqlQueryExecutor.executeDMLStatement(sqlNodeAndOptions, headers);
+        } catch (Exception e) {
+          LOGGER.error("Error handling DML request:\n{}\nException: {}", sqlRequestJson,
+              QueryException.getTruncatedStackTrace(e));
+          throw e;
+        }
       default:
         return new BrokerResponseNative(QueryException.getException(QueryException.SQL_PARSING_ERROR,
             new UnsupportedOperationException("Unsupported SQL type - " + sqlType)));


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org