You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Patrick Hunt (JIRA)" <ji...@apache.org> on 2008/12/05 01:18:44 UTC

[jira] Created: (ZOOKEEPER-246) review error code definition in both source and docs

review error code definition in both source and docs
----------------------------------------------------

                 Key: ZOOKEEPER-246
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-246
             Project: Zookeeper
          Issue Type: Improvement
          Components: c client, documentation, java client
    Affects Versions: 3.0.1, 3.0.0
            Reporter: Patrick Hunt
            Assignee: Patrick Hunt
            Priority: Minor
             Fix For: 3.1.0


A number of users have mentioned that our use of "calculated" values for error codes makes it very difficult to track error reports from the logs.  In both c/java we have:

int ERROR = 100
int X_ERROR= ERROR + 1
int Y_ERROR= ERROR + 2
etc...

which makes it difficult to grep/search for "101" and find these references. A number of users have mentioned that having non-calculated values (ie X_ERROR=101) would make it easier. 

I personally find calculated constants like this an anti-pattern.

We should convert these values to non-calculated at a minimum, perhaps even redefine them as enums if possible.

Also documentation, esp in the c code (the names btw c and java don't match btw) is lacking. We need to beef up docs in this area.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-246) review error code definition in both source and docs

Posted by "Patrick Hunt (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-246?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Patrick Hunt updated ZOOKEEPER-246:
-----------------------------------

    Status: Patch Available  (was: Open)

> review error code definition in both source and docs
> ----------------------------------------------------
>
>                 Key: ZOOKEEPER-246
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-246
>             Project: Zookeeper
>          Issue Type: Improvement
>          Components: c client, documentation, java client
>    Affects Versions: 3.0.1, 3.0.0
>            Reporter: Patrick Hunt
>            Assignee: Patrick Hunt
>            Priority: Minor
>             Fix For: 3.1.0
>
>         Attachments: ZOOKEEPER-246.patch, ZOOKEEPER-246.patch
>
>
> A number of users have mentioned that our use of "calculated" values for error codes makes it very difficult to track error reports from the logs.  In both c/java we have:
> int ERROR = 100
> int X_ERROR= ERROR + 1
> int Y_ERROR= ERROR + 2
> etc...
> which makes it difficult to grep/search for "101" and find these references. A number of users have mentioned that having non-calculated values (ie X_ERROR=101) would make it easier. 
> I personally find calculated constants like this an anti-pattern.
> We should convert these values to non-calculated at a minimum, perhaps even redefine them as enums if possible.
> Also documentation, esp in the c code (the names btw c and java don't match btw) is lacking. We need to beef up docs in this area.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-246) review error code definition in both source and docs

Posted by "Patrick Hunt (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-246?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Patrick Hunt updated ZOOKEEPER-246:
-----------------------------------

    Attachment: ZOOKEEPER-246.patch

good catch on the dropped method, thought I had kept everything...
also updated the docs per the comment.

> review error code definition in both source and docs
> ----------------------------------------------------
>
>                 Key: ZOOKEEPER-246
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-246
>             Project: Zookeeper
>          Issue Type: Improvement
>          Components: c client, documentation, java client
>    Affects Versions: 3.0.0, 3.0.1
>            Reporter: Patrick Hunt
>            Assignee: Patrick Hunt
>            Priority: Minor
>             Fix For: 3.1.0
>
>         Attachments: ZOOKEEPER-246.patch, ZOOKEEPER-246.patch
>
>
> A number of users have mentioned that our use of "calculated" values for error codes makes it very difficult to track error reports from the logs.  In both c/java we have:
> int ERROR = 100
> int X_ERROR= ERROR + 1
> int Y_ERROR= ERROR + 2
> etc...
> which makes it difficult to grep/search for "101" and find these references. A number of users have mentioned that having non-calculated values (ie X_ERROR=101) would make it easier. 
> I personally find calculated constants like this an anti-pattern.
> We should convert these values to non-calculated at a minimum, perhaps even redefine them as enums if possible.
> Also documentation, esp in the c code (the names btw c and java don't match btw) is lacking. We need to beef up docs in this area.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-246) review error code definition in both source and docs

Posted by "Patrick Hunt (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-246?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Patrick Hunt updated ZOOKEEPER-246:
-----------------------------------

    Attachment: ZOOKEEPER-246.patch

Take a look at this patch.

Notes:
1) I updated forrest docs, javadoc and doxygen (c) doc
2) in c I updated the constants to be non-calculated enum values
this resulted in b/w compatible code, except for the extreme case where the type was specifically tested (changed from int to ZOO_ERROR type), which only was an issue with our CPPUNIT_ASSERT_EQUAL tests - zkfuse client compiled w/o issue. I think this is acceptable, we should release note but not consider this as b/w incompatible change.
3) in java I 
a) deprecated all of the orig int constants (KeeperException.Code class), javadoc points to new constants
b) added new enum constants as non-calc values, names are the same except they are all caps
c) deprecated getCode() in KeeperException  and replaced with code(), return values changed from int to Code

