zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hanm <...@git.apache.org>
Subject [GitHub] zookeeper pull request #447: [ZOOKEEPER-2926] Fix potential data consistency...
Date Mon, 30 Jul 2018 04:01:54 GMT
Github user hanm commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/447#discussion_r206010420
  
    --- Diff: src/java/main/org/apache/zookeeper/server/quorum/LeaderSessionTracker.java ---
    @@ -85,31 +85,43 @@ public boolean isGlobalSession(long sessionId) {
             return globalSessionTracker.isTrackingSession(sessionId);
         }
     
    -    public boolean addGlobalSession(long sessionId, int sessionTimeout) {
    -        boolean added =
    -            globalSessionTracker.addSession(sessionId, sessionTimeout);
    -        if (localSessionsEnabled && added) {
    +    public boolean trackSession(long sessionId, int sessionTimeout) {
    +        boolean tracked =
    +            globalSessionTracker.trackSession(sessionId, sessionTimeout);
    +        if (localSessionsEnabled && tracked) {
                 // Only do extra logging so we know what kind of session this is
                 // if we're supporting both kinds of sessions
    -            LOG.info("Adding global session 0x" + Long.toHexString(sessionId));
    +            LOG.info("Tracking global session 0x" + Long.toHexString(sessionId));
             }
    -        return added;
    +        return tracked;
         }
     
    -    public boolean addSession(long sessionId, int sessionTimeout) {
    -        boolean added;
    -        if (localSessionsEnabled && !isGlobalSession(sessionId)) {
    -            added = localSessionTracker.addSession(sessionId, sessionTimeout);
    --- End diff --
    
    I see now. Basically each implementation of session tracker will maintain either a local
session tracker and a global session tracker or both depend on the session tracker type and
the tracking of different types of sessions are delegated to the local/global session trackers
owned by the actual session tracker implementations. 


---

Mime
View raw message