[GitHub] zookeeper pull request #572: ZOOKEEPER-3085 define exit codes in enum

2018-08-06 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/zookeeper/pull/572


---


[GitHub] zookeeper pull request #572: ZOOKEEPER-3085 define exit codes in enum

2018-07-30 Thread nkalmar
Github user nkalmar commented on a diff in the pull request:

https://github.com/apache/zookeeper/pull/572#discussion_r206045238
  
--- Diff: src/java/main/org/apache/zookeeper/server/ExitCode.java ---
@@ -20,8 +20,35 @@
 /**
  * Exit code used to exit server
  */
-public class ExitCode {
+public enum ExitCode {
+
+/* Execution finished normally */
+EXECUTION_FINISHED(0),
+/* Unexpected errors like IO Exceptions */
+UNEXPECTED_ERROR(1),
+/* Invalid arguments during invocations */
+INVALID_INVOCATION(2),
+/* Cannot access datadir when trying to replicate server */
+UNABLE_TO_ACCESS_DATADIR(3),
+/* Unable to start admin server at ZooKeeper startup */
+ERROR_STARTING_ADMIN_SERVER(4),
+/* Severe error during snapshot IO */
+TXNLOG_ERROR_TAKING_SNAPSHOT(10),
+/* zxid from COMMIT does not match the one from pendingTxns queue */
+UNMATCHED_TXN_COMMIT(12),
+/* Unexpected packet from leader, or unable to truncate log on 
Leader.TRUNC */
+QUORUM_PACKET_ERROR(13),
+/* Unable to bind to the quorum (election) port after multiple retry */
+UNABLE_TO_BIND_QUORUM_PORT(14);
+
+private final int value;
+
+ExitCode(final int newValue) {
+value = newValue;
+}
+
+public int getValue() {
--- End diff --

No, I will write them. Thanks!


---


[GitHub] zookeeper pull request #572: ZOOKEEPER-3085 define exit codes in enum

2018-07-27 Thread pravsingh
Github user pravsingh commented on a diff in the pull request:

https://github.com/apache/zookeeper/pull/572#discussion_r205901936
  
--- Diff: src/java/main/org/apache/zookeeper/server/ExitCode.java ---
@@ -20,8 +20,35 @@
 /**
  * Exit code used to exit server
  */
-public class ExitCode {
+public enum ExitCode {
+
+/* Execution finished normally */
+EXECUTION_FINISHED(0),
+/* Unexpected errors like IO Exceptions */
+UNEXPECTED_ERROR(1),
+/* Invalid arguments during invocations */
+INVALID_INVOCATION(2),
+/* Cannot access datadir when trying to replicate server */
+UNABLE_TO_ACCESS_DATADIR(3),
+/* Unable to start admin server at ZooKeeper startup */
+ERROR_STARTING_ADMIN_SERVER(4),
+/* Severe error during snapshot IO */
+TXNLOG_ERROR_TAKING_SNAPSHOT(10),
+/* zxid from COMMIT does not match the one from pendingTxns queue */
+UNMATCHED_TXN_COMMIT(12),
+/* Unexpected packet from leader, or unable to truncate log on 
Leader.TRUNC */
+QUORUM_PACKET_ERROR(13),
+/* Unable to bind to the quorum (election) port after multiple retry */
+UNABLE_TO_BIND_QUORUM_PORT(14);
+
+private final int value;
+
+ExitCode(final int newValue) {
+value = newValue;
+}
+
+public int getValue() {
--- End diff --

do we have test cases asserting on the value fields for each of these enums?


---


[GitHub] zookeeper pull request #572: ZOOKEEPER-3085 define exit codes in enum

2018-07-27 Thread pravsingh
Github user pravsingh commented on a diff in the pull request:

https://github.com/apache/zookeeper/pull/572#discussion_r205901511
  
--- Diff: src/java/main/org/apache/zookeeper/server/ExitCode.java ---
@@ -20,8 +20,35 @@
 /**
  * Exit code used to exit server
  */
-public class ExitCode {
+public enum ExitCode {
+
+/* Execution finished normally */
--- End diff --

I would suggest using java doc comment. /***/.


---


[GitHub] zookeeper pull request #572: ZOOKEEPER-3085 define exit codes in enum

2018-07-19 Thread nkalmar
Github user nkalmar commented on a diff in the pull request:

https://github.com/apache/zookeeper/pull/572#discussion_r203643727
  
--- Diff: src/java/main/org/apache/zookeeper/server/ExitCode.java ---
@@ -20,8 +20,35 @@
 /**
  * Exit code used to exit server
  */
-public class ExitCode {
+public enum ExitCode {
+
+/* Execution finished normally */
+EXECUTION_FINISHED(0),
+/* Unexpected errors like IO Exceptions */
+UNEXPECTED_ERROR(1),
+/* Invalid arguments during invocations */
+INVALID_INVOCATION(2),
+/* Cannot access datadir when trying to replicate server */
+UNABLE_TO_ACCESS_DATADIR(3),
+/* Unable to start admin server at ZooKeeper startup */
+ERROR_STARTING_ADMIN_SERVER(4),
+/* Severe error during snapshot IO */
+TXNLOG_ERROR_TAKING_SNAPSHOT(10),
+/* zxid from COMMIT does not match the one from pendingTxns queue */
+INVALID_TXN_COMMIT(12),
--- End diff --

Thanks for the suggestions @lvfangmin , I will commit them soon.


---


[GitHub] zookeeper pull request #572: ZOOKEEPER-3085 define exit codes in enum

2018-07-18 Thread lvfangmin
Github user lvfangmin commented on a diff in the pull request:

https://github.com/apache/zookeeper/pull/572#discussion_r203478133
  
--- Diff: src/java/main/org/apache/zookeeper/server/ExitCode.java ---
@@ -20,8 +20,35 @@
 /**
  * Exit code used to exit server
  */
-public class ExitCode {
+public enum ExitCode {
+
+/* Execution finished normally */
+EXECUTION_FINISHED(0),
+/* Unexpected errors like IO Exceptions */
+UNEXPECTED_ERROR(1),
+/* Invalid arguments during invocations */
+INVALID_INVOCATION(2),
+/* Cannot access datadir when trying to replicate server */
+UNABLE_TO_ACCESS_DATADIR(3),
+/* Unable to start admin server at ZooKeeper startup */
+ERROR_STARTING_ADMIN_SERVER(4),
+/* Severe error during snapshot IO */
+TXNLOG_ERROR_TAKING_SNAPSHOT(10),
+/* zxid from COMMIT does not match the one from pendingTxns queue */
+INVALID_TXN_COMMIT(12),
+/* Unexpected packet from leader, or unable to truncate log on 
Leader.TRUNC */
+QUORUM_PACKET_ERROR(13),
+/* After leaving listener thread, the host cannot join the quorum 
anymore */
+UNABLE_TO_JOIN_QUORUM(14);
--- End diff --

Maybe make it more specific as UNABLE_TO_BIND_QUORUM_PORT.


---


[GitHub] zookeeper pull request #572: ZOOKEEPER-3085 define exit codes in enum

2018-07-18 Thread lvfangmin
Github user lvfangmin commented on a diff in the pull request:

https://github.com/apache/zookeeper/pull/572#discussion_r203477408
  
--- Diff: src/java/main/org/apache/zookeeper/server/ExitCode.java ---
@@ -20,8 +20,35 @@
 /**
  * Exit code used to exit server
  */
-public class ExitCode {
+public enum ExitCode {
+
+/* Execution finished normally */
+EXECUTION_FINISHED(0),
+/* Unexpected errors like IO Exceptions */
+UNEXPECTED_ERROR(1),
+/* Invalid arguments during invocations */
+INVALID_INVOCATION(2),
+/* Cannot access datadir when trying to replicate server */
+UNABLE_TO_ACCESS_DATADIR(3),
+/* Unable to start admin server at ZooKeeper startup */
+ERROR_STARTING_ADMIN_SERVER(4),
+/* Severe error during snapshot IO */
+TXNLOG_ERROR_TAKING_SNAPSHOT(10),
+/* zxid from COMMIT does not match the one from pendingTxns queue */
+INVALID_TXN_COMMIT(12),
--- End diff --

Suggest to change it to more straightforward name like UNMATCHED_TXN_COMMIT.


---


[GitHub] zookeeper pull request #572: ZOOKEEPER-3085 define exit codes in enum

2018-07-16 Thread nkalmar
GitHub user nkalmar opened a pull request:

https://github.com/apache/zookeeper/pull/572

ZOOKEEPER-3085 define exit codes in enum

Define the used exit codes in one enum. contrib projects are excluded, as 
they can have seperate exit codes (and they do use it differently then in core 
ZK).
Some exit codes overlap, but refactoring the exit code used is not backward 
compatible.


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/nkalmar/zookeeper ZOOKEEPER-3085

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/zookeeper/pull/572.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #572


commit d321f44f82c637681bfff28c2de4b6720acd5015
Author: Norbert Kalmar 
Date:   2018-07-15T18:13:01Z

ZOOKEEPER-3085 define exit codes in enum




---