d) I did _not_ change the callbacks, we could do that, but it would be alot of work. ie deprecate the orig callbacks/methods which take these callbacks, and replace them with new versions.


> review error code definition in both source and docs
> ----------------------------------------------------
>
>                 Key: ZOOKEEPER-246
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-246
>             Project: Zookeeper
>          Issue Type: Improvement
>          Components: c client, documentation, java client
>    Affects Versions: 3.0.0, 3.0.1
>            Reporter: Patrick Hunt
>            Assignee: Patrick Hunt
>            Priority: Minor
>             Fix For: 3.1.0
>
>         Attachments: ZOOKEEPER-246.patch
>
>
> A number of users have mentioned that our use of "calculated" values for error codes makes it very difficult to track error reports from the logs.  In both c/java we have:
> int ERROR = 100
> int X_ERROR= ERROR + 1
> int Y_ERROR= ERROR + 2
> etc...
> which makes it difficult to grep/search for "101" and find these references. A number of users have mentioned that having non-calculated values (ie X_ERROR=101) would make it easier. 
> I personally find calculated constants like this an anti-pattern.
> We should convert these values to non-calculated at a minimum, perhaps even redefine them as enums if possible.
> Also documentation, esp in the c code (the names btw c and java don't match btw) is lacking. We need to beef up docs in this area.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-246) review error code definition in both source and docs

Posted by "Patrick Hunt (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-246?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Patrick Hunt updated ZOOKEEPER-246:
-----------------------------------

    Hadoop Flags: [Incompatible change, Reviewed]  (was: [Reviewed])

> review error code definition in both source and docs
> ----------------------------------------------------
>
>                 Key: ZOOKEEPER-246
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-246
>             Project: Zookeeper
>          Issue Type: Improvement
>          Components: c client, documentation, java client
>    Affects Versions: 3.0.0, 3.0.1
>            Reporter: Patrick Hunt
>            Assignee: Patrick Hunt
>            Priority: Minor
>             Fix For: 3.1.0
>
>         Attachments: ZOOKEEPER-246.patch, ZOOKEEPER-246.patch, ZOOKEEPER-246.patch
>
>
> A number of users have mentioned that our use of "calculated" values for error codes makes it very difficult to track error reports from the logs.  In both c/java we have:
> int ERROR = 100
> int X_ERROR= ERROR + 1
> int Y_ERROR= ERROR + 2
> etc...
> which makes it difficult to grep/search for "101" and find these references. A number of users have mentioned that having non-calculated values (ie X_ERROR=101) would make it easier. 
> I personally find calculated constants like this an anti-pattern.
> We should convert these values to non-calculated at a minimum, perhaps even redefine them as enums if possible.
> Also documentation, esp in the c code (the names btw c and java don't match btw) is lacking. We need to beef up docs in this area.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-246) review error code definition in both source and docs

Posted by "Mahadev konar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-246?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mahadev konar updated ZOOKEEPER-246:
------------------------------------

    Attachment: ZOOKEEPER-246.patch

update the patch. the older patch does not apply cleanly after I committed ZOOKEEPER-255. rand the c and java tests. they pass.

> review error code definition in both source and docs
> ----------------------------------------------------
>
>                 Key: ZOOKEEPER-246
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-246
>             Project: Zookeeper
>          Issue Type: Improvement
>          Components: c client, documentation, java client
>    Affects Versions: 3.0.0, 3.0.1
>            Reporter: Patrick Hunt
>            Assignee: Patrick Hunt
>            Priority: Minor
>             Fix For: 3.1.0
>
>         Attachments: ZOOKEEPER-246.patch, ZOOKEEPER-246.patch, ZOOKEEPER-246.patch
>
>
> A number of users have mentioned that our use of "calculated" values for error codes makes it very difficult to track error reports from the logs.  In both c/java we have:
> int ERROR = 100
> int X_ERROR= ERROR + 1
> int Y_ERROR= ERROR + 2
> etc...
> which makes it difficult to grep/search for "101" and find these references. A number of users have mentioned that having non-calculated values (ie X_ERROR=101) would make it easier. 
> I personally find calculated constants like this an anti-pattern.
> We should convert these values to non-calculated at a minimum, perhaps even redefine them as enums if possible.
> Also documentation, esp in the c code (the names btw c and java don't match btw) is lacking. We need to beef up docs in this area.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ZOOKEEPER-246) review error code definition in both source and docs

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12658820#action_12658820 ] 

Hudson commented on ZOOKEEPER-246:
----------------------------------

Integrated in ZooKeeper-trunk #181 (See [http://hudson.zones.apache.org/hudson/job/ZooKeeper-trunk/181/])
    . updating the docs.
. review error code definition in both source and docs. (pat via mahadev)


> review error code definition in both source and docs
> ----------------------------------------------------
>
>                 Key: ZOOKEEPER-246
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-246
>             Project: Zookeeper
>          Issue Type: Improvement
>          Components: c client, documentation, java client
>    Affects Versions: 3.0.0, 3.0.1
>            Reporter: Patrick Hunt
>            Assignee: Patrick Hunt
>            Priority: Minor
>             Fix For: 3.1.0
>
>         Attachments: ZOOKEEPER-246.patch, ZOOKEEPER-246.patch, ZOOKEEPER-246.patch
>
>
> A number of users have mentioned that our use of "calculated" values for error codes makes it very difficult to track error reports from the logs.  In both c/java we have:
> int ERROR = 100
> int X_ERROR= ERROR + 1
> int Y_ERROR= ERROR + 2
> etc...
> which makes it difficult to grep/search for "101" and find these references. A number of users have mentioned that having non-calculated values (ie X_ERROR=101) would make it easier. 
> I personally find calculated constants like this an anti-pattern.
> We should convert these values to non-calculated at a minimum, perhaps even redefine them as enums if possible.
> Also documentation, esp in the c code (the names btw c and java don't match btw) is lacking. We need to beef up docs in this area.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-246) review error code definition in both source and docs

Posted by "Patrick Hunt (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-246?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Patrick Hunt updated ZOOKEEPER-246:
-----------------------------------

    Status: Patch Available  (was: Open)

> review error code definition in both source and docs
> ----------------------------------------------------
>
>                 Key: ZOOKEEPER-246
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-246
>             Project: Zookeeper
>          Issue Type: Improvement
>          Components: c client, documentation, java client
>    Affects Versions: 3.0.1, 3.0.0
>            Reporter: Patrick Hunt
>            Assignee: Patrick Hunt
>            Priority: Minor
>             Fix For: 3.1.0
>
>         Attachments: ZOOKEEPER-246.patch
>
>
> A number of users have mentioned that our use of "calculated" values for error codes makes it very difficult to track error reports from the logs.  In both c/java we have:
> int ERROR = 100
> int X_ERROR= ERROR + 1
> int Y_ERROR= ERROR + 2
> etc...
> which makes it difficult to grep/search for "101" and find these references. A number of users have mentioned that having non-calculated values (ie X_ERROR=101) would make it easier. 
> I personally find calculated constants like this an anti-pattern.
> We should convert these values to non-calculated at a minimum, perhaps even redefine them as enums if possible.
> Also documentation, esp in the c code (the names btw c and java don't match btw) is lacking. We need to beef up docs in this area.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (ZOOKEEPER-246) review error code definition in both source and docs

Posted by "Mahadev konar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12656137#action_12656137 ] 

Mahadev konar commented on ZOOKEEPER-246:
-----------------------------------------

comments:
- the static create method KeeperException.create(int) has been removed. We need to keep it for b/w compatibility.
- also a little bit more doucmentation on APIERROR would help (both c and java) . you can say that all the api errors start from here, all the others are less than this (more explict than just range start). also, mention that this error is not thrown by the server but is just the range start.

> review error code definition in both source and docs
> ----------------------------------------------------
>
>                 Key: ZOOKEEPER-246
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-246
>             Project: Zookeeper
>          Issue Type: Improvement
>          Components: c client, documentation, java client
>    Affects Versions: 3.0.0, 3.0.1
>            Reporter: Patrick Hunt
>            Assignee: Patrick Hunt
>            Priority: Minor
>             Fix For: 3.1.0
>
>         Attachments: ZOOKEEPER-246.patch
>
>
> A number of users have mentioned that our use of "calculated" values for error codes makes it very difficult to track error reports from the logs.  In both c/java we have:
> int ERROR = 100
> int X_ERROR= ERROR + 1
> int Y_ERROR= ERROR + 2
> etc...
> which makes it difficult to grep/search for "101" and find these references. A number of users have mentioned that having non-calculated values (ie X_ERROR=101) would make it easier. 
> I personally find calculated constants like this an anti-pattern.
> We should convert these values to non-calculated at a minimum, perhaps even redefine them as enums if possible.
> Also documentation, esp in the c code (the names btw c and java don't match btw) is lacking. We need to beef up docs in this area.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-246) review error code definition in both source and docs

Posted by "Mahadev konar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-246?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mahadev konar updated ZOOKEEPER-246:
------------------------------------

    Status: Open  (was: Patch Available)

cancelling the patch to address the comments.,

> review error code definition in both source and docs
> ----------------------------------------------------
>
>                 Key: ZOOKEEPER-246
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-246
>             Project: Zookeeper
>          Issue Type: Improvement
>          Components: c client, documentation, java client
>    Affects Versions: 3.0.1, 3.0.0
>            Reporter: Patrick Hunt
>            Assignee: Patrick Hunt
>            Priority: Minor
>             Fix For: 3.1.0
>
>         Attachments: ZOOKEEPER-246.patch
>
>
> A number of users have mentioned that our use of "calculated" values for error codes makes it very difficult to track error reports from the logs.  In both c/java we have:
> int ERROR = 100
> int X_ERROR= ERROR + 1
> int Y_ERROR= ERROR + 2
> etc...
> which makes it difficult to grep/search for "101" and find these references. A number of users have mentioned that having non-calculated values (ie X_ERROR=101) would make it easier. 
> I personally find calculated constants like this an anti-pattern.
> We should convert these values to non-calculated at a minimum, perhaps even redefine them as enums if possible.
> Also documentation, esp in the c code (the names btw c and java don't match btw) is lacking. We need to beef up docs in this area.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (ZOOKEEPER-246) review error code definition in both source and docs

Posted by "Mahadev konar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-246?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mahadev konar updated ZOOKEEPER-246:
------------------------------------

      Resolution: Fixed
    Hadoop Flags: [Reviewed]
          Status: Resolved  (was: Patch Available)

I just committed this. Thanks pat!

> review error code definition in both source and docs
> ----------------------------------------------------
>
>                 Key: ZOOKEEPER-246
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-246
>             Project: Zookeeper
>          Issue Type: Improvement
>          Components: c client, documentation, java client
>    Affects Versions: 3.0.0, 3.0.1
>            Reporter: Patrick Hunt
>            Assignee: Patrick Hunt
>            Priority: Minor
>             Fix For: 3.1.0
>
>         Attachments: ZOOKEEPER-246.patch, ZOOKEEPER-246.patch, ZOOKEEPER-246.patch
>
>
> A number of users have mentioned that our use of "calculated" values for error codes makes it very difficult to track error reports from the logs.  In both c/java we have:
> int ERROR = 100
> int X_ERROR= ERROR + 1
> int Y_ERROR= ERROR + 2
> etc...
> which makes it difficult to grep/search for "101" and find these references. A number of users have mentioned that having non-calculated values (ie X_ERROR=101) would make it easier. 
> I personally find calculated constants like this an anti-pattern.
> We should convert these values to non-calculated at a minimum, perhaps even redefine them as enums if possible.
> Also documentation, esp in the c code (the names btw c and java don't match btw) is lacking. We need to beef up docs in this area.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.