[ 
https://issues.apache.org/jira/browse/PHOENIX-6185?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17214768#comment-17214768
 ] 

ASF GitHub Bot commented on PHOENIX-6185:
-----------------------------------------

shahrs87 commented on a change in pull request #919:
URL: https://github.com/apache/phoenix/pull/919#discussion_r505624689



##########
File path: 
phoenix-core/src/main/java/org/apache/phoenix/exception/SQLExceptionCode.java
##########
@@ -453,8 +453,13 @@ public SQLException newException(SQLExceptionInfo info) {
     OPERATION_TIMED_OUT(6000, "TIM01", "Operation timed out.", new Factory() {
         @Override
         public SQLException newException(SQLExceptionInfo info) {
-            return new SQLTimeoutException(OPERATION_TIMED_OUT.getMessage(),
-                    OPERATION_TIMED_OUT.getSQLState(), 
OPERATION_TIMED_OUT.getErrorCode());
+            final String reason =
+                (info.getMessage() != null ? info.getMessage() : "")

Review comment:
       > info.getMessage() != null ? info.getMessage() : ""
   
   In else block, can we use OPERATION_TIMED_OUT.getMessage(). Atleast we will 
know it was operation timed out.
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> OPERATION_TIMED_OUT#newException method swallows the exception message and 
> root cause exception.
> ------------------------------------------------------------------------------------------------
>
>                 Key: PHOENIX-6185
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-6185
>             Project: Phoenix
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 4.14.3
>            Reporter: Rushabh Shah
>            Assignee: Viraj Jasani
>            Priority: Major
>
> BaseResultIterators#getIterators encountered TimeoutException 
> [here|https://github.com/apache/phoenix/blob/master/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java#L1383-L1389]
> {code:java}
>         } catch (TimeoutException e) {
>             context.getOverallQueryMetrics().queryTimedOut();
>             GLOBAL_QUERY_TIMEOUT_COUNTER.increment();
>             // thrown when a thread times out waiting for the future.get() 
> call to return
>             toThrow = new SQLExceptionInfo.Builder(OPERATION_TIMED_OUT)
>                     .setMessage(". Query couldn't be completed in the 
> allotted time: "
>                             + queryTimeOut + " 
> ms").setRootCause(e).build().buildException();
> {code}
> It creates SQLExceptionInfo object with message indicating the timeout and 
> the root cause exception.
> But 
> [SQLExceptionCode#OPERATION_TIMED_OUT#newException|https://github.com/apache/phoenix/blob/master/phoenix-core/src/main/java/org/apache/phoenix/exception/SQLExceptionCode.java#L453-L459]
>  ignores all that information and creates SQLException with just template 
> message and loses the root cause exception also.
> {code:java}
>     OPERATION_TIMED_OUT(6000, "TIM01", "Operation timed out.", new Factory() {
>         @Override
>         public SQLException newException(SQLExceptionInfo info) {
>             return new SQLTimeoutException(OPERATION_TIMED_OUT.getMessage(),
>                     OPERATION_TIMED_OUT.getSQLState(), 
> OPERATION_TIMED_OUT.getErrorCode());
>         }
>     }),
> {code}
> Instead it should create SQLTimeoutException from SQLExceptionInfo object.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to