zookeeper-dev mailing list archives

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

    https://github.com/apache/zookeeper/pull/447#discussion_r205922937
  
    --- 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 --
    
    When local session feature is enabled, the createSession method in ZooKeeperServer will
create, track and 'commit' (update the local session in memory map) the local session immediately.


---

Mime
View raw message