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 #377: [ZOOKEEPER-2901] TTL Nodes don't work with Serv...
Date Fri, 12 Jan 2018 06:14:01 GMT
Github user lvfangmin commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/377#discussion_r161147063
  
    --- Diff: src/java/main/org/apache/zookeeper/server/EphemeralType.java ---
    @@ -40,19 +39,40 @@
         TTL;
     
         public static final long CONTAINER_EPHEMERAL_OWNER = Long.MIN_VALUE;
    -    public static final long MAX_TTL = 0x0fffffffffffffffL;
    -    public static final long TTL_MASK = 0x8000000000000000L;
    +    public static final long MAX_TTL = 0x00ffffffffffffffL;
    +    public static final long TTL_MASK = 0xff00000000000000L;
    +    public static final long MAX_TTL_SERVER_ID = 0xfe;  // 254
    +
    +    public static final String EXTENDED_TYPES_ENABLED_PROPERTY = "zookeeper.extendedTypesEnabled";
    +
    +    public static boolean extendedEphemeralTypesEnabled() {
    +        return Boolean.getBoolean(EXTENDED_TYPES_ENABLED_PROPERTY);
    +    }
     
         public static EphemeralType get(long ephemeralOwner) {
    +        if ( extendedEphemeralTypesEnabled() ) {
    +            if ((ephemeralOwner & TTL_MASK) == TTL_MASK) {
    +                return TTL;
    +            }
    +        }
             if (ephemeralOwner == CONTAINER_EPHEMERAL_OWNER) {
                 return CONTAINER;
             }
    -        if (ephemeralOwner < 0) {
    -            return TTL;
    -        }
             return (ephemeralOwner == 0) ? VOID : NORMAL;
         }
     
    +    public static void validateServerId(long serverId) {
    --- End diff --
    
    Maybe we should not start the server if the server id is conflict with TTL feature, we
can do this in QuorumPeerConfig.checkValidity.


---

Mime
View raw message