You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by GitBox <gi...@apache.org> on 2018/07/13 22:21:16 UTC

[GitHub] sohami closed pull request #1379: DRILL-6591: Show Exception for failed queries submitted in WebUI

sohami closed pull request #1379: DRILL-6591: Show Exception for failed queries submitted in WebUI
URL: https://github.com/apache/drill/pull/1379
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/QueryWrapper.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/QueryWrapper.java
index cf749371034..1dac0db705f 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/QueryWrapper.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/QueryWrapper.java
@@ -22,6 +22,7 @@
 import com.google.common.collect.Maps;
 
 import org.apache.drill.common.exceptions.UserException;
+import org.apache.drill.common.exceptions.UserRemoteException;
 import org.apache.drill.exec.proto.UserBitShared.QueryId;
 import org.apache.drill.exec.proto.UserBitShared.QueryResult.QueryState;
 import org.apache.drill.exec.proto.UserBitShared.QueryType;
@@ -86,9 +87,8 @@ public QueryResult run(final WorkManager workManager, final WebUserConnection we
     logger.debug("Wait until the query execution is complete or there is error submitting the query");
     do {
       try {
-        isComplete = webUserConnection.await(TimeUnit.SECONDS.toMillis(1)); /*periodically timeout to check heap*/
-      } catch (Exception e) { }
-
+        isComplete = webUserConnection.await(TimeUnit.SECONDS.toMillis(1)); //periodically timeout 1 sec to check heap
+      } catch (InterruptedException e) {}
       usagePercent = getHeapUsage();
       if (usagePercent >  HEAP_MEMORY_FAILURE_THRESHOLD) {
         nearlyOutOfHeapSpace = true;
@@ -97,21 +97,22 @@ public QueryResult run(final WorkManager workManager, final WebUserConnection we
 
     //Fail if nearly out of heap space
     if (nearlyOutOfHeapSpace) {
+      UserException almostOutOfHeapException = UserException.resourceError()
+          .message("There is not enough heap memory to run this query using the web interface. ")
+          .addContext("Please try a query with fewer columns or with a filter or limit condition to limit the data returned. ")
+          .addContext("You can also try an ODBC/JDBC client. ")
+          .build(logger);
+      //Add event
       workManager.getBee().getForemanForQueryId(queryId)
-        .addToEventQueue(QueryState.FAILED,
-            UserException.resourceError(
-                new Throwable(
-                    "There is not enough heap memory to run this query using the web interface. "
-                    + "Please try a query with fewer columns or with a filter or limit condition to limit the data returned. "
-                    + "You can also try an ODBC/JDBC client. "
-                    )
-                )
-              .build(logger)
-            );
+        .addToEventQueue(QueryState.FAILED, almostOutOfHeapException);
+      //Return NearlyOutOfHeap exception
+      throw almostOutOfHeapException;
     }
 
-    if (logger.isTraceEnabled()) {
-      logger.trace("Query {} is completed ", queryId);
+    logger.trace("Query {} is completed ", queryId);
+
+    if (webUserConnection.getError() != null) {
+      throw new UserRemoteException(webUserConnection.getError());
     }
 
     if (webUserConnection.results.isEmpty()) {


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services