You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@zookeeper.apache.org by "maoling (Jira)" <ji...@apache.org> on 2020/04/24 03:06:00 UTC

[jira] [Commented] (ZOOKEEPER-1173) Server never forgets old ACL lists

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

maoling commented on ZOOKEEPER-1173:
------------------------------------

[~thkoch]

_*--->The idea may have been to save memory for equal ACL lists. However there's no code that ever removes an*_ *A**CL* _*list that is*_ *not* _*used anymore.*_

Look at the code in *ReferenceCountedACLCache#removeUsage:*

if the reference count of that ACL list <=0 means that ACL list is useless any longer and we will remove them, so we don't have that issue in the current codes.
{code:java}
long newCount = referenceCounter.get(acl).decrementAndGet();
if (newCount <= 0) {
    referenceCounter.remove(acl);
    aclKeyMap.remove(longKeyMap.get(acl));
    longKeyMap.remove(acl);
}
{code}

> Server never forgets old ACL lists
> ----------------------------------
>
>                 Key: ZOOKEEPER-1173
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1173
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: server
>            Reporter: Thomas Koch
>            Assignee: Thomas Koch
>            Priority: Major
>              Labels: acl
>
> The ACL stuff in DataTree.java reimplements a kind of reference system. The idea may have been to save memory for equal ACL lists. However there's no code that ever removes an ACL list that is not used anymore.
> Related: 
> - The ACL stuff could be in a separate class so that DataTree.java is not such a big beast anymore.
> - It's risky to have mutable objects (list) as keys in a HashMap.
> An idea to solve this: Have ACL lists as members of the datatree nodes. Lookup already existing ACL lists in a java.util.WeakHashMap.



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