浏览代码

ZOOKEEPER-1695. Inconsistent error code and type for new errors introduced by dynamic reconfiguration (Michi Mutsuzaki via rakeshr)

git-svn-id: https://svn.apache.org/repos/asf/zookeeper/trunk@1591175 13f79535-47bb-0310-9956-ffa450edef68
Rakesh Radhakrishnan 11 年之前
父节点
当前提交
6b77e2eff3
共有 3 个文件被更改,包括 28 次插入14 次删除
  1. 3 0
      CHANGES.txt
  2. 9 6
      src/c/include/zookeeper.h
  3. 16 8
      src/java/main/org/apache/zookeeper/KeeperException.java

+ 3 - 0
CHANGES.txt

@@ -630,6 +630,9 @@ BUGFIXES:
   
   ZOOKEEPER-1910. RemoveWatches wrongly removes the watcher if multiple watches 
   exists on a path (Rakesh R via camille)
+  
+  ZOOKEEPER-1695. Inconsistent error code and type for new errors introduced
+  by dynamic reconfiguration (Michi Mutsuzaki via rakeshr)
 
 IMPROVEMENTS:
 

+ 9 - 6
src/c/include/zookeeper.h

@@ -93,6 +93,13 @@ enum ZOO_ERRORS {
   ZOPERATIONTIMEOUT = -7, /*!< Operation timeout */
   ZBADARGUMENTS = -8, /*!< Invalid arguments */
   ZINVALIDSTATE = -9, /*!< Invliad zhandle state */
+  ZNEWCONFIGNOQUORUM = -13, /*!< No quorum of new config is connected and
+                                 up-to-date with the leader of last commmitted
+                                 config - try invoking reconfiguration after new
+                                 servers are connected and synced */
+  ZRECONFIGINPROGRESS = -14, /*!< Reconfiguration requested while another
+                                  reconfiguration is currently in progress. This
+                                  is currently not supported. Please retry. */
 
   /** API errors.
    * This is never thrown by the server, it shouldn't be used other than
@@ -114,12 +121,8 @@ enum ZOO_ERRORS {
   ZCLOSING = -116, /*!< ZooKeeper is closing */
   ZNOTHING = -117, /*!< (not error) no server responses to process */
   ZSESSIONMOVED = -118, /*!<session moved to another server, so operation is ignored */
-  ZNEWCONFIGNOQUORUM = -120,  /*!< No quorum of new config is connected and up-to-date with the leader of last commmitted config - try
-                                 invoking reconfiguration after new servers are connected and synced */
-  ZRECONFIGINPROGRESS = -121,  /*!< Reconfiguration requested while another reconfiguration is currently in progress. This is currently
-                                       not supported. Please retry. */
-  ZEPHEMERALONLOCALSESSION = -122, /*!< Attempt to create ephemeral node on a local session */
-  ZNOWATCHER = -123 /*!< The watcher couldn't be found */
+  ZEPHEMERALONLOCALSESSION = -120, /*!< Attempt to create ephemeral node on a local session */
+  ZNOWATCHER = -121 /*!< The watcher couldn't be found */
 };
 
 #ifdef __cplusplus

+ 16 - 8
src/java/main/org/apache/zookeeper/KeeperException.java

@@ -228,6 +228,20 @@ public abstract class KeeperException extends Exception {
         @Deprecated
         public static final int UnknownSession= -12;
 
+        /**
+         * @deprecated deprecated in 3.1.0, use {@link Code#NEWCONFIGNOQUORUM}
+         * instead
+         */
+        @Deprecated
+        public static final int NewConfigNoQuorum = -13;
+
+        /**
+         * @deprecated deprecated in 3.1.0, use {@link Code#RECONFIGINPROGRESS}
+         * instead
+         */
+        @Deprecated
+        public static final int ReconfigInProgress= -14;
+
         /**
          * @deprecated deprecated in 3.1.0, use {@link Code#APIERROR} instead
          */
@@ -292,13 +306,7 @@ public abstract class KeeperException extends Exception {
         // public static final int SessionMoved = -118;       
         
         @Deprecated
-        public static final int NewConfigNoQuorum = -120;
-        
-        @Deprecated
-        public static final int ReconfigInProgress= -121;
-        
-        @Deprecated
-        public static final int EphemeralOnLocalSession = -122;
+        public static final int EphemeralOnLocalSession = -120;
 
     }
 
@@ -376,7 +384,7 @@ public abstract class KeeperException extends Exception {
         /** Attempt to create ephemeral node on a local session */
         EPHEMERALONLOCALSESSION (EphemeralOnLocalSession),
         /** Attempts to remove a non-existing watcher */
-        NOWATCHER (-123);
+        NOWATCHER (-121);
 
         private static final Map<Integer,Code> lookup
             = new HashMap<Integer,Code>();