Rushabh Shah created PHOENIX-6185:
-------------------------------------

             Summary: 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


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