ZooKeeper
  1. ZooKeeper
  2. ZOOKEEPER-1028

In python bindings, zookeeper.set2() should return a stat dict but instead returns None

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 3.3.3
    • Fix Version/s: 3.4.0
    • Component/s: contrib-bindings
    • Labels:
    • Environment:

      All environments.

    • Hadoop Flags:
      Reviewed

      Description

      There is a small bug in the python bindings, specifically with the zookeeper.set2() call. This method should return a stat dictionary, but actually returns None. The fix is a one-character change to zookeeper.c such that the return value is '&stat' rather than 'stat'.

      1. ZOOKEEPER-1028.patch
        1 kB
        Chris Medaglia
      2. ZOOKEEPER-1028.diff
        2 kB
        Ivan Kelly

        Activity

        Hide
        Chris Medaglia added a comment -

        The patch includes the change to zookeeper.c and to get_set_test.py.

        Show
        Chris Medaglia added a comment - The patch includes the change to zookeeper.c and to get_set_test.py.
        Hide
        Chris Medaglia added a comment -

        Could someone do a code review on this prior to me submitting the patch?

        Many thanks,
        Chris

        Show
        Chris Medaglia added a comment - Could someone do a code review on this prior to me submitting the patch? Many thanks, Chris
        Hide
        Mahadev konar added a comment -

        chris, 3.4.0 is the upcoming release, so I marked this fix for 3.4. Would that work?

        Show
        Mahadev konar added a comment - chris, 3.4.0 is the upcoming release, so I marked this fix for 3.4. Would that work?
        Hide
        Mahadev konar added a comment -

        the patch looks good to me!

        Show
        Mahadev konar added a comment - the patch looks good to me!
        Hide
        Chris Medaglia added a comment -

        Yeah, absolutely!! I wasn't sure what to put for versions, so I just picked something after 3.3.3.

        Thanks for reviewing, I'll go ahead and submit the patch now.

        Show
        Chris Medaglia added a comment - Yeah, absolutely!! I wasn't sure what to put for versions, so I just picked something after 3.3.3. Thanks for reviewing, I'll go ahead and submit the patch now.
        Hide
        Hadoop QA added a comment -

        +1 overall. Here are the results of testing the latest attachment
        http://issues.apache.org/jira/secure/attachment/12474554/ZOOKEEPER-1028.patch
        against trunk revision 1082362.

        +1 @author. The patch does not contain any @author tags.

        +1 tests included. The patch appears to include 3 new or modified tests.

        +1 javadoc. The javadoc tool did not generate any warning messages.

        +1 javac. The applied patch does not increase the total number of javac compiler warnings.

        +1 findbugs. The patch does not introduce any new Findbugs (version 1.3.9) warnings.

        +1 release audit. The applied patch does not increase the total number of release audit warnings.

        +1 core tests. The patch passed core unit tests.

        +1 contrib tests. The patch passed contrib unit tests.

        Test results: https://hudson.apache.org/hudson/job/PreCommit-ZOOKEEPER-Build/207//testReport/
        Findbugs warnings: https://hudson.apache.org/hudson/job/PreCommit-ZOOKEEPER-Build/207//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
        Console output: https://hudson.apache.org/hudson/job/PreCommit-ZOOKEEPER-Build/207//console

        This message is automatically generated.

        Show
        Hadoop QA added a comment - +1 overall. Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12474554/ZOOKEEPER-1028.patch against trunk revision 1082362. +1 @author. The patch does not contain any @author tags. +1 tests included. The patch appears to include 3 new or modified tests. +1 javadoc. The javadoc tool did not generate any warning messages. +1 javac. The applied patch does not increase the total number of javac compiler warnings. +1 findbugs. The patch does not introduce any new Findbugs (version 1.3.9) warnings. +1 release audit. The applied patch does not increase the total number of release audit warnings. +1 core tests. The patch passed core unit tests. +1 contrib tests. The patch passed contrib unit tests. Test results: https://hudson.apache.org/hudson/job/PreCommit-ZOOKEEPER-Build/207//testReport/ Findbugs warnings: https://hudson.apache.org/hudson/job/PreCommit-ZOOKEEPER-Build/207//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html Console output: https://hudson.apache.org/hudson/job/PreCommit-ZOOKEEPER-Build/207//console This message is automatically generated.
        Hide
        Ivan Kelly added a comment -

        This fix is wrong.

        Compilation gives a warning about invalid type being passed.

        A good fix would be to change "struct Stat *stat = NULL"; to "struct Stat;" and pass &stat to zoo_set2. I've attached a patch to this effect. The current implementation passes a NULL pointer to zoo_set2, which means the stat never gets set.

        Show
        Ivan Kelly added a comment - This fix is wrong. Compilation gives a warning about invalid type being passed. A good fix would be to change "struct Stat *stat = NULL"; to "struct Stat;" and pass &stat to zoo_set2. I've attached a patch to this effect. The current implementation passes a NULL pointer to zoo_set2, which means the stat never gets set.
        Hide
        Hadoop QA added a comment -

        +1 overall. Here are the results of testing the latest attachment
        http://issues.apache.org/jira/secure/attachment/12474959/ZOOKEEPER-1028.diff
        against trunk revision 1082362.

        +1 @author. The patch does not contain any @author tags.

        +1 tests included. The patch appears to include 3 new or modified tests.

        +1 javadoc. The javadoc tool did not generate any warning messages.

        +1 javac. The applied patch does not increase the total number of javac compiler warnings.

        +1 findbugs. The patch does not introduce any new Findbugs (version 1.3.9) warnings.

        +1 release audit. The applied patch does not increase the total number of release audit warnings.

        +1 core tests. The patch passed core unit tests.

        +1 contrib tests. The patch passed contrib unit tests.

        Test results: https://hudson.apache.org/hudson/job/PreCommit-ZOOKEEPER-Build/210//testReport/
        Findbugs warnings: https://hudson.apache.org/hudson/job/PreCommit-ZOOKEEPER-Build/210//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
        Console output: https://hudson.apache.org/hudson/job/PreCommit-ZOOKEEPER-Build/210//console

        This message is automatically generated.

        Show
        Hadoop QA added a comment - +1 overall. Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12474959/ZOOKEEPER-1028.diff against trunk revision 1082362. +1 @author. The patch does not contain any @author tags. +1 tests included. The patch appears to include 3 new or modified tests. +1 javadoc. The javadoc tool did not generate any warning messages. +1 javac. The applied patch does not increase the total number of javac compiler warnings. +1 findbugs. The patch does not introduce any new Findbugs (version 1.3.9) warnings. +1 release audit. The applied patch does not increase the total number of release audit warnings. +1 core tests. The patch passed core unit tests. +1 contrib tests. The patch passed contrib unit tests. Test results: https://hudson.apache.org/hudson/job/PreCommit-ZOOKEEPER-Build/210//testReport/ Findbugs warnings: https://hudson.apache.org/hudson/job/PreCommit-ZOOKEEPER-Build/210//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html Console output: https://hudson.apache.org/hudson/job/PreCommit-ZOOKEEPER-Build/210//console This message is automatically generated.
        Hide
        Chris Medaglia added a comment -

        Hmm, sorry about that. When I made that change, the function returned the stat dict properly, whereas prior to the change, it just returned None. Thanks for taking a closer look and finding a better solution.

        Show
        Chris Medaglia added a comment - Hmm, sorry about that. When I made that change, the function returned the stat dict properly, whereas prior to the change, it just returned None. Thanks for taking a closer look and finding a better solution.
        Hide
        Mahadev konar added a comment -

        I just committed this to trunk. Thanks Ivan and Chris.

        Show
        Mahadev konar added a comment - I just committed this to trunk. Thanks Ivan and Chris.
        Hide
        Hudson added a comment -

        Integrated in ZooKeeper-trunk #1146 (See https://hudson.apache.org/hudson/job/ZooKeeper-trunk/1146/)
        ZOOKEEPER-1028. In python bindings, zookeeper.set2() should return a stat dict but instead returns None. (Chris Medaglia and Ivan Kelly via mahadev)

        Show
        Hudson added a comment - Integrated in ZooKeeper-trunk #1146 (See https://hudson.apache.org/hudson/job/ZooKeeper-trunk/1146/ ) ZOOKEEPER-1028 . In python bindings, zookeeper.set2() should return a stat dict but instead returns None. (Chris Medaglia and Ivan Kelly via mahadev)

          People

          • Assignee:
            Chris Medaglia
            Reporter:
            Chris Medaglia
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 1h
              1h
              Remaining:
              Remaining Estimate - 1h
              1h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development