hadoop-zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maha...@apache.org
Subject svn commit: r918810 - in /hadoop/zookeeper/trunk: CHANGES.txt src/java/main/org/apache/zookeeper/ClientCnxn.java src/java/test/org/apache/zookeeper/test/ChrootTest.java
Date Thu, 04 Mar 2010 01:28:42 GMT
Author: mahadev
Date: Thu Mar  4 01:28:41 2010
New Revision: 918810

URL: http://svn.apache.org/viewvc?rev=918810&view=rev
Log:
ZOOKEEPER-682. Event is not processed when the watcher is set to watch "/" if chrooted (Scott
Wang via mahadev)

Modified:
    hadoop/zookeeper/trunk/CHANGES.txt
    hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ClientCnxn.java
    hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ChrootTest.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=918810&r1=918809&r2=918810&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Thu Mar  4 01:28:41 2010
@@ -237,6 +237,9 @@
   ZOOKEEPER-683. LogFormatter fails to parse transactional log files (phunt
   via mahadev)
 
+  ZOOKEEPER-682. Event is not processed when the watcher is set to watch "/"
+  if chrooted (Scott Wang via mahadev)
+
 IMPROVEMENTS:
   ZOOKEEPER-473. cleanup junit tests to eliminate false positives due to
   "socket reuse" and failure to close client (phunt via mahadev)

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ClientCnxn.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ClientCnxn.java?rev=918810&r1=918809&r2=918810&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ClientCnxn.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ClientCnxn.java Thu Mar  4 01:28:41
2010
@@ -744,7 +744,10 @@
                 // convert from a server path to a client path
                 if (chrootPath != null) {
                     String serverPath = event.getPath();
-                    event.setPath(serverPath.substring(chrootPath.length()));
+                    if(serverPath.compareTo(chrootPath)==0)
+                        event.setPath("/");
+                    else
+                        event.setPath(serverPath.substring(chrootPath.length()));
                 }
 
                 WatchedEvent we = new WatchedEvent(event);

Modified: hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ChrootTest.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ChrootTest.java?rev=918810&r1=918809&r2=918810&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ChrootTest.java (original)
+++ hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ChrootTest.java Thu Mar
 4 01:28:41 2010
@@ -84,6 +84,12 @@
 
             MyWatcher w3 = new MyWatcher("/ch2");
             assertNotNull(zk2.exists("/ch2", w3));
+            
+            // set watches on child
+            MyWatcher w4 = new MyWatcher("/ch1");
+            zk1.getChildren("/ch1",w4);
+            MyWatcher w5 = new MyWatcher("/");
+            zk2.getChildren("/",w5);
 
             // check set
             zk1.setData("/ch1", "1".getBytes(), -1);
@@ -110,6 +116,9 @@
 
             // check delete
             zk2.delete("/ch2", -1);
+            assertTrue(w4.matches());
+            assertTrue(w5.matches());
+            
             zk1.delete("/ch1", -1);
             assertNull(zk1.exists("/ch1", false));
             assertNull(zk1.exists("/ch1/ch2", false));



Mime
View raw message