ZooKeeper
  1. ZooKeeper
  2. ZOOKEEPER-682

Event is not processed when the watcher is set to watch "/" if chrooted

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 3.2.2
    • Fix Version/s: 3.3.0
    • Component/s: java client
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      After the event notification response from server is received, the client will convert the server path to the client path if chrooted by:

      event.setPath(serverPath.substring(chrootPath.length());

      If chrootPath and serverPath are the same, then the event's path will be set to a null string.

      But the key of the watcher's map is "/", not a null string, so the watcher will not get notified at all.

      1. ZOOKEEPER-682.patch
        2 kB
        Scott Wang
      2. ZOOKEEPER-682.patch
        0.8 kB
        Scott Wang

        Activity

        Scott Wang created issue -
        Hide
        Scott Wang added a comment -

        Proposed patch attached

        Show
        Scott Wang added a comment - Proposed patch attached
        Scott Wang made changes -
        Field Original Value New Value
        Attachment ZOOKEEPER-682.patch [ 12436994 ]
        Hide
        Patrick Hunt added a comment -

        Blocker for 3.3.0, we should ensure that the c client doesn't have similar issues.

        Show
        Patrick Hunt added a comment - Blocker for 3.3.0, we should ensure that the c client doesn't have similar issues.
        Patrick Hunt made changes -
        Assignee Scott Wang [ lunastorm ]
        Fix Version/s 3.3.0 [ 12313976 ]
        Priority Major [ 3 ] Blocker [ 1 ]
        Hide
        Patrick Hunt added a comment -

        We need to add a test for this case. We should add it to both the c and java.

        Show
        Patrick Hunt added a comment - We need to add a test for this case. We should add it to both the c and java.
        Hide
        Scott Wang added a comment -

        Java test case related to this problem is added to the patch attached.

        The code provides the similar functionality in the c client is investigated:

        The sub_string function checks if server_path and chroot path are the same and returns "/" if they are the same, so it seems that this problem does not occur on the c client.

        However, I don't know how to add the test case of this problem to the test cases in c. Anyone can help?

        Show
        Scott Wang added a comment - Java test case related to this problem is added to the patch attached. The code provides the similar functionality in the c client is investigated: The sub_string function checks if server_path and chroot path are the same and returns "/" if they are the same, so it seems that this problem does not occur on the c client. However, I don't know how to add the test case of this problem to the test cases in c. Anyone can help?
        Scott Wang made changes -
        Attachment ZOOKEEPER-682.patch [ 12437463 ]
        Hide
        Patrick Hunt added a comment -

        Thanks Scott. I looked at the c tests and it looks to me like we are testing this case (reviewer please verify).

        Submitting, let's see how hudson does with this.

        Show
        Patrick Hunt added a comment - Thanks Scott. I looked at the c tests and it looks to me like we are testing this case (reviewer please verify). Submitting, let's see how hudson does with this.
        Patrick Hunt made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Hide
        Hadoop QA added a comment -

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

        +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 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: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h8.grid.sp2.yahoo.net/124/testReport/
        Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h8.grid.sp2.yahoo.net/124/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
        Console output: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h8.grid.sp2.yahoo.net/124/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/12437463/ZOOKEEPER-682.patch against trunk revision 915956. +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 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: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h8.grid.sp2.yahoo.net/124/testReport/ Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h8.grid.sp2.yahoo.net/124/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html Console output: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h8.grid.sp2.yahoo.net/124/console This message is automatically generated.
        Hide
        Mahadev konar added a comment -

        +1 the patch looks good. Pat you are right that the c api already takes care of it and also has a test included for it.

        Show
        Mahadev konar added a comment - +1 the patch looks good. Pat you are right that the c api already takes care of it and also has a test included for it.
        Hide
        Mahadev konar added a comment -

        I just committed this. thanks scott!

        Show
        Mahadev konar added a comment - I just committed this. thanks scott!
        Mahadev konar made changes -
        Hadoop Flags [Reviewed]
        Resolution Fixed [ 1 ]
        Status Patch Available [ 10002 ] Resolved [ 5 ]
        Patrick Hunt made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Scott Wang
            Reporter:
            Scott Wang
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development