phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Josh Elser (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PHOENIX-4809) connectionQueue never cleared in ConnectionQueryServicesImpl
Date Wed, 11 Jul 2018 19:15:01 GMT

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

Josh Elser commented on PHOENIX-4809:
-------------------------------------

{quote}Maybe related to lease renewal not being on?
{quote}
Ah, yeah, that's the rub. If the RenewLeaseTask doesn't run, nothing drains these queues.

> connectionQueue never cleared in ConnectionQueryServicesImpl
> ------------------------------------------------------------
>
>                 Key: PHOENIX-4809
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-4809
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: Josh Elser
>            Assignee: Josh Elser
>            Priority: Major
>             Fix For: 4.15.0, 5.1.0
>
>
> When we create a new {{PhoenixConnection}}, we update {{connectionQueues}} in CQSI:
> {code:java}
>     @Override
>     public void addConnection(PhoenixConnection connection) throws SQLException {
>         connectionQueues.get(getQueueIndex(connection)).add(new WeakReference<PhoenixConnection>(connection));
>         if (returnSequenceValues) {
>             synchronized (connectionCountLock) {
>                 connectionCount++;
>             }
>         }
>     }{code}
> We use connectionQueues to determine what needs lease renewal done.
> However, when the user closes a connection, this datastructure is never cleaned up.
> {code:java}
>     @Override
>     public void removeConnection(PhoenixConnection connection) throws SQLException
{
>         if (returnSequenceValues) {
>             ConcurrentMap<SequenceKey,Sequence> formerSequenceMap =
null;
>             synchronized (connectionCountLock) {
>                 if (--connectionCount <= 0) {
>                     if (!this.sequenceMap.isEmpty()) {
>                         formerSequenceMap = this.sequenceMap;
>                         this.sequenceMap = Maps.newConcurrentMap();
>                     }
>                 }
>                 if (connectionCount < 0) {
>                     connectionCount = 0;
>                 }
>             }
>             // Since we're using the former sequenceMap, we can do this outside
>             // the lock.
>             if (formerSequenceMap != null) {
>                 // When there are no more connections, attempt to return
any sequences
>                 returnAllSequences(formerSequenceMap);
>             }
>         } else if (shouldThrottleNumConnections){ //still need to decrement connection
count
>             synchronized (connectionCountLock) {
>                 if (connectionCount > 0) {
>                     --connectionCount;
>                 }
>             }
>         }
>     }{code}
> Running a test now, but seems to be the case on master.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message