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_r161146799
  
    --- 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) {
    --- End diff --
    
    To keep backward compatible, shouldn't we keep use 0x80 as the TTL byte? 
    
    People may not use sid larger than 127, it's more likely they will use the TTL with 0x80
highest byte. With this change, those nodes won't be expired anymore.


---

Mime
View raw message