Samarth Jain created PHOENIX-1585:
-------------------------------------

             Summary: Provide a means of doing certain operations 
asynchronously when closing connections
                 Key: PHOENIX-1585
                 URL: https://issues.apache.org/jira/browse/PHOENIX-1585
             Project: Phoenix
          Issue Type: Improvement
            Reporter: Samarth Jain


When closing connections, there are times we do expensive RPC calls. 
For example - when doing hash joins, for clearing the hash cache on the region 
servers we execute a remove server cache operation for each region. 
{code}
at 
org.apache.phoenix.cache.ServerCacheClient.removeServerCache(ServerCacheClient.java:285)
        at 
org.apache.phoenix.cache.ServerCacheClient.access$000(ServerCacheClient.java:80)
        at 
org.apache.phoenix.cache.ServerCacheClient$ServerCache.close(ServerCacheClient.java:140)
        at 
org.apache.phoenix.util.SQLCloseables.closeAllQuietly(SQLCloseables.java:53)
        at org.apache.phoenix.util.SQLCloseables.closeAll(SQLCloseables.java:43)
        at 
org.apache.phoenix.execute.BaseQueryPlan$1.close(BaseQueryPlan.java:235)
        at 
org.apache.phoenix.iterate.DelegateResultIterator.close(DelegateResultIterator.java:39)
        at 
org.apache.phoenix.execute.SortMergeJoinPlan$SemiAntiJoinIterator.close(SortMergeJoinPlan.java:419)
        at 
org.apache.phoenix.jdbc.PhoenixResultSet.close(PhoenixResultSet.java:153)
        at 
org.apache.phoenix.util.SQLCloseables.closeAllQuietly(SQLCloseables.java:53)
        at org.apache.phoenix.util.SQLCloseables.closeAll(SQLCloseables.java:43)
        at 
org.apache.phoenix.jdbc.PhoenixStatement.close(PhoenixStatement.java:964)
        at 
org.apache.phoenix.util.SQLCloseables.closeAllQuietly(SQLCloseables.java:53)
        at org.apache.phoenix.util.SQLCloseables.closeAll(SQLCloseables.java:43)
        at 
org.apache.phoenix.jdbc.PhoenixConnection.closeStatements(PhoenixConnection.java:386)
        at 
org.apache.phoenix.jdbc.PhoenixConnection.close(PhoenixConnection.java:400)
{code}

Another example is when we close connections, we sometimes return all the 
unused sequences back to the SYSTEM.SEQUENCE table. 
See PhoenixConnection#close(). 

Such book keeping operations that don't directly effect the request using 
Phoenix should be executed asynchronously. This way requests won't need to wait 
for such operations to complete making them faster.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to