svn commit: r680431 - in /hadoop/zookeeper/trunk/src/java: ChangeLog OldChangeLog main/org/apache/zookeeper/ZooKeeper.java

2008-07-28 Thread mahadev
Author: mahadev
Date: Mon Jul 28 11:19:53 2008
New Revision: 680431

URL: http://svn.apache.org/viewvc?rev=680431view=rev
Log:
ZOOKEEPER-105. Catch Zookeeper exceptions and print on the stderr. (Anthony 
Urso via Mahadev)

Added:
hadoop/zookeeper/trunk/src/java/OldChangeLog
  - copied unchanged from r680424, hadoop/zookeeper/trunk/src/java/ChangeLog
Removed:
hadoop/zookeeper/trunk/src/java/ChangeLog
Modified:
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java?rev=680431r1=680430r2=680431view=diff
==
--- hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java 
(original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java 
Mon Jul 28 11:19:53 2008
@@ -1036,45 +1036,51 @@
 String path = args[2];
 ListACL acl = Ids.OPEN_ACL_UNSAFE;
 System.out.println(Processing  + cmd);
-if (cmd.equals(create)  args.length = 4) {
-if (args.length == 5) {
-acl = parseACLs(args[4]);
-}
-String newPath = zooKeeper.create(path, args[3].getBytes(), acl, 
0);
-System.err.println(Created  + newPath);
-} else if (cmd.equals(delete)  args.length = 3) {
-zooKeeper.delete(path, watch ? Integer.parseInt(args[3]) : -1);
-} else if (cmd.equals(set)  args.length = 4) {
-stat = zooKeeper.setData(path, args[3].getBytes(),
-args.length  4 ? Integer.parseInt(args[4]) : -1);
-printStat(stat);
-} else if (cmd.equals(aget)  args.length = 3) {
-zooKeeper.getData(path, watch, dataCallback, path);
-} else if (cmd.equals(get)  args.length = 3) {
-byte data[] = zooKeeper.getData(path, watch, stat);
-System.out.println(new String(data));
-printStat(stat);
-} else if (cmd.equals(ls)  args.length = 3) {
-ListString children = zooKeeper.getChildren(path, watch);
-System.out.println(children);
-} else if (cmd.equals(getAcl)  args.length = 2) {
-acl = zooKeeper.getACL(path, stat);
-for (ACL a : acl) {
-System.out.println(a.getId() + : 
-+ getPermString(a.getPerms()));
+try {
+if (cmd.equals(create)  args.length = 4) {
+if (args.length == 5) {
+acl = parseACLs(args[4]);
+}
+String newPath = zooKeeper.create(path, args[3].getBytes(), 
acl, 0);
+System.err.println(Created  + newPath);
+} else if (cmd.equals(delete)  args.length = 3) {
+zooKeeper.delete(path, watch ? Integer.parseInt(args[3]) : -1);
+} else if (cmd.equals(set)  args.length = 4) {
+stat = zooKeeper.setData(path, args[3].getBytes(),
+args.length  4 ? Integer.parseInt(args[4]) : -1);
+printStat(stat);
+} else if (cmd.equals(aget)  args.length = 3) {
+zooKeeper.getData(path, watch, dataCallback, path);
+} else if (cmd.equals(get)  args.length = 3) {
+byte data[] = zooKeeper.getData(path, watch, stat);
+System.out.println(new String(data));
+printStat(stat);
+} else if (cmd.equals(ls)  args.length = 3) {
+ListString children = zooKeeper.getChildren(path, watch);
+System.out.println(children);
+} else if (cmd.equals(getAcl)  args.length = 2) {
+acl = zooKeeper.getACL(path, stat);
+for (ACL a : acl) {
+System.out.println(a.getId() + : 
++ getPermString(a.getPerms()));
+}
+} else if (cmd.equals(setAcl)  args.length = 4) {
+
+stat = zooKeeper.setACL(path, parseACLs(args[3]),
+args.length  4 ? Integer.parseInt(args[4]) : -1);
+printStat(stat);
+} else if (cmd.equals(stat)  args.length = 3) {
+stat = zooKeeper.exists(path, watch);
+printStat(stat);
+} else {
+usage();
 }
-} else if (cmd.equals(setAcl)  args.length = 4) {
 
-stat = zooKeeper.setACL(path, parseACLs(args[3]),
-args.length  4 ? Integer.parseInt(args[4]) : -1);
-printStat(stat);
-} else if (cmd.equals(stat)  args.length = 3) {
-stat = zooKeeper.exists(path, watch);
-printStat(stat);
-} else {
-usage();
-}
-return watch;
+return watch;
+} catch

svn commit: r685678 - /hadoop/zookeeper/trunk/build.xml

2008-08-13 Thread mahadev
Author: mahadev
Date: Wed Aug 13 14:10:30 2008
New Revision: 685678

URL: http://svn.apache.org/viewvc?rev=685678view=rev
Log:
ZOOKEEPER-56. Add clover support to build.xml. (Patrick Hunt via mahadev)

Modified:
hadoop/zookeeper/trunk/build.xml

Modified: hadoop/zookeeper/trunk/build.xml
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/build.xml?rev=685678r1=685677r2=685678view=diff
==
--- hadoop/zookeeper/trunk/build.xml (original)
+++ hadoop/zookeeper/trunk/build.xml Wed Aug 13 14:10:30 2008
@@ -21,8 +21,11 @@
 
 property name=Name value=ZooKeeper /
 property name=name value=zookeeper /
+
+property environment=env/
 
 property name=version value=3.0.0 /
+property name=final.name value=${name}-${version}/
 property name=revision.dir value=${basedir}/.revision /
 property name=revision.properties value=revision.properties /
 property file=${basedir}/src/java/${revision.properties} /
@@ -53,6 +56,9 @@
 property name=test.output value=no /
 property name=test.timeout value=90 /
 property name=test.junit.output.format value=plain /
+property name=test.junit.fork.mode value=perTest /
+property name=test.junit.printsummary value=yes /
+property name=test.junit.haltonfailure value=no /
 property name=config.dir value=${src.dir}/java/test/config /
 property name=test.junit.maxmem value=512m /
 property name=conf.dir value=${basedir}/conf/
@@ -63,6 +69,25 @@
 property name=build.docs value=${build.dir}/docs /
 property name=build.javadoc value=${build.docs}/api /
 
+property name=clover.home location=${env.CLOVER_HOME}/
+property name=clover.jar location=${clover.home}/lib/clover.jar /
+property name=clover.db.dir location=${test.build.dir}/clover/db/
+property name=clover.report.dir
+  location=${test.build.dir}/clover/reports/
+
+available property=clover.present
+   classname=com.cenqua.clover.CloverInstr
+   classpath=${clover.home}/lib/clover.jar/
+
+!-- check if clover reports should be generated --
+condition property=clover.enabled
+  and
+isset property=run.clover/
+isset property=clover.present/
+  /and
+/condition
+
+
 property name=test.cobertura.output.format value=html /
 property name=coveragereport.dir value=${build.dir}/cobertura /
 
@@ -91,6 +116,7 @@
 path id=project.classpath
 fileset dir=${build.classes} /
 pathelement path=${lib.dir}/log4j-1.2.15.jar /
+pathelement path=${clover.jar} /
 /path
 /target
 
@@ -182,7 +208,7 @@
 /copy
 /target
 
-target name=compile depends=compile-main,compile-extra/
+target name=compile depends=clover,compile-main,compile-extra/
 
 target name=test-classpath
   path id=test.classpath
@@ -192,6 +218,7 @@
 fileset dir=${lib.dir}
   include name=*.jar/
 /fileset
+pathelement path=${clover.jar} /
   /path
 /target
 
@@ -251,10 +278,12 @@
 !-- Make zookeeper.jar --
 !-- == --
 target name=jar depends=compile
-java classname=org.apache.zookeeper.Version fork=true 
outputproperty=revision failonerror=true
+java classname=org.apache.zookeeper.Version fork=true
+  outputproperty=revision failonerror=true
 arg value=--revision /
 classpath
 pathelement path=${build.classes} /
+pathelement path=${clover.jar} /
 /classpath
 /java
 exec executable=hostname outputproperty=host.name/
@@ -346,11 +375,14 @@
 /target
 
 target name=junit.run
-junit showoutput=${test.output} printsummary=yes 
haltonfailure=no
-   fork=yes 
-maxmemory=${test.junit.maxmem} dir=${basedir}
-timeout=${test.timeout} errorProperty=tests.failed
-failureProperty=tests.failed
+junit showoutput=${test.output}
+   printsummary=${test.junit.printsummary}
+   haltonfailure=${test.junit.haltonfailure}
+   fork=yes
+   forkmode=${test.junit.fork.mode}
+   maxmemory=${test.junit.maxmem}
+   dir=${basedir} timeout=${test.timeout}
+   errorProperty=tests.failed failureProperty=tests.failed
   sysproperty key=build.test.dir value=${test.tmp.dir} /
   sysproperty key=log4j.configuration
value=file:${basedir}/conf/log4j.properties /
@@ -395,6 +427,50 @@
 !-- Run optional third-party tool targets  --
 !-- == --
 
+!-- clover code coverage --
+target name=clover depends=clover.setup, clover.info 
+description=Instrument the Unit

svn commit: r686389 [2/2] - in /hadoop/zookeeper/trunk/src/java: ./ jmx/org/apache/zookeeper/jmx/server/ main/org/apache/zookeeper/ main/org/apache/zookeeper/server/ main/org/apache/zookeeper/server/q

2008-08-15 Thread mahadev
Modified: 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/OOMTest.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/OOMTest.java?rev=686389r1=686388r2=686389view=diff
==
--- hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/OOMTest.java 
(original)
+++ hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/OOMTest.java 
Fri Aug 15 15:02:28 2008
@@ -18,15 +18,17 @@
 
 package org.apache.zookeeper.test;
 
+import static org.apache.zookeeper.test.ClientBase.CONNECTION_TIMEOUT;
+
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 
 import junit.framework.TestCase;
 
+import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.Watcher;
 import org.apache.zookeeper.ZooKeeper;
-import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.ZooDefs.Ids;
 import org.apache.zookeeper.data.Stat;
 import org.apache.zookeeper.proto.WatcherEvent;
@@ -42,9 +44,7 @@
 // This test takes too long to run!
 if (true)
 return;
-File tmpDir = File.createTempFile(test, .junit);
-tmpDir = new File(tmpDir + .dir);
-tmpDir.mkdirs();
+File tmpDir = ClientBase.createTmpDir();
 // Grab some memory so that it is easier to cause an
 // OOM condition;
 ArrayListbyte[] hog = new ArrayListbyte[]();
@@ -56,10 +56,16 @@
 break;
 }
 }
+ClientBase.setupTestEnv();
 ZooKeeperServer zks = new ZooKeeperServer(tmpDir, tmpDir, 3000);
-NIOServerCnxn.Factory f = new NIOServerCnxn.Factory(33221);
+
+final int PORT = 33221;
+NIOServerCnxn.Factory f = new NIOServerCnxn.Factory(PORT);
 f.startup(zks);
-Thread.sleep(2000);
+assertTrue(waiting for server up,
+   ClientBase.waitForServerUp(127.0.0.1: + PORT,
+  CONNECTION_TIMEOUT));
+
 System.err.println(OOM Stage 0);
 utestPrep();
 System.out.println(Free =  + Runtime.getRuntime().freeMemory()
@@ -90,7 +96,11 @@
 +  total =  + Runtime.getRuntime().totalMemory() +  max = 
 + Runtime.getRuntime().maxMemory());
 hog.get(0)[0] = (byte) 1;
+
 f.shutdown();
+assertTrue(waiting for server down,
+   ClientBase.waitForServerDown(127.0.0.1: + PORT,
+CONNECTION_TIMEOUT));
 }
 
 private void utestExists() throws IOException, InterruptedException, 
KeeperException {

Modified: 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/QuorumTest.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/QuorumTest.java?rev=686389r1=686388r2=686389view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/QuorumTest.java 
(original)
+++ 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/QuorumTest.java 
Fri Aug 15 15:02:28 2008
@@ -24,38 +24,35 @@
 import java.util.ArrayList;
 
 import org.apache.log4j.Logger;
-import org.junit.After;
-import org.junit.Before;
-
 import org.apache.zookeeper.server.quorum.QuorumPeer;
 import org.apache.zookeeper.server.quorum.QuorumStats;
 import org.apache.zookeeper.server.quorum.QuorumPeer.QuorumServer;
+import org.junit.After;
+import org.junit.Before;
 
 public class QuorumTest extends ClientTest {
 private static final Logger LOG = Logger.getLogger(QuorumTest.class);
 
-static File baseTest = new File(System.getProperty(build.test.dir, 
build));
 File s1dir, s2dir, s3dir, s4dir, s5dir;
 QuorumPeer s1, s2, s3, s4, s5;
 @Before
+@Override
 protected void setUp() throws Exception {
-s1dir = File.createTempFile(test, .junit, baseTest);
-s1dir = new File(s1dir + .dir);
-s1dir.mkdirs();
-s2dir = File.createTempFile(test, .junit, baseTest);
-s2dir = new File(s2dir + .dir);
-s2dir.mkdirs();
-s3dir = File.createTempFile(test, .junit, baseTest);
-s3dir = new File(s3dir + .dir);
-s3dir.mkdirs();
-s4dir = File.createTempFile(test, .junit, baseTest);
-s4dir = new File(s4dir + .dir);
-s4dir.mkdirs();
-s5dir = File.createTempFile(test, .junit, baseTest);
-s5dir = new File(s5dir + .dir);
-s5dir.mkdirs();
+LOG.info(STARTING  + getName());
+
+setupTestEnv();
+
+hostPort = 
127.0.0.1:2181,127.0.0.1:2182,127.0.0.1:2183,127.0.0.1:2184,127.0.0.1:2185;
+
+s1dir = ClientBase.createTmpDir();
+s2dir = ClientBase.createTmpDir();
+s3dir = ClientBase.createTmpDir();
+s4dir = ClientBase.createTmpDir();
+s5dir = 

svn commit: r687111 - in /hadoop/zookeeper/trunk/src/java: Changes.txt main/org/apache/jute/Utils.java

2008-08-19 Thread mahadev
Author: mahadev
Date: Tue Aug 19 10:58:30 2008
New Revision: 687111

URL: http://svn.apache.org/viewvc?rev=687111view=rev
Log:
ZOOKEEPER-122. Fix  NPE in jute's Utils.toCSVString. (Anthony Urso via mahadev)

Modified:
hadoop/zookeeper/trunk/src/java/Changes.txt
hadoop/zookeeper/trunk/src/java/main/org/apache/jute/Utils.java

Modified: hadoop/zookeeper/trunk/src/java/Changes.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/Changes.txt?rev=687111r1=687110r2=687111view=diff
==
--- hadoop/zookeeper/trunk/src/java/Changes.txt (original)
+++ hadoop/zookeeper/trunk/src/java/Changes.txt Tue Aug 19 10:58:30 2008
@@ -12,3 +12,6 @@
 
   ZOOKEEPER-111. Significant cleanup of existing tests. (Patrick Hunt via
   mahadev)
+ 
+  ZOOKEEPER-122. Fix  NPE in jute's Utils.toCSVString. (Anthony Urso via
+  mahadev)

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/jute/Utils.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/jute/Utils.java?rev=687111r1=687110r2=687111view=diff
==
--- hadoop/zookeeper/trunk/src/java/main/org/apache/jute/Utils.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/jute/Utils.java Tue Aug 19 
10:58:30 2008
@@ -124,8 +124,10 @@
  * @param s 
  * @return 
  */
-static String toCSVString(String t) {
-String s = t.toString();
+static String toCSVString(String s) {
+if (s == null)
+return ;
+
 StringBuffer sb = new StringBuffer(s.length()+1);
 sb.append('\'');
 int len = s.length();




svn commit: r689359 - in /hadoop/zookeeper/trunk/src/java: Changes.txt main/org/apache/zookeeper/server/quorum/AuthFastLeaderElection.java main/org/apache/zookeeper/server/quorum/FastLeaderElection.ja

2008-08-26 Thread mahadev
Author: mahadev
Date: Tue Aug 26 22:12:19 2008
New Revision: 689359

URL: http://svn.apache.org/viewvc?rev=689359view=rev
Log:
ZOOKEEPER-125. Remove unwanted class declaration in FastLeaderElection. (Flavio 
Paiva Junqueira via mahadev)

Modified:
hadoop/zookeeper/trunk/src/java/Changes.txt

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/AuthFastLeaderElection.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java

Modified: hadoop/zookeeper/trunk/src/java/Changes.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/Changes.txt?rev=689359r1=689358r2=689359view=diff
==
--- hadoop/zookeeper/trunk/src/java/Changes.txt (original)
+++ hadoop/zookeeper/trunk/src/java/Changes.txt Tue Aug 26 22:12:19 2008
@@ -21,3 +21,6 @@
 
  ZOOKEEPER-2. Fix synchronization issues in QuorumPeer and FastLeader
  election. (Flavio Paiva Junqueira via mahadev)
+
+ ZOOKEEPER-125. Remove unwanted class declaration in FastLeaderElection. 
+ (Flavio Paiva Junqueira via mahadev)

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/AuthFastLeaderElection.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/AuthFastLeaderElection.java?rev=689359r1=689358r2=689359view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/AuthFastLeaderElection.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/AuthFastLeaderElection.java
 Tue Aug 26 22:12:19 2008
@@ -727,16 +727,6 @@
 // recvqueue.clear();
 }
 
-public static class ElectionResult {
-public Vote vote;
-
-public int count;
-
-public Vote winner;
-
-public int winningCount;
-}
-
 private void sendNotifications() {
 for (QuorumServer server : self.quorumPeers) {
 InetSocketAddress saddr = new InetSocketAddress(server.addr

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java?rev=689359r1=689358r2=689359view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java
 Tue Aug 26 22:12:19 2008
@@ -410,16 +410,6 @@
 recvqueue.clear();
 }
 
-
-public static class ElectionResult {
-public Vote vote;
-
-public int count;
-
-public Vote winner;
-
-public int winningCount;
-}
 
 /**
  * Send notifications to all peers upon a change in our vote




svn commit: r693912 - in /hadoop/zookeeper/trunk: ./ src/contrib/ src/contrib/zkfuse/ src/java/main/ src/java/main/org/apache/zookeeper/server/ src/java/main/org/apache/zookeeper/server/quorum/ src/ja

2008-09-10 Thread mahadev
Author: mahadev
Date: Wed Sep 10 10:49:26 2008
New Revision: 693912

URL: http://svn.apache.org/viewvc?rev=693912view=rev
Log:
ZOOKEEPER-130. update build.xml to support apache release process.

Added:
hadoop/zookeeper/trunk/src/contrib/build-contrib.xml
hadoop/zookeeper/trunk/src/contrib/build.xml
hadoop/zookeeper/trunk/src/contrib/zkfuse/build.xml
hadoop/zookeeper/trunk/src/java/main/overview.html
Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/build.xml

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/DataTree.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FollowerZooKeeperServer.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Leader.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/OOMTest.java

hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/RecoveryTest.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=693912r1=693911r2=693912view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Wed Sep 10 10:49:26 2008
@@ -58,3 +58,6 @@
  (Flavio Paiva Junqueira via mahadev)
 
  ZOOKEEPER-63. Race condition in client close() operation. (phunt via breed)
+
+ ZOOKEEPER-130. update build.xml to support apache release process. 
+ (phunt via mahadev)

Modified: hadoop/zookeeper/trunk/build.xml
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/build.xml?rev=693912r1=693911r2=693912view=diff
==
--- hadoop/zookeeper/trunk/build.xml (original)
+++ hadoop/zookeeper/trunk/build.xml Wed Sep 10 10:49:26 2008
@@ -64,10 +64,15 @@
 property name=conf.dir value=${basedir}/conf/
 property name=docs.dir value=${basedir}/docs/
 property name=docs.src value=${basedir}/src/docs/
-property name=javadoc.link.java 
value=http://java.sun.com/j2se/${target.jdk}/docs/api/; /
+property name=javadoc.link.java
+  value=http://java.sun.com/j2se/1.5/docs/api/; /
 property name=javadoc.packages value=org.apache.* /
+
 property name=build.docs value=${build.dir}/docs /
 property name=build.javadoc value=${build.docs}/api /
+property name=build.javadoc.dev value=${build.docs}/dev-api/
+
+property name=dist.dir value=${build.dir}/${final.name}/
 
 property name=clover.home location=${env.CLOVER_HOME}/
 property name=clover.jar location=${clover.home}/lib/clover.jar /
@@ -75,10 +80,14 @@
 property name=clover.report.dir
   location=${test.build.dir}/clover/reports/
 
+property name=contrib.dir value=${src.dir}/contrib/
+
 available property=clover.present
classname=com.cenqua.clover.CloverInstr
classpath=${clover.home}/lib/clover.jar/
 
+available file=${c.src.dir}/Makefile property=Makefile.present/
+
 !-- check if clover reports should be generated --
 condition property=clover.enabled
   and
@@ -92,6 +101,20 @@
 property name=coveragereport.dir value=${build.dir}/cobertura /
 
 !-- == --
+!-- Macro definitions  --
+!-- == --
+macrodef name=macro_tar description=Worker Macro for tar
+  attribute name=param.destfile/
+  element name=param.listofitems/
+  sequential
+tar compression=gzip longfile=gnu
+ destfile=@{param.destfile}
+  param.listofitems/
+/tar
+  /sequential
+/macrodef
+
+!-- == --
 !-- Generate and compile the Java files--
 !-- == --
 target name=init
@@ -236,7 +259,10 @@
   condition property=forrest.exec value=forrest.bat else=forrest
os family=windows/
   /condition
-  exec dir=${docs.src} executable=${forrest.home}/bin/${forrest.exec} 
failonerror=true /
+  exec dir=${docs.src} executable=${forrest.home}/bin/forrest
+failonerror=true
+env key=JAVA_HOME value=${java5.home}/
+  /exec
   copy todir=${docs.dir}
 fileset dir=${docs.src}/build/site/ /
   /copy
@@ -244,17 +270,22 @@
  includes=zookeeper-default.xml style=conf/configuration.xsl/
 /target
 
-target name=forrest.check unless=forrest.home
+target name=forrest.check unless=forrest.home depends=java5.check
   fail message='forrest.home' is not defined. Please pass 
-Dforrest.home=lt;base of Apache Forrest installationgt; to Ant on the 
command-line. /
 /target

svn commit: r718434 - in /hadoop/zookeeper/branches/branch-3.0: CHANGES.txt src/java/main/org/apache/zookeeper/server/SyncRequestProcessor.java src/java/test/org/apache/zookeeper/test/DBSizeTest.java

2008-11-17 Thread mahadev
Author: mahadev
Date: Mon Nov 17 15:21:05 2008
New Revision: 718434

URL: http://svn.apache.org/viewvc?rev=718434view=rev
Log:
ZOOKEEPER-212. fix the snapshot to be asynchronous. (mahadev and ben)

Added:

hadoop/zookeeper/branches/branch-3.0/src/java/test/org/apache/zookeeper/test/DBSizeTest.java
Modified:
hadoop/zookeeper/branches/branch-3.0/CHANGES.txt

hadoop/zookeeper/branches/branch-3.0/src/java/main/org/apache/zookeeper/server/SyncRequestProcessor.java

Modified: hadoop/zookeeper/branches/branch-3.0/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.0/CHANGES.txt?rev=718434r1=718433r2=718434view=diff
==
--- hadoop/zookeeper/branches/branch-3.0/CHANGES.txt (original)
+++ hadoop/zookeeper/branches/branch-3.0/CHANGES.txt Mon Nov 17 15:21:05 2008
@@ -7,7 +7,8 @@
 BUGFIXES: 
ZOOKEEPER-223. change default level in root logger to INFO. (pat via
 mahadev) 
-
+   
+   ZOOKEEPER-212. fix the snapshot to be asynchronous. (mahadev and ben)
 
 Release 3.0.0 - 2008-10-21
 

Modified: 
hadoop/zookeeper/branches/branch-3.0/src/java/main/org/apache/zookeeper/server/SyncRequestProcessor.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.0/src/java/main/org/apache/zookeeper/server/SyncRequestProcessor.java?rev=718434r1=718433r2=718434view=diff
==
--- 
hadoop/zookeeper/branches/branch-3.0/src/java/main/org/apache/zookeeper/server/SyncRequestProcessor.java
 (original)
+++ 
hadoop/zookeeper/branches/branch-3.0/src/java/main/org/apache/zookeeper/server/SyncRequestProcessor.java
 Mon Nov 17 15:21:05 2008
@@ -37,6 +37,8 @@
 private LinkedBlockingQueueRequest queuedRequests = new 
LinkedBlockingQueueRequest();
 private RequestProcessor nextProcessor;
 boolean timeToDie = false;
+Thread snapInProcess = null;
+
 /**
  * Transactions that have been written and are waiting to be flushed to
  * disk. Basically this is the list of SyncItems whose callbacks will be
@@ -60,10 +62,6 @@
 start();
 }
 
-private void startSnapshot() throws IOException {
-zks.takeSnapshot();
-}
-
 @Override
 public void run() {
 try {
@@ -89,7 +87,21 @@
 // roll the log
 zks.getLogWriter().rollLog();
 // take a snapshot
-startSnapshot();
+if (snapInProcess != null  
snapInProcess.isAlive()) {
+LOG.warn(Too busy to snap, skipping);
+}
+else {
+snapInProcess = new Thread(Snapshot Thread) {
+public void run() {
+ try {
+ zks.takeSnapshot();
+ } catch(Exception e) {
+ LOG.warn(Unexpected exception, e);
+ }
+}
+};
+snapInProcess.start();
+}
 logCount = 0;
 }
 toFlush.add(si);

Added: 
hadoop/zookeeper/branches/branch-3.0/src/java/test/org/apache/zookeeper/test/DBSizeTest.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.0/src/java/test/org/apache/zookeeper/test/DBSizeTest.java?rev=718434view=auto
==
--- 
hadoop/zookeeper/branches/branch-3.0/src/java/test/org/apache/zookeeper/test/DBSizeTest.java
 (added)
+++ 
hadoop/zookeeper/branches/branch-3.0/src/java/test/org/apache/zookeeper/test/DBSizeTest.java
 Mon Nov 17 15:21:05 2008
@@ -0,0 +1,66 @@
+package org.apache.zookeeper.test;
+
+import java.io.IOException;
+
+import org.apache.zookeeper.AsyncCallback;
+import org.apache.zookeeper.CreateMode;
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.ZooKeeper;
+import org.apache.zookeeper.ZooDefs.Ids;
+import org.junit.Test;
+
+public class DBSizeTest extends ClientBase {
+String snapCount;
+@Override
+protected void setUp() throws Exception {
+// Change the snapcount to happen more often
+snapCount = System.getProperty(zookeeper.snapCount, 1024);
+System.setProperty(zookeeper.snapCount, 10);
+super.setUp();
+}
+
+
+@Override
+protected void tearDown() throws Exception {
+System.setProperty(zookeeper.snapCount, snapCount);
+super.tearDown();
+}
+
+
+// Test that the latency of requests doesn't increase with
+// the size of the database
+@Test
+public void testDBScale

svn commit: r718440 - in /hadoop/zookeeper/trunk: CHANGES.txt docs/zookeeperProgrammers.html docs/zookeeperProgrammers.pdf src/docs/src/documentation/content/xdocs/zookeeperProgrammers.xml

2008-11-17 Thread mahadev
Author: mahadev
Date: Mon Nov 17 15:48:37 2008
New Revision: 718440

URL: http://svn.apache.org/viewvc?rev=718440view=rev
Log:
ZOOKEEPER-213. fix programmer guide C api docs to be  in sync with latest 
zookeeper.h (pat via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/docs/zookeeperProgrammers.html
hadoop/zookeeper/trunk/docs/zookeeperProgrammers.pdf

hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperProgrammers.xml

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=718440r1=718439r2=718440view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Mon Nov 17 15:48:37 2008
@@ -10,6 +10,9 @@

ZOOKEEPER-212. fix the snapshot to be asynchronous. (mahadev and ben)
 
+   ZOOKEEPER-213. fix programmer guide C api docs to be  in sync with latest
+zookeeper.h (pat via mahadev)
+
 Release 3.0.0 - 2008-10-21
 
 Non-backward compatible changes:

Modified: hadoop/zookeeper/trunk/docs/zookeeperProgrammers.html
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/docs/zookeeperProgrammers.html?rev=718440r1=718439r2=718440view=diff
==
--- hadoop/zookeeper/trunk/docs/zookeeperProgrammers.html (original)
+++ hadoop/zookeeper/trunk/docs/zookeeperProgrammers.html Mon Nov 17 15:48:37 
2008
@@ -240,7 +240,7 @@
 a href=#sc_BuiltinACLSchemesBuiltin ACL Schemes/a
 /li
 li
-a href=#Zookeeper+C+client+APIZookeeper C client API/a
+a href=#ZooKeeper+C+client+APIZooKeeper C client API/a
 /li
 /ul
 /li
@@ -262,7 +262,7 @@
 a href=#InstallationInstallation/a
 /li
 li
-a href=#Using+the+ClientUsing the Client/a
+a href=#Using+the+C+ClientUsing the C Client/a
 /li
 /ul
 /li
@@ -499,7 +499,7 @@
 the watch and then clear the watch. When a watch triggers, ZooKeeper
 sends the client a notification. More information about watches can be
 found in the section 
-   a href=#ch_zkWatchesZookeeper Watches/a.
+   a href=#ch_zkWatchesZooKeeper Watches/a.
 em[tbd]/em
 /p
 a name=N100DA/aa name=Data+Access/a
@@ -926,12 +926,35 @@
 a name=N1023A/aa name=sc_ZooKeeperAccessControl/a
 h2 class=h3ZooKeeper access control using ACLs/h2
 div class=section
-pZooKeeper uses ACLs to control access to its znodes (the data nodes of a 
ZooKeeper data tree). The ACL implementation is quite similar to UNIX file 
access permissions: it employs permission bits to allow/disallow various 
operations against a node and the scope to which the bits apply. Unlike 
standard UNIX permissions, a ZooKeeper node is not limited by the three 
standard scopes for user (owner of the file), group, and world (other). 
ZooKeeper does not have a notion of an owner of a znode. Instead, an ACL 
specifies sets of ids and permissions that are associated with those ids./p
-pZooKeeper supports pluggable authentication schemes. Ids are specified 
using the form emscheme:id/em, where emscheme/em is a the 
authentication scheme that the id corresponds to. For example, 
emhost:host1.corp.com/em is an id for a host named 
emhost1.corp.com/em./p
-pWhen a client connects to ZooKeeper and authenticates itself, ZooKeeper 
associates all the ids that correspond to a client with the clients connection. 
These ids are checked against the ACLs of znodes when a clients tries to access 
a node. ACLs are made up of pairs of em(scheme:expression, perms)/em. The 
format of the emexpression/em is specific to the scheme. For example, the 
pair em(ip:19.22.0.0/16, READ)/em gives the emREAD/em permission to any 
clients with an IP address that starts with 19.22./p
+pZooKeeper uses ACLs to control access to its znodes (the
+data nodes of a ZooKeeper data tree). The ACL implementation is
+quite similar to UNIX file access permissions: it employs
+permission bits to allow/disallow various operations against a
+node and the scope to which the bits apply. Unlike standard UNIX
+permissions, a ZooKeeper node is not limited by the three standard
+scopes for user (owner of the file), group, and world
+(other). ZooKeeper does not have a notion of an owner of a
+znode. Instead, an ACL specifies sets of ids and permissions that
+are associated with those ids./p
+pZooKeeper supports pluggable authentication schemes. Ids are
+specified using the form emscheme:id/em,
+where emscheme/em is a the authentication scheme
+that the id corresponds to. For
+example, emhost:host1.corp.com/em is an id for a
+host named emhost1.corp.com/em./p
+pWhen a client connects to ZooKeeper and authenticates
+itself, ZooKeeper associates all the ids that correspond to a
+client with the clients connection. These ids are checked against
+the ACLs of znodes when a clients tries to access a node

svn commit: r718758 - in /hadoop/zookeeper/trunk: CHANGES.txt docs/zookeeperTutorial.html docs/zookeeperTutorial.pdf src/docs/src/documentation/content/xdocs/zookeeperTutorial.xml

2008-11-18 Thread mahadev
Author: mahadev
Date: Tue Nov 18 15:11:23 2008
New Revision: 718758

URL: http://svn.apache.org/viewvc?rev=718758view=rev
Log:
ZOOKEEPER-218. fix the error in the barrier example code. (pat via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/docs/zookeeperTutorial.html
hadoop/zookeeper/trunk/docs/zookeeperTutorial.pdf

hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperTutorial.xml

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=718758r1=718757r2=718758view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Tue Nov 18 15:11:23 2008
@@ -20,6 +20,8 @@
 
ZOOKEEPER-228. fix apache header missing in DBTest. (mahadev)
 
+   ZOOKEEPER-218. fix the error in the barrier example code. (pat via mahadev)
+
 Release 3.0.0 - 2008-10-21
 
 Non-backward compatible changes:

Modified: hadoop/zookeeper/trunk/docs/zookeeperTutorial.html
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/docs/zookeeperTutorial.html?rev=718758r1=718757r2=718758view=diff
==
--- hadoop/zookeeper/trunk/docs/zookeeperTutorial.html (original)
+++ hadoop/zookeeper/trunk/docs/zookeeperTutorial.html Tue Nov 18 15:11:23 2008
@@ -292,12 +292,12 @@
  * Barrier constructor
  *
  * @param address
- * @param name
+ * @param root
  * @param size
  */
-Barrier(String address, String name, int size) {
+Barrier(String address, String root, int size) {
 super(address);
-this.root = name;
+this.root = root;
 this.size = size;
 
 // Create barrier node
@@ -348,7 +348,7 @@
 
 boolean enter() throws KeeperException, InterruptedException{
 zk.create(root + / + name, new byte[0], Ids.OPEN_ACL_UNSAFE,
-CreateMode.EPHEMERAL);
+CreateMode.EPHEMERAL_SEQUENTIAL);
 while (true) {
 synchronized (mutex) {
 Listlt;Stringgt; list = zk.getChildren(root, true);
@@ -590,12 +590,12 @@
  * Barrier constructor
  *
  * @param address
- * @param name
+ * @param root
  * @param size
  */
-Barrier(String address, String name, int size) {
+Barrier(String address, String root, int size) {
 super(address);
-this.root = name;
+this.root = root;
 this.size = size;
 
 // Create barrier node
@@ -634,7 +634,7 @@
 
 boolean enter() throws KeeperException, InterruptedException{
 zk.create(root + / + name, new byte[0], Ids.OPEN_ACL_UNSAFE,
-CreateMode.EPHEMERAL);
+CreateMode.EPHEMERAL_SEQUENTIAL);
 while (true) {
 synchronized (mutex) {
 Listlt;Stringgt; list = zk.getChildren(root, true);

Modified: hadoop/zookeeper/trunk/docs/zookeeperTutorial.pdf
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/docs/zookeeperTutorial.pdf?rev=718758r1=718757r2=718758view=diff
==
Binary files - no diff available.

Modified: 
hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperTutorial.xml
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperTutorial.xml?rev=718758r1=718757r2=718758view=diff
==
--- 
hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperTutorial.xml
 (original)
+++ 
hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperTutorial.xml
 Tue Nov 18 15:11:23 2008
@@ -125,12 +125,12 @@
  * Barrier constructor
  *
  * @param address
- * @param name
+ * @param root
  * @param size
  */
-Barrier(String address, String name, int size) {
+Barrier(String address, String root, int size) {
 super(address);
-this.root = name;
+this.root = root;
 this.size = size;
 
 // Create barrier node
@@ -182,7 +182,7 @@
 
 boolean enter() throws KeeperException, InterruptedException{
 zk.create(root + / + name, new byte[0], Ids.OPEN_ACL_UNSAFE,
-CreateMode.EPHEMERAL);
+CreateMode.EPHEMERAL_SEQUENTIAL);
 while (true) {
 synchronized (mutex) {
 Listlt;Stringgt; list = zk.getChildren(root, true);
@@ -422,12 +422,12 @@
  * Barrier constructor
  *
  * @param address
- * @param name

svn commit: r724917 - in /hadoop/zookeeper/trunk: CHANGES.txt docs/zookeeperProgrammers.html docs/zookeeperProgrammers.pdf src/docs/src/documentation/content/xdocs/zookeeperProgrammers.xml

2008-12-09 Thread mahadev
Author: mahadev
Date: Tue Dec  9 14:28:49 2008
New Revision: 724917

URL: http://svn.apache.org/viewvc?rev=724917view=rev
Log:
ZOOKEEPER-243. add SEQUENCE flag documentation to the programming guide. 
(patrick hunt via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/docs/zookeeperProgrammers.html
hadoop/zookeeper/trunk/docs/zookeeperProgrammers.pdf

hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperProgrammers.xml

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=724917r1=724916r2=724917view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Tue Dec  9 14:28:49 2008
@@ -55,6 +55,9 @@
ZOOKEEPER-64. Log system env information when initializing server and
 client (pat via mahadev)
 
+   ZOOKEEPER-243. add SEQUENCE flag documentation to the programming guide.
+(patrick hunt via mahadev)
+
 Release 3.0.0 - 2008-10-21
 
 Non-backward compatible changes:

Modified: hadoop/zookeeper/trunk/docs/zookeeperProgrammers.html
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/docs/zookeeperProgrammers.html?rev=724917r1=724916r2=724917view=diff
==
--- hadoop/zookeeper/trunk/docs/zookeeperProgrammers.html (original)
+++ hadoop/zookeeper/trunk/docs/zookeeperProgrammers.html Tue Dec  9 14:28:49 
2008
@@ -201,7 +201,7 @@
 a href=#Ephemeral+NodesEphemeral Nodes/a
 /li
 li
-a href=#Unique+NamingUnique Naming/a
+a href=#Sequence+Nodes+--+Unique+NamingSequence Nodes -- Unique Naming/a
 /li
 /ul
 /li
@@ -308,7 +308,7 @@
 services. It contains conceptual and practical information./p
 pThe first four sections of this guide present higher level
 discussions of various ZooKeeper concepts. These are necessary both for an
-understanding of how Zookeeper works as well how to work with it. It does
+understanding of how ZooKeeper works as well how to work with it. It does
 not contain source code, but it does assume a familiarity with the
 problems associated with distributed computing. The sections in this first
 group are:/p
@@ -496,28 +496,34 @@
 the watch and then clear the watch. When a watch triggers, ZooKeeper
 sends the client a notification. More information about watches can be
 found in the section 
-   a href=#ch_zkWatchesZooKeeper Watches/a.
-em[tbd]/em
-/p
-a name=N100DA/aa name=Data+Access/a
+   a href=#ch_zkWatchesZooKeeper Watches/a./p
+a name=N100D8/aa name=Data+Access/a
 h4Data Access/h4
 pThe data stored at each znode in a namespace is read and written
 atomically. Reads get all the data bytes associated with a znode and a
 write replaces all the data. Each node has an Access Control List
 (ACL) that restricts who can do what./p
-a name=N100E4/aa name=Ephemeral+Nodes/a
+a name=N100E2/aa name=Ephemeral+Nodes/a
 h4Ephemeral Nodes/h4
 pZooKeeper also has the notion of ephemeral nodes. These znodes
 exists as long as the session that created the znode is active. When
 the session ends the znode is deleted. Because of this behavior
 ephemeral znodes are not allowed to have children./p
-a name=N100EE/aa name=Unique+Naming/a
-h4Unique Naming/h4
-pFinally you create a znode, you can request that ZooKeeper
-append a monotonicly increasing counter be appended to the path name
-of the znode to be requested. This counter is unique to the parent
-znode./p
-a name=N100F9/aa name=sc_timeInZk/a
+a name=N100EC/aa name=Sequence+Nodes+--+Unique+Naming/a
+h4Sequence Nodes -- Unique Naming/h4
+pWhen creating a znode you can also request that
+ZooKeeper append a monotonicly increasing counter to the end
+of path. This counter is unique to the parent znode. The
+counter has a format of %010d -- that is 10 digits with 0
+(zero) padding (the counter is formatted in this way to
+simplify sorting), i.e. lt;pathgt;01. See
+a href=recipes.html#sc_recipes_QueuesQueue
+Recipe/a for an example use of this feature. Note: the
+counter used to store the next sequence number is a signed int
+(4bytes) maintained by the parent node, the counter will
+overflow when incremented beyond 2147483647 (resulting in a
+name lt;pathgt;-2147483647)./p
+a name=N100FB/aa name=sc_timeInZk/a
 h3 class=h4Time in ZooKeeper/h3
 pZooKeeper tracks time multiple ways:/p
 ul
@@ -586,7 +592,7 @@
 /li
   
 /ul
-a name=N10131/aa name=sc_zkStatStructure/a
+a name=N10133/aa name=sc_zkStatStructure/a
 h3 class=h4ZooKeeper Stat Structure/h3
 pThe Stat structure for each znode in ZooKeeper is made up of the
   following fields:/p
@@ -721,7 +727,7 @@
 /div
 
   
-a name=N101A3/aa name=ch_zkSessions

svn commit: r726151 - in /hadoop/zookeeper/trunk: CHANGES.txt src/c/src/zookeeper.c src/java/main/org/apache/zookeeper/ZooKeeper.java

2008-12-12 Thread mahadev
Author: mahadev
Date: Fri Dec 12 16:27:22 2008
New Revision: 726151

URL: http://svn.apache.org/viewvc?rev=726151view=rev
Log:
ZOOKEEPER-225. c client should log an info message in zookeeper_init detailing 
connection parameters. (pat via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/src/c/src/zookeeper.c
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=726151r1=726150r2=726151view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Fri Dec 12 16:27:22 2008
@@ -75,6 +75,9 @@
 
ZOOKEEPER-230. Improvements to FLE. (Flavio via mahadev)
 
+   ZOOKEEPER-225. c client should log an info message in zookeeper_init
+detailing connection parameters. (pat via mahadev)
+
 Release 3.0.0 - 2008-10-21
 
 Non-backward compatible changes:

Modified: hadoop/zookeeper/trunk/src/c/src/zookeeper.c
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/src/zookeeper.c?rev=726151r1=726150r2=726151view=diff
==
--- hadoop/zookeeper/trunk/src/c/src/zookeeper.c (original)
+++ hadoop/zookeeper/trunk/src/c/src/zookeeper.c Fri Dec 12 16:27:22 2008
@@ -487,6 +487,16 @@
 {
 log_env();
 
+LOG_INFO((Initiating client connection, host=%s sessionTimeout=%d 
watcher=%p
+   sessionId=0x%llx sessionPasswd=%s context=%p flags=%d,
+  host,
+  recv_timeout,
+  watcher,
+  clientid-client_id,
+  (clientid-passwd == 0 ? null : hidden),
+  context,
+  flags));
+
 int errnosave;
 zhandle_t *zh = calloc(1, sizeof(*zh));
 if (!zh) {

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java?rev=726151r1=726150r2=726151view=diff
==
--- hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java 
(original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java 
Fri Dec 12 16:27:22 2008
@@ -314,13 +314,16 @@
 
 volatile States state;
 
-protected ClientCnxn cnxn;
+protected final ClientCnxn cnxn;
 
 /**
  * @see ZooKeeper(String, int, Watcher, long, byte[])
  */
 public ZooKeeper(String host, int sessionTimeout, Watcher watcher)
 throws IOException {
+LOG.info(Initiating client connection, host= + host
++  sessionTimeout= + sessionTimeout +  watcher= + watcher);
+
 watchManager.defaultWatcher = watcher;
 cnxn = new ClientCnxn(host, sessionTimeout, this, watchManager);
 }
@@ -358,6 +361,13 @@
  */
 public ZooKeeper(String host, int sessionTimeout, Watcher watcher,
 long sessionId, byte[] sessionPasswd) throws IOException {
+LOG.info(Initiating client connection, host= + host
++  sessionTimeout= + sessionTimeout
++  watcher= + watcher
++  sessionId= + sessionId
++  sessionPasswd=
++ (sessionPasswd == null ? null : hidden));
+
 watchManager.defaultWatcher = watcher;
 cnxn = new ClientCnxn(host, sessionTimeout, this, watchManager,
 sessionId, sessionPasswd);




svn commit: r728792 - in /hadoop/zookeeper/trunk: CHANGES.txt src/c/include/zookeeper.h src/c/src/cli.c src/c/src/zookeeper.c src/c/tests/TestClient.cc src/contrib/zkfuse/src/zkadapter.cc

2008-12-22 Thread mahadev
Author: mahadev
Date: Mon Dec 22 13:39:46 2008
New Revision: 728792

URL: http://svn.apache.org/viewvc?rev=728792view=rev
Log:
ZOOKEEPER-255. zoo_set() api does not return stat datastructure. (avery ching 
via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/src/c/include/zookeeper.h
hadoop/zookeeper/trunk/src/c/src/cli.c
hadoop/zookeeper/trunk/src/c/src/zookeeper.c
hadoop/zookeeper/trunk/src/c/tests/TestClient.cc
hadoop/zookeeper/trunk/src/contrib/zkfuse/src/zkadapter.cc

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=728792r1=728791r2=728792view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Mon Dec 22 13:39:46 2008
@@ -2,6 +2,10 @@
   
 Non-backward compatible changes:
 
+BUGFIXES:
+  ZOOKEEPER-255. zoo_set() api does not return stat datastructure. (avery
+ching via mahadev)
+
 Backward compatibile changes:
 
 BUGFIXES: 

Modified: hadoop/zookeeper/trunk/src/c/include/zookeeper.h
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/include/zookeeper.h?rev=728792r1=728791r2=728792view=diff
==
--- hadoop/zookeeper/trunk/src/c/include/zookeeper.h (original)
+++ hadoop/zookeeper/trunk/src/c/include/zookeeper.h Mon Dec 22 13:39:46 2008
@@ -1084,6 +1084,7 @@
  * \param version the expected version of the node. The function will fail if 
  * the actual version of the node does not match the expected version. If -1 
is 
  * used the version check will not take place. 
+ * \param stat if not NULL, will hold the value of stat for the path on return.
  * \return the return code for the function call.
  * ZOK operation completed succesfully
  * ZNONODE the node does not exist.
@@ -1093,9 +1094,8 @@
  * ZINVALIDSTATE - zhandle state is either ZOO_SESSION_EXPIRED_STATE or 
ZOO_AUTH_FAILED_STATE
  * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory
  */
-ZOOAPI int zoo_set(zhandle_t *zh, const char *path, const char *buffer, int 
buflen,
-   int version);
-
+ZOOAPI int zoo_set(zhandle_t *zh, const char *path, const char *buffer,
+   int buflen, int version, struct Stat *stat);
 
 /**
  * \brief lists the children of a node synchronously.

Modified: hadoop/zookeeper/trunk/src/c/src/cli.c
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/src/cli.c?rev=728792r1=728791r2=728792view=diff
==
--- hadoop/zookeeper/trunk/src/c/src/cli.c (original)
+++ hadoop/zookeeper/trunk/src/c/src/cli.c Mon Dec 22 13:39:46 2008
@@ -266,7 +266,8 @@
 rc = zoo_aset(zh, line, ptr, strlen(ptr), -1, my_stat_completion,
 strdup(line));
 } else {
-rc = zoo_set(zh, line, ptr, strlen(ptr), -1);
+struct Stat stat;
+rc = zoo_set(zh, line, ptr, strlen(ptr), -1, stat);
 }
 if (rc) {
 fprintf(stderr, Error %d for %s\n, rc, line);

Modified: hadoop/zookeeper/trunk/src/c/src/zookeeper.c
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/src/zookeeper.c?rev=728792r1=728791r2=728792view=diff
==
--- hadoop/zookeeper/trunk/src/c/src/zookeeper.c (original)
+++ hadoop/zookeeper/trunk/src/c/src/zookeeper.c Mon Dec 22 13:39:46 2008
@@ -492,8 +492,9 @@
   host,
   recv_timeout,
   watcher,
-  clientid-client_id,
-  (clientid-passwd == 0 ? null : hidden),
+  (clientid == 0 ? 0 : clientid-client_id),
+  ((clientid == 0) || (clientid-passwd == 0) ?
+   null : hidden),
   context,
   flags));
 
@@ -2426,7 +2427,7 @@
 }
 
 int zoo_set(zhandle_t *zh, const char *path, const char *buffer, int buflen,
-int version)
+int version, struct Stat *stat)
 {
 struct sync_completion *sc = alloc_sync_completion();
 int rc;
@@ -2437,6 +2438,9 @@
 if(rc==ZOK){
 wait_sync_completion(sc);
 rc = sc-rc;
+if (rc == 0  stat) {
+*stat = sc-u.stat;
+}
 }
 free_sync_completion(sc);
 return rc;

Modified: hadoop/zookeeper/trunk/src/c/tests/TestClient.cc
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/tests/TestClient.cc?rev=728792r1=728791r2=728792view=diff
==
--- hadoop/zookeeper/trunk/src/c/tests/TestClient.cc (original)
+++ hadoop/zookeeper/trunk/src/c/tests/TestClient.cc Mon Dec 22 13:39:46 2008
@@ -390,7 +390,16 @@
 CPPUNIT_ASSERT_MESSAGE(testName, ctxLocal-waitForConnected(zk));
 
 CPPUNIT_ASSERT(ctxLocal-countEvents

svn commit: r728825 - in /hadoop/zookeeper/trunk: ./ src/java/jmx/org/apache/zookeeper/server/ src/java/jmx/org/apache/zookeeper/server/quorum/

2008-12-22 Thread mahadev
Author: mahadev
Date: Mon Dec 22 15:47:51 2008
New Revision: 728825

URL: http://svn.apache.org/viewvc?rev=728825view=rev
Log:
ZOOKEEPER-256. support use of JMX to manage log4j configuration at runtime. 
(pat via mahadev)

Added:

hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/ManagedUtil.java
Modified:
hadoop/zookeeper/trunk/CHANGES.txt

hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/ManagedZooKeeperServerMain.java

hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/quorum/ManagedQuorumPeerMain.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=728825r1=728824r2=728825view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Mon Dec 22 15:47:51 2008
@@ -88,6 +88,9 @@
ZOOKEEPER-246. review error code definition in both source and docs. (pat
 via mahadev)
 
+   ZOOKEEPER-256. support use of JMX to manage log4j configuration at runtime.
+(pat via mahadev)
+
 Release 3.0.0 - 2008-10-21
 
 Non-backward compatible changes:

Added: 
hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/ManagedUtil.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/ManagedUtil.java?rev=728825view=auto
==
--- 
hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/ManagedUtil.java
 (added)
+++ 
hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/ManagedUtil.java
 Mon Dec 22 15:47:51 2008
@@ -0,0 +1,72 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * License); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zookeeper.server;
+
+import java.lang.management.ManagementFactory;
+import java.util.Enumeration;
+
+import javax.management.JMException;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.apache.log4j.LogManager;
+import org.apache.log4j.Logger;
+import org.apache.log4j.jmx.HierarchyDynamicMBean;
+import org.apache.log4j.spi.LoggerRepository;
+
+/**
+ * Shared utilities
+ */
+public class ManagedUtil {
+/**
+ * Register the log4j JMX mbeans. Set environment variable
+ * zookeeper.jmx.log4j.disable to true to disable registration.
+ * @see 
http://logging.apache.org/log4j/1.2/apidocs/index.html?org/apache/log4j/jmx/package-summary.html
+ * @throws JMException if registration fails
+ */
+public static void registerLog4jMBeans() throws JMException {
+if (Boolean.getBoolean(zookeeper.jmx.log4j.disable) == true) {
+return;
+}
+
+MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
+
+// Create and Register the top level Log4J MBean
+HierarchyDynamicMBean hdm = new HierarchyDynamicMBean();
+
+ObjectName mbo = new ObjectName(log4j:hiearchy=default);
+mbs.registerMBean(hdm, mbo);
+
+// Add the root logger to the Hierarchy MBean
+Logger rootLogger = Logger.getRootLogger();
+hdm.addLoggerMBean(rootLogger.getName());
+
+// Get each logger from the Log4J Repository and add it to
+// the Hierarchy MBean created above.
+LoggerRepository r = LogManager.getLoggerRepository();
+Enumeration enumer = r.getCurrentLoggers();
+Logger logger = null;
+
+while (enumer.hasMoreElements()) {
+   logger = (Logger) enumer.nextElement();
+   hdm.addLoggerMBean(logger.getName());
+}
+}
+
+}

Modified: 
hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/ManagedZooKeeperServerMain.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/ManagedZooKeeperServerMain.java?rev=728825r1=728824r2=728825view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/ManagedZooKeeperServerMain.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/ManagedZooKeeperServerMain.java
 Mon Dec 22 15:47:51 2008

svn commit: r737769 - in /hadoop/zookeeper/trunk: CHANGES.txt src/c/README src/c/configure.ac

2009-01-26 Thread mahadev
Author: mahadev
Date: Mon Jan 26 17:56:22 2009
New Revision: 737769

URL: http://svn.apache.org/viewvc?rev=737769view=rev
Log:
ZOOKEEPER-273. Zookeeper c client build should not depend on CPPUNIT. (pat and 
runping via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/src/c/README
hadoop/zookeeper/trunk/src/c/configure.ac

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=737769r1=737768r2=737769view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Mon Jan 26 17:56:22 2009
@@ -65,6 +65,9 @@
  
   ZOOKEEPER-265. remove (deprecate) unused NoSyncConnected from KeeperState.
   (phunt via mahadev)
+
+  ZOOKEEPER-273. Zookeeper c client build should not depend on CPPUNIT. (pat
+and runping via mahadev)
  
 IMPROVEMENTS:


Modified: hadoop/zookeeper/trunk/src/c/README
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/README?rev=737769r1=737768r2=737769view=diff
==
--- hadoop/zookeeper/trunk/src/c/README (original)
+++ hadoop/zookeeper/trunk/src/c/README Mon Jan 26 17:56:22 2009
@@ -53,6 +53,8 @@
   be built, enabled by default
--disable-static   do not build static libraries, enabled by default
--disable-shared   do not build shared libraries, enabled by default
+   --without-cppunit  do not build the test library, enabled by default.
+
 5) do a make or make install to build the libraries and install them. 
Alternatively, you can also build and run a unit test suite (and
you probably should).  Please make sure you have cppunit-1.10.x or

Modified: hadoop/zookeeper/trunk/src/c/configure.ac
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/configure.ac?rev=737769r1=737768r2=737769view=diff
==
--- hadoop/zookeeper/trunk/src/c/configure.ac (original)
+++ hadoop/zookeeper/trunk/src/c/configure.ac Mon Jan 26 17:56:22 2009
@@ -25,7 +25,17 @@
 AC_CONFIG_HEADER([config.h])
 
 # Checks for programs.
-AM_PATH_CPPUNIT(1.10.2)
+AC_ARG_WITH(cppunit,
+[  --without-cppunit   do not use CPPUNIT])
+
+if test $with_cppunit = no ; then
+   CPPUNIT_PATH=No_CPPUNIT
+   CPPUNIT_INCLUDE=
+   CPPUNIT_LIBS=
+else
+   AM_PATH_CPPUNIT(1.10.2)
+fi
+
 AC_PROG_CC
 AM_PROG_CC_C_O
 AC_PROG_CXX




svn commit: r737784 - in /hadoop/zookeeper/trunk: CHANGES.txt src/java/main/org/apache/jute/Utils.java src/java/test/org/apache/zookeeper/server/ToStringTest.java

2009-01-26 Thread mahadev
Author: mahadev
Date: Mon Jan 26 19:21:38 2009
New Revision: 737784

URL: http://svn.apache.org/viewvc?rev=737784view=rev
Log:
ZOOKEEPER-268.  tostring on jute generated objects can cause NPE. (pat via 
mahadev)

Added:

hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/ToStringTest.java
Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/src/java/main/org/apache/jute/Utils.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=737784r1=737783r2=737784view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Mon Jan 26 19:21:38 2009
@@ -68,6 +68,9 @@
 
   ZOOKEEPER-273. Zookeeper c client build should not depend on CPPUNIT. (pat
 and runping via mahadev)
+
+ ZOOKEEPER-268.  tostring on jute generated objects can cause NPE. (pat via
+mahadev)
  
 IMPROVEMENTS:


Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/jute/Utils.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/jute/Utils.java?rev=737784r1=737783r2=737784view=diff
==
--- hadoop/zookeeper/trunk/src/java/main/org/apache/jute/Utils.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/jute/Utils.java Mon Jan 26 
19:21:38 2009
@@ -19,20 +19,17 @@
 package org.apache.jute;
 
 import java.io.ByteArrayOutputStream;
-import java.io.DataInput;
-import java.io.DataOutput;
 import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.nio.charset.CharacterCodingException;
 
 /**
- * Various utility functions for Hadooop record I/O runtime.
+ * Various utility functions for Hadoop record I/O runtime.
  * @author Milind Bhandarkar
  */
 public class Utils {
 
 /** Cannot create a new instance of Utils */
 private Utils() {
+super();
 }

 /**
@@ -56,7 +53,7 @@
 return true;
 }
 
-public static final char[] hexchars = { '0', '1', '2', '3', '4', '5',
+private static final char[] hexchars = { '0', '1', '2', '3', '4', '5',
 '6', '7', '8', '9', 'A', 'B',
 'C', 'D', 'E', 'F' };
 /**
@@ -64,8 +61,10 @@
  * @param s 
  * @return 
  */
-static String toXMLString(String t) {
-String s = t.toString();
+static String toXMLString(String s) {
+if (s == null)
+return ;
+
 StringBuffer sb = new StringBuffer();
 for (int idx = 0; idx  s.length(); idx++) {
   char ch = s.charAt(idx);
@@ -197,9 +196,12 @@
  * @return 
  */
 static String toXMLBuffer(byte barr[]) {
+if (barr == null || barr.length == 0) {
+return ;
+}
 StringBuffer sb = new StringBuffer(2*barr.length);
 for (int idx = 0; idx  barr.length; idx++) {
-sb.append(Integer.toHexString((int)barr[idx]));
+sb.append(Integer.toHexString(barr[idx]));
 }
 return sb.toString();
 }
@@ -231,10 +233,13 @@
  * @return 
  */
 static String toCSVBuffer(byte barr[]) {
-StringBuffer sb = new StringBuffer(barr.length+1);
+if (barr == null || barr.length == 0) {
+return ;
+}
+StringBuffer sb = new StringBuffer(barr.length + 1);
 sb.append('#');
 for(int idx = 0; idx  barr.length; idx++) {
-sb.append(Integer.toHexString((int)barr[idx]));
+sb.append(Integer.toHexString(barr[idx]));
 }
 return sb.toString();
 }

Added: 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/ToStringTest.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/ToStringTest.java?rev=737784view=auto
==
--- 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/ToStringTest.java
 (added)
+++ 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/ToStringTest.java
 Mon Jan 26 19:21:38 2009
@@ -0,0 +1,38 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * License); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express

svn commit: r746067 - in /hadoop/zookeeper/trunk: ./ src/java/main/org/apache/zookeeper/server/ src/java/main/org/apache/zookeeper/server/persistence/ src/java/main/org/apache/zookeeper/server/quorum/

2009-02-19 Thread mahadev
Author: mahadev
Date: Fri Feb 20 00:23:40 2009
New Revision: 746067

URL: http://svn.apache.org/viewvc?rev=746067view=rev
Log:
ZOOKEEPER-308. improve the atomic broadcast performance 3x. (breed via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/FinalRequestProcessor.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/SyncRequestProcessor.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServer.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/persistence/FileTxnLog.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/persistence/FileTxnSnapLog.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/persistence/TxnLog.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/CommitProcessor.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Follower.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FollowerHandler.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Leader.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/SendAckRequestProcessor.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/util/SerializeUtils.java

hadoop/zookeeper/trunk/src/java/systest/org/apache/zookeeper/test/system/GenerateLoad.java

hadoop/zookeeper/trunk/src/java/systest/org/apache/zookeeper/test/system/QuorumPeerInstance.java

hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/FLENewEpochTest.java

hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/RecoveryTest.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=746067r1=746066r2=746067view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Fri Feb 20 00:23:40 2009
@@ -10,6 +10,8 @@
   ZOOKEEPER-303. Bin scripts dont work on a Mac. (tom white via mahadev)
  
 IMPROVEMENTS:
+  ZOOKEEPER-308. improve the atomic broadcast performance 3x. (breed via
+mahadev)
 
 NEW FEATURES:
 

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/FinalRequestProcessor.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/FinalRequestProcessor.java?rev=746067r1=746066r2=746067view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/FinalRequestProcessor.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/FinalRequestProcessor.java
 Fri Feb 20 00:23:40 2009
@@ -88,7 +88,10 @@
 + zks.outstandingChanges.get(0).zxid
 +  is less than current  + request.zxid);
 }
-zks.outstandingChanges.remove(0);
+ZooKeeperServer.ChangeRecord cr = 
zks.outstandingChanges.remove(0);
+if (zks.outstandingChangesForPath.get(cr.path) == cr) {
+zks.outstandingChangesForPath.remove(cr.path);
+}
 }
 if (request.hdr != null) {
 rc = zks.dataTree.processTxn(request.hdr, request.txn);

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java?rev=746067r1=746066r2=746067view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
 Fri Feb 20 00:23:40 2009
@@ -91,6 +91,7 @@
 super(NIOServerCxn.Factory: + port);
 setDaemon(true);
 this.ss = ServerSocketChannel.open();
+ss.socket().setReuseAddress(true);
 ss.socket().bind(new InetSocketAddress(port));
 ss.configureBlocking(false);
 ss.register(selector, SelectionKey.OP_ACCEPT);
@@ -268,6 +269,19 @@
 LinkedListRequest outstanding = new LinkedListRequest();
 
 void sendBuffer(ByteBuffer bb) {
+// We check if write interest here because if it is NOT set, nothing 
is queued, so
+// we can try to send the buffer right away without waking up the 
selector
+if ((sk.interestOps()SelectionKey.OP_WRITE) == 0) {
+try

svn commit: r747224 - in /hadoop/zookeeper/branches/branch-3.1: CHANGES.txt src/java/main/org/apache/zookeeper/server/ZooKeeperServerMain.java

2009-02-23 Thread mahadev
Author: mahadev
Date: Mon Feb 23 23:55:41 2009
New Revision: 747224

URL: http://svn.apache.org/viewvc?rev=747224view=rev
Log:
ZOOKEEPER-326. standalone server ignores tickTime configuration (chris darroch 
via mahadev)

Modified:
hadoop/zookeeper/branches/branch-3.1/CHANGES.txt

hadoop/zookeeper/branches/branch-3.1/src/java/main/org/apache/zookeeper/server/ZooKeeperServerMain.java

Modified: hadoop/zookeeper/branches/branch-3.1/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.1/CHANGES.txt?rev=747224r1=747223r2=747224view=diff
==
--- hadoop/zookeeper/branches/branch-3.1/CHANGES.txt (original)
+++ hadoop/zookeeper/branches/branch-3.1/CHANGES.txt Mon Feb 23 23:55:41 2009
@@ -1,3 +1,20 @@
+Fix release
+
+Non-backward compatible changes:
+
+BUGFIXES:
+
+Backward compatibile changes:
+
+BUGFIXES:
+  
+  ZOOKEEPER-326. standalone server ignores tickTime configuration (chris
+darroch via mahadev)
+
+IMPROVEMENTS:
+
+NEW FEATURES:
+
 Release 3.1.0 - 2009-02-11
   
 Non-backward compatible changes:

Modified: 
hadoop/zookeeper/branches/branch-3.1/src/java/main/org/apache/zookeeper/server/ZooKeeperServerMain.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.1/src/java/main/org/apache/zookeeper/server/ZooKeeperServerMain.java?rev=747224r1=747223r2=747224view=diff
==
--- 
hadoop/zookeeper/branches/branch-3.1/src/java/main/org/apache/zookeeper/server/ZooKeeperServerMain.java
 (original)
+++ 
hadoop/zookeeper/branches/branch-3.1/src/java/main/org/apache/zookeeper/server/ZooKeeperServerMain.java
 Mon Feb 23 23:55:41 2009
@@ -26,6 +26,7 @@
 import org.apache.log4j.Logger;
 import org.apache.zookeeper.jmx.ManagedUtil;
 import org.apache.zookeeper.server.persistence.FileTxnSnapLog;
+import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
 
 /**
  * This class starts and runs a standalone ZooKeeperServer.
@@ -47,7 +48,7 @@
 }
 
 try {
-ServerConfig.parse(args);
+QuorumPeerConfig.parse(args);
 } catch(Exception e) {
 LOG.fatal(Error in config, e);
 LOG.info(USAGE);
@@ -66,6 +67,7 @@
File(ServerConfig.getDataLogDir()),
 new File(ServerConfig.getDataDir()));
zks.setTxnLogFactory(ftxn);
+   zks.setTickTime(QuorumPeerConfig.getTickTime());
return zks;
 }
 });




svn commit: r748642 - in /hadoop/zookeeper/trunk: ./ src/java/main/org/apache/zookeeper/server/ src/java/main/org/apache/zookeeper/server/quorum/

2009-02-27 Thread mahadev
Author: mahadev
Date: Fri Feb 27 19:00:08 2009
New Revision: 748642

URL: http://svn.apache.org/viewvc?rev=748642view=rev
Log:
ZOOKEEPER-330. zookeeper standalone server does not startup with just a port 
and datadir. (chris darroch and mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ServerConfig.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServer.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServerMain.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=748642r1=748641r2=748642view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Fri Feb 27 19:00:08 2009
@@ -8,6 +8,9 @@
 
 BUGFIXES: 
   ZOOKEEPER-303. Bin scripts dont work on a Mac. (tom white via mahadev)
+  
+  ZOOKEEPER-330. zookeeper standalone server does not startup with just a port
+and datadir. (chris darroch and mahadev)
  
 IMPROVEMENTS:
   ZOOKEEPER-308. improve the atomic broadcast performance 3x. (breed via

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ServerConfig.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ServerConfig.java?rev=748642r1=748641r2=748642view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ServerConfig.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ServerConfig.java
 Fri Feb 27 19:00:08 2009
@@ -22,12 +22,15 @@
 private int clientPort;
 private String dataDir;
 private String dataLogDir;
+private int tickTime;
 
-protected ServerConfig(int port, String dataDir,String dataLogDir) {
+protected ServerConfig(int port, String dataDir,String dataLogDir, int 
tickTime) {
 this.clientPort = port;
 this.dataDir = dataDir;
 this.dataLogDir=dataLogDir;
+this.tickTime = tickTime;
 }
+
 protected boolean isStandaloneServer(){
 return true;
 }
@@ -49,16 +52,27 @@
 return instance.isStandaloneServer();
 }
 
+public static int getTickTime() {
+assert instance != null;
+return instance.tickTime;
+}
+
 protected static ServerConfig instance=null;
 
 public static void parse(String[] args) throws Exception {
 if(instance!=null)
 return;
-if (args.length != 2) {
+if (args.length  2) {
 throw new IllegalArgumentException(Invalid usage.);
 }
+int tickTime = ZooKeeperServer.DEFAULT_TICK_TIME;
+if (args.length  2) {
+// the last parameter ticktime is optional
+tickTime = Integer.parseInt(args[2]);
+}
 try {
-  instance=new 
ServerConfig(Integer.parseInt(args[0]),args[1],args[1]);
+  instance=new ServerConfig(Integer.parseInt(args[0]),args[1],
+  args[1], tickTime);
 } catch (NumberFormatException e) {
 throw new IllegalArgumentException(args[0] +  is not a valid port 
number);
 }

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServer.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServer.java?rev=748642r1=748641r2=748642view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServer.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServer.java
 Fri Feb 27 19:00:08 2009
@@ -93,7 +93,7 @@
 }
 }
 
-private static final int DEFAULT_TICK_TIME = 3000;
+public static final int DEFAULT_TICK_TIME = 3000;
 protected int tickTime = DEFAULT_TICK_TIME;
 
 public static final int commitLogCount = 500;

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServerMain.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServerMain.java?rev=748642r1=748641r2=748642view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServerMain.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServerMain.java
 Fri Feb 27 19:00:08 2009
@@ -34,7 +34,7 @@
 public class ZooKeeperServerMain {
 
 private static final Logger LOG = 
Logger.getLogger

svn commit: r750718 - in /hadoop/zookeeper/trunk: CHANGES.txt src/c/src/zk_hashtable.c src/c/src/zk_hashtable.h

2009-03-05 Thread mahadev
Author: mahadev
Date: Fri Mar  6 00:44:48 2009
New Revision: 750718

URL: http://svn.apache.org/viewvc?rev=750718view=rev
Log:
ZOOKEEPER-318. remove locking in zk_hashtable.c or add locking in 
collect_keys() (chris darroch via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/src/c/src/zk_hashtable.c
hadoop/zookeeper/trunk/src/c/src/zk_hashtable.h

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=750718r1=750717r2=750718view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Fri Mar  6 00:44:48 2009
@@ -22,6 +22,9 @@
   (flavio and mahadev) 
 
   ZOOKEEPER-281. autoreconf fails for /zookeeper-3.0.1/src/c/ (phunt)
+
+  ZOOKEEPER-318. remove locking in zk_hashtable.c or add locking in
+collect_keys() (chris darroch via mahadev)
  
 IMPROVEMENTS:
   ZOOKEEPER-308. improve the atomic broadcast performance 3x.

Modified: hadoop/zookeeper/trunk/src/c/src/zk_hashtable.c
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/src/zk_hashtable.c?rev=750718r1=750717r2=750718view=diff
==
--- hadoop/zookeeper/trunk/src/c/src/zk_hashtable.c (original)
+++ hadoop/zookeeper/trunk/src/c/src/zk_hashtable.c Fri Mar  6 00:44:48 2009
@@ -24,25 +24,28 @@
 #include stdlib.h
 #include assert.h
 
-#ifdef THREADED
-#include pthread.h
-#endif
+typedef struct _watcher_object {
+watcher_fn watcher;
+void* context;
+struct _watcher_object* next;
+} watcher_object_t;
+
 
 struct _zk_hashtable {
 struct hashtable* ht;
-#ifdef THREADED
-pthread_mutex_t lock;
-#endif
 };
 
-hashtable_impl* getImpl(zk_hashtable* ht){
-return ht-ht;
-}
-
 struct watcher_object_list {
 watcher_object_t* head;
 };
 
+/* the following functions are for testing only */
+typedef struct hashtable hashtable_impl;
+
+hashtable_impl* getImpl(zk_hashtable* ht){
+return ht-ht;
+}
+
 watcher_object_t* getFirstWatcher(zk_hashtable* ht,const char* path)
 {
 watcher_object_list_t* wl=hashtable_search(ht-ht,(void*)path);
@@ -50,6 +53,7 @@
 return wl-head;
 return 0;
 }
+/* end of testing functions */
 
 watcher_object_t* clone_watcher_object(watcher_object_t* wo)
 {
@@ -76,7 +80,7 @@
 return strcmp((const char*)key1,(const char*)key2)==0;
 }
 
-watcher_object_t* create_watcher_object(watcher_fn watcher,void* ctx)
+static watcher_object_t* create_watcher_object(watcher_fn watcher,void* ctx)
 {
 watcher_object_t* wo=calloc(1,sizeof(watcher_object_t));
 assert(wo);
@@ -110,9 +114,6 @@
 {
 struct _zk_hashtable *ht=calloc(1,sizeof(struct _zk_hashtable));
 assert(ht);
-#ifdef THREADED
-pthread_mutex_init(ht-lock, 0);
-#endif
 ht-ht=create_hashtable(32,string_hash_djb2,string_equal);
 return ht;
 }
@@ -132,25 +133,11 @@
 free(it);
 }
 
-void clean_zk_hashtable(zk_hashtable* ht)
-{
-#ifdef THREADED
-pthread_mutex_lock(ht-lock);
-#endif
-do_clean_hashtable(ht);
-#ifdef THREADED
-pthread_mutex_unlock(ht-lock);
-#endif
-}
-
 void destroy_zk_hashtable(zk_hashtable* ht)
 {
 if(ht!=0){
 do_clean_hashtable(ht);
 hashtable_destroy(ht-ht,0);
-#ifdef THREADED
-pthread_mutex_destroy(ht-lock);
-#endif
 free(ht);
 }
 }
@@ -169,7 +156,8 @@
 return 0;
 }
 
-int add_to_list(watcher_object_list_t **wl, watcher_object_t *wo, int clone)
+static int add_to_list(watcher_object_list_t **wl, watcher_object_t *wo,
+   int clone)
 {
 if (search_watcher(wl, wo)==0) {
 watcher_object_t* cloned=wo;
@@ -223,16 +211,11 @@
 return list;
 }
 
-int insert_watcher_object(zk_hashtable *ht, const char *path, 
watcher_object_t* wo)
+static int insert_watcher_object(zk_hashtable *ht, const char *path,
+ watcher_object_t* wo)
 {
 int res;
-#ifdef THREADED
-pthread_mutex_lock(ht-lock);
-#endif
 res=do_insert_watcher_object(ht,path,wo);
-#ifdef THREADED
-pthread_mutex_unlock(ht-lock);
-#endif
 return res;
 }
 
@@ -260,29 +243,17 @@
 free(it);
 }
 
-void collect_session_watchers(zhandle_t *zh, watcher_object_list_t **list)
+static void collect_session_watchers(zhandle_t *zh,
+ watcher_object_list_t **list)
 {
-#ifdef THREADED
-pthread_mutex_lock(zh-active_node_watchers-lock);
-pthread_mutex_lock(zh-active_exist_watchers-lock);
-pthread_mutex_lock(zh-active_child_watchers-lock);
-#endif
 copy_table(zh-active_node_watchers, *list);
 copy_table(zh-active_exist_watchers, *list);
 copy_table(zh-active_child_watchers, *list);
-#ifdef THREADED
-pthread_mutex_unlock(zh-active_node_watchers-lock);
-pthread_mutex_unlock(zh-active_exist_watchers-lock);
-pthread_mutex_unlock(zh-active_child_watchers-lock);
-#endif

svn commit: r758945 - in /hadoop/zookeeper/trunk: CHANGES.txt build.xml

2009-03-26 Thread mahadev
Author: mahadev
Date: Fri Mar 27 00:38:21 2009
New Revision: 758945

URL: http://svn.apache.org/viewvc?rev=758945view=rev
Log:
ZOOKEEPER-350. to run rats for releaseaudit. (giridharan kesavan via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/build.xml

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=758945r1=758944r2=758945view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Fri Mar 27 00:38:21 2009
@@ -46,6 +46,9 @@
 
   ZOOKEEPER-351. to run checkstyle (giridharan kesavan via mahadev)
 
+  ZOOKEEPER-350. to run rats for releaseaudit. (giridharan kesavan via
+mahadev)
+
 NEW FEATURES:
 
 

Modified: hadoop/zookeeper/trunk/build.xml
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/build.xml?rev=758945r1=758944r2=758945view=diff
==
--- hadoop/zookeeper/trunk/build.xml (original)
+++ hadoop/zookeeper/trunk/build.xml Fri Mar 27 00:38:21 2009
@@ -103,6 +103,10 @@
 property name=test.cobertura.output.format value=html /
 property name=coveragereport.dir value=${build.dir}/cobertura /
 
+!-- rats properties --
+property name=rats_url 
value=http://arat.googlecode.com/files/rat-lib-all-0.5.1.jar; /
+property name=rat.reporting.classname value=rat.Report/
+
 !-- == --
 !-- Macro definitions  --
 !-- == --
@@ -494,6 +498,7 @@
   delete dir=${docs.src}/build/
   delete dir=${src_generated.dir} /
   delete dir=${csrc_generated.dir} /
+  delete file=${lib.dir}/rats.jar /
   delete file=${jar.name} /
   delete dir=${distribution}/
   delete dir=${revision.dir}/
@@ -745,4 +750,18 @@
/path
 /target  
 
+!-- == --
+!-- Perform audit activities for the release   --
+!-- == --
+
+target name=get-rats depends=package description=Downloads the 
release audit tool
+   get src=${rats_url} dest=${lib.dir}/rats.jar usetimestamp=false 
/
+/target
+   
+target name=releaseaudit depends=get-rats description=Release Audit 
activities
+   java classname=${rat.reporting.classname} fork=true 
classpath=${lib.dir}/rats.jar
+   arg value=${build.dir}/${final.name}/
+   /java
+/target
+
 /project




svn commit: r759023 - in /hadoop/zookeeper/trunk: CHANGES.txt src/java/main/org/apache/zookeeper/KeeperException.java src/java/main/org/apache/zookeeper/ZooKeeper.java src/java/main/org/apache/zookeep

2009-03-26 Thread mahadev
Author: mahadev
Date: Fri Mar 27 05:25:26 2009
New Revision: 759023

URL: http://svn.apache.org/viewvc?rev=759023view=rev
Log:
ZOOKEEPER-354.  to fix javadoc warning in the source files. (mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/KeeperException.java
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/upgrade/UpgradeMain.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=759023r1=759022r2=759023view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Fri Mar 27 05:25:26 2009
@@ -55,6 +55,8 @@
   ZOOKEEPER-353. javadoc warnings needs to be fixed. (giridharan kesavan via
 mahadev) 
 
+  ZOOKEEPER-354.  to fix javadoc warning in the source files. (mahadev)
+
 NEW FEATURES:
 
 

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/KeeperException.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/KeeperException.java?rev=759023r1=759022r2=759023view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/KeeperException.java 
(original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/KeeperException.java 
Fri Mar 27 05:25:26 2009
@@ -450,7 +450,7 @@
 }
 
 /**
- *  @see Code.APIERROR
+ *  @see Code#APIERROR
  */
 public static class APIErrorException extends KeeperException {
 public APIErrorException() {
@@ -459,7 +459,7 @@
 }
 
 /**
- *  @see Code.AUTHFAILED
+ *  @see Code#AUTHFAILED
  */
 public static class AuthFailedException extends KeeperException {
 public AuthFailedException() {
@@ -468,7 +468,7 @@
 }
 
 /**
- *  @see Code.BADARGUMENTS
+ *  @see Code#BADARGUMENTS
  */
 public static class BadArgumentsException extends KeeperException {
 public BadArgumentsException() {
@@ -477,7 +477,7 @@
 }
 
 /**
- * @see Code.BADVERSION
+ * @see Code#BADVERSION
  */
 public static class BadVersionException extends KeeperException {
 public BadVersionException() {
@@ -486,7 +486,7 @@
 }
 
 /**
- * @see Code.CONNECTIONLOSS
+ * @see Code#CONNECTIONLOSS
  */
 public static class ConnectionLossException extends KeeperException {
 public ConnectionLossException() {
@@ -495,7 +495,7 @@
 }
 
 /**
- * @see Code.DATAINCONSISTENCY
+ * @see Code#DATAINCONSISTENCY
  */
 public static class DataInconsistencyException extends KeeperException {
 public DataInconsistencyException() {
@@ -504,7 +504,7 @@
 }
 
 /**
- * @see Code.INVALIDACL
+ * @see Code#INVALIDACL
  */
 public static class InvalidACLException extends KeeperException {
 public InvalidACLException() {
@@ -513,7 +513,7 @@
 }
 
 /**
- * @see Code.INVALIDCALLBACK
+ * @see Code#INVALIDCALLBACK
  */
 public static class InvalidCallbackException extends KeeperException {
 public InvalidCallbackException() {
@@ -522,7 +522,7 @@
 }
 
 /**
- * @see Code.MARSHALLINGERROR
+ * @see Code#MARSHALLINGERROR
  */
 public static class MarshallingErrorException extends KeeperException {
 public MarshallingErrorException() {
@@ -531,7 +531,7 @@
 }
 
 /**
- * @see Code.NOAUTH
+ * @see Code#NOAUTH
  */
 public static class NoAuthException extends KeeperException {
 public NoAuthException() {
@@ -540,7 +540,7 @@
 }
 
 /**
- * @see Code.NOCHILDRENFOREPHEMERALS
+ * @see Code#NOCHILDRENFOREPHEMERALS
  */
 public static class NoChildrenForEphemeralsException extends 
KeeperException {
 public NoChildrenForEphemeralsException() {
@@ -549,7 +549,7 @@
 }
 
 /**
- * @see Code.NODEEXISTS
+ * @see Code#NODEEXISTS
  */
 public static class NodeExistsException extends KeeperException {
 public NodeExistsException() {
@@ -558,7 +558,7 @@
 }
 
 /**
- * @see Code.NONODE
+ * @see Code#NONODE
  */
 public static class NoNodeException extends KeeperException {
 public NoNodeException() {
@@ -567,7 +567,7 @@
 }
 
 /**
- * @see Code.NOTEMPTY
+ * @see Code#NOTEMPTY
  */
 public static class NotEmptyException extends KeeperException {
 public NotEmptyException() {
@@ -576,7 +576,7 @@
 }
 
 /**
- * @see Code.OPERATIONTIMEOUT
+ * @see Code#OPERATIONTIMEOUT
  */
 public static class OperationTimeoutException extends KeeperException {
 public OperationTimeoutException() {
@@ -585,7 +585,7

svn commit: r761433 - in /hadoop/zookeeper/trunk: CHANGES.txt build.xml src/c/Makefile.am src/c/configure.ac src/c/tests/LibCSymTable.h src/c/tests/TestClient.cc src/c/tests/zkServer.sh

2009-04-02 Thread mahadev
Author: mahadev
Date: Thu Apr  2 21:28:27 2009
New Revision: 761433

URL: http://svn.apache.org/viewvc?rev=761433view=rev
Log:
ZOOKEEPER-60. Get cppunit tests running as part of Hudson CI. (girish via 
mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/build.xml
hadoop/zookeeper/trunk/src/c/Makefile.am
hadoop/zookeeper/trunk/src/c/configure.ac
hadoop/zookeeper/trunk/src/c/tests/LibCSymTable.h
hadoop/zookeeper/trunk/src/c/tests/TestClient.cc
hadoop/zookeeper/trunk/src/c/tests/zkServer.sh

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=761433r1=761432r2=761433view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Thu Apr  2 21:28:27 2009
@@ -64,6 +64,9 @@
   ZOOKEEPER-305.  Replace timers with semaphores in FLENewEpochTest.
 (flavio via mahadev)
 
+  ZOOKEEPER-60. Get cppunit tests running as part of Hudson CI. (girish via
+mahadev)
+
 NEW FEATURES:
 
 

Modified: hadoop/zookeeper/trunk/build.xml
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/build.xml?rev=761433r1=761432r2=761433view=diff
==
--- hadoop/zookeeper/trunk/build.xml (original)
+++ hadoop/zookeeper/trunk/build.xml Thu Apr  2 21:28:27 2009
@@ -55,6 +55,7 @@
 property name=test.log.dir value=${test.build.dir}/logs /
 property name=test.data.dir value=${test.build.dir}/data /
 property name=test.data.upgrade.dir value=${test.data.dir}/upgrade /
+property name=test.cppunit.dir value=${test.build.dir}/test-cppunit/
 property name=test.tmp.dir value=${test.build.dir}/tmp /
 property name=test.output value=no /
 property name=test.timeout value=90 /
@@ -572,7 +573,43 @@
 fail if=tests.failedTests failed!/fail
 /target
 
+target name=create-cppunit-configure depends=init if=cppunit
+   exec executable=autoreconf dir=${c.src.dir} searchpath=yes 
+   failonerror=yes
+   arg value=-if/
+   /exec
+/target  
 
+target name=check-cppunit-makefile depends=init 
+   condition property=need.cppunit.makefile
+   not available file=${test.cppunit.dir}/Makefile/ 
/not
+   /condition
+/target
+
+target name=create-cppunit-makefile depends=check-cppunit-makefile 
+   if=need.cppunit.makefile
+   mkdir dir=${test.cppunit.dir}/
+   exec executable=${c.src.dir}/configure dir=${test.cppunit.dir}
+   failonerror=yes
+env key=base_dir value=${basedir}/
+env key=CALLER value=ANT/
+   arg value=--prefix=${test.cppunit.dir}/
+   /exec
+/target
+
+target name=test-cppunit depends=compile_jute, jar, 
create-cppunit-makefile if=cppunit 
+   description=to run cppunit test cases
+property name=fuser.bin value=/sbin/
+property name=lib.cppunit value=/usr/local/lib/
+   exec dir=${test.cppunit.dir} executable=make
+   env key=LD_LIBRARY_PATH value=${lib.cppunit}/
+   env key=PATH path=${env.PATH};${c.src.dir};${fuser.bin};/
+env key=CALLER value=ANT/
+env key=base_dir value=${basedir}/
+   arg line=clean run-check/
+   /exec
+/target
+   
 target name=test-unit-category
   property name=test.category value=Unit/
 /target

Modified: hadoop/zookeeper/trunk/src/c/Makefile.am
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/Makefile.am?rev=761433r1=761432r2=761433view=diff
==
--- hadoop/zookeeper/trunk/src/c/Makefile.am (original)
+++ hadoop/zookeeper/trunk/src/c/Makefile.am Thu Apr  2 21:28:27 2009
@@ -1,7 +1,7 @@
 # need this for Doxygen integration
 include $(top_srcdir)/aminclude.am
 
-AM_CPPFLAGS = -Iinclude -Igenerated
+AM_CPPFLAGS = -I${srcdir}/include -I${srcdir}/tests -I${srcdir}/generated
 AM_CFLAGS = -Wall -Werror 
 CXXFLAGS = -Wall -g
 
@@ -65,8 +65,8 @@
 #
 # build and run unit tests
 
-EXTRA_DIST+=$(wildcard tests/*.cc) $(wildcard tests/*.h) \
-tests/wrappers.opt tests/wrappers-mt.opt
+EXTRA_DIST+=$(wildcard ${srcdir}/tests/*.cc) $(wildcard ${srcdir}/tests/*.h) \
+${srcdir}/tests/wrappers.opt ${srcdir}/tests/wrappers-mt.opt
 
 TEST_SOURCES = tests/TestDriver.cc tests/LibCMocks.cc tests/LibCSymTable.cc \
 tests/MocksBase.cc  tests/ZKMocks.cc tests/Util.cc tests/ThreadingUtil.cc \
@@ -74,7 +74,7 @@
 tests/TestOperations.cc tests/TestZookeeperInit.cc \
 tests/TestZookeeperClose.cc tests/TestClient.cc
 
-SYMBOL_WRAPPERS=$(shell cat tests/wrappers.opt)
+SYMBOL_WRAPPERS=$(shell cat ${srcdir}/tests

svn commit: r761816 - in /hadoop/zookeeper/trunk: ./ src/java/main/org/apache/zookeeper/server/quorum/ src/java/test/org/apache/zookeeper/test/

2009-04-03 Thread mahadev
Author: mahadev
Date: Fri Apr  3 22:01:18 2009
New Revision: 761816

URL: http://svn.apache.org/viewvc?rev=761816view=rev
Log:
ZOOKEEPER-362. Issues with FLENewEpochTest. (fix bug in Fast leader election) 
(flavio via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java

hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/FLENewEpochTest.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=761816r1=761815r2=761816view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Fri Apr  3 22:01:18 2009
@@ -35,7 +35,9 @@
   tickTime from config is lost, cannot start quorum (phunt via mahadev)
 
   ZOOKEEPER-360. WeakHashMap in Bookie.java causes NPE (flavio via mahadev)
-
+  
+  ZOOKEEPER-362. Issues with FLENewEpochTest. (fix bug in Fast leader election)
+(flavio via mahadev)
 
 IMPROVEMENTS:
   ZOOKEEPER-308. improve the atomic broadcast performance 3x.

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java?rev=761816r1=761815r2=761816view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java
 Fri Apr  3 22:01:18 2009
@@ -562,6 +562,7 @@
 n.epoch + ,  + self.getId() + ,  + 
self.getPeerState() + 
 ,  + n.state + ,  + n.sid);
 if (n.epoch  logicalclock) {
+LOG.debug(Increasing logical clock:  + n.epoch);
 logicalclock = n.epoch;
 recvset.clear();
 if(totalOrderPredicate(n.leader, n.zxid, self.getId(), 
self.getLastLoggedZxid()))

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java?rev=761816r1=761815r2=761816view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
 Fri Apr  3 22:01:18 2009
@@ -238,13 +238,8 @@
 SendWorker sw = senderWorkerMap.get(sid);
 
 LOG.info(Create new connection to server:  + sid);
-//sw.connect();
 s.socket().close();
-if(sw != null) sw.finish();
-SocketChannel channel = 
SocketChannel.open(self.quorumPeers.get(sid).electionAddr);
-if (channel.isConnected()) {
-initiateConnection(channel, sid);
-}
+connectOne(sid);
 
 } catch (IOException e) {
 LOG.info(Error when closing socket or trying to reopen 
connection: 
@@ -329,7 +324,7 @@
  *  @param sid  server id
  */
 
-void connectOne(long sid){
+synchronized void connectOne(long sid){
 if ((senderWorkerMap.get(sid) == null)) {
 SocketChannel channel;
 try {
@@ -395,13 +390,13 @@
  */
 class Listener extends Thread {
 
-ServerSocketChannel ss = null;
+volatile ServerSocketChannel ss = null;
 /**
  * Sleeps on accept().
  */
 @Override
 public void run() {
-ServerSocketChannel ss = null;
+//ss = null;
 try {
 ss = ServerSocketChannel.open();
 int port = 
self.quorumPeers.get(self.getId()).electionAddr.getPort();
@@ -421,13 +416,17 @@
 receiveConnection(client);
 }
 } catch (IOException e) {
-System.err.println(Listener.run:  + e.getMessage());
+LOG.error(Listener.run:  + e.getMessage());
 }
 }
 
 void halt(){
 try{
-if((ss != null)  (ss.isOpen())) ss.close();
+LOG.debug(Trying to close listener:  + ss);
+if(ss != null)/*  (ss.isOpen()))*/{
+LOG.debug(Closing listener:  + self.getId());
+ss.close();
+}
 } catch

svn commit: r762532 - in /hadoop/zookeeper/trunk: ./ src/java/main/org/apache/zookeeper/ src/java/main/org/apache/zookeeper/server/ src/java/main/org/apache/zookeeper/server/quorum/ src/java/test/org/

2009-04-06 Thread mahadev
Author: mahadev
Date: Mon Apr  6 22:19:05 2009
New Revision: 762532

URL: http://svn.apache.org/viewvc?rev=762532view=rev
Log:
ZOOKEEPER-343. add tests that specifically verify the zkmain and qpmain 
classes. (phunt via mahadev)

Added:

hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/ZooKeeperServerMainTest.java
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/quorum/

hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerMainTest.java
Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeperMain.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ServerConfig.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServerMain.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerMain.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=762532r1=762531r2=762532view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Mon Apr  6 22:19:05 2009
@@ -72,6 +72,9 @@
   ZOOKEEPER-60. Get cppunit tests running as part of Hudson CI. (girish via
 mahadev)
 
+  ZOOKEEPER-343. add tests that specifically verify the zkmain and 
+qpmain classes. (phunt via mahadev)
+
 NEW FEATURES:
 
 

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeperMain.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeperMain.java?rev=762532r1=762531r2=762532view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeperMain.java 
(original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeperMain.java 
Mon Apr  6 22:19:05 2009
@@ -194,6 +194,7 @@
data = zk.getData(quotaPath, false, new Stat());
 } catch(KeeperException.NoNodeException ne) {
 System.err.println(quota does not exist for  + path);
+return true;
 }
 StatsTrack strack = new StatsTrack(new String(data));
 if (bytes  !numNodes) {

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ServerConfig.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ServerConfig.java?rev=762532r1=762531r2=762532view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ServerConfig.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ServerConfig.java
 Mon Apr  6 22:19:05 2009
@@ -18,64 +18,63 @@
 
 package org.apache.zookeeper.server;
 
+import java.util.Arrays;
+
+import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
+import org.apache.zookeeper.server.quorum.QuorumPeerConfig.ConfigException;
+
+/**
+ * Server configuration storage.
+ *
+ * We use this instead of Properties as it's typed.
+ *
+ */
 public class ServerConfig {
-private int clientPort;
-private String dataDir;
-private String dataLogDir;
-private int tickTime;
-
-protected ServerConfig(int port, String dataDir,String dataLogDir, int 
tickTime) {
-this.clientPort = port;
-this.dataDir = dataDir;
-this.dataLogDir=dataLogDir;
-this.tickTime = tickTime;
-}
-
-protected boolean isStandaloneServer(){
-return true;
-}
+protected int clientPort;
+protected String dataDir;
+protected String dataLogDir;
+protected int tickTime = ZooKeeperServer.DEFAULT_TICK_TIME;
 
-public static int getClientPort(){
-assert instance!=null;
-return instance.clientPort;
-}
-public static String getDataDir(){
-assert instance!=null;
-return instance.dataDir;
-}
-public static String getDataLogDir(){
-assert instance!=null;
-return instance.dataLogDir;
-}
-public static boolean isStandalone(){
-assert instance!=null;
-return instance.isStandaloneServer();
-}
-
-public static int getTickTime() {
-assert instance != null;
-return instance.tickTime;
-}
-
-protected static ServerConfig instance=null;
-
-public static void parse(String[] args) throws Exception {
-if(instance!=null)
-return;
-if (args.length  2) {
-throw new IllegalArgumentException(Invalid usage.);
+/**
+ * Parse arguments for server configuration
+ * @param args clientPort dataDir and optional tickTime
+ * @return ServerConfig configured

svn commit: r762602 - in /hadoop/zookeeper/trunk: CHANGES.txt src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/LedgerRecoveryMonitor.java src/contrib/bookkeeper/test/org/apache/bookkeeper/

2009-04-06 Thread mahadev
Author: mahadev
Date: Tue Apr  7 02:43:38 2009
New Revision: 762602

URL: http://svn.apache.org/viewvc?rev=762602view=rev
Log:
ZOOKEEPER-363. NPE when recovering ledger with no hint. (flavio via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt

hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/LedgerRecoveryMonitor.java

hadoop/zookeeper/trunk/src/contrib/bookkeeper/test/org/apache/bookkeeper/test/LedgerRecoveryTest.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=762602r1=762601r2=762602view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Tue Apr  7 02:43:38 2009
@@ -39,6 +39,8 @@
   ZOOKEEPER-362. Issues with FLENewEpochTest. (fix bug in Fast leader election)
 (flavio via mahadev)
 
+  ZOOKEEPER-363. NPE when recovering ledger with no hint. (flavio via mahadev)
+
 IMPROVEMENTS:
   ZOOKEEPER-308. improve the atomic broadcast performance 3x.
   (breed via mahadev)

Modified: 
hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/LedgerRecoveryMonitor.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/LedgerRecoveryMonitor.java?rev=762602r1=762601r2=762602view=diff
==
--- 
hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/LedgerRecoveryMonitor.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/LedgerRecoveryMonitor.java
 Tue Apr  7 02:43:38 2009
@@ -145,8 +145,8 @@
 long readCounter = 0;
 while(notLegitimate){
 readCounter = getNextHint();
-if(readCounter != -1){
-lh.setLast(readCounter - 1);
+if(readCounter  -1){
+lh.setLast(readCounter);
 boolean hasMore = true;
 while(hasMore){
 hasMore = false;

Modified: 
hadoop/zookeeper/trunk/src/contrib/bookkeeper/test/org/apache/bookkeeper/test/LedgerRecoveryTest.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/contrib/bookkeeper/test/org/apache/bookkeeper/test/LedgerRecoveryTest.java?rev=762602r1=762601r2=762602view=diff
==
--- 
hadoop/zookeeper/trunk/src/contrib/bookkeeper/test/org/apache/bookkeeper/test/LedgerRecoveryTest.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/contrib/bookkeeper/test/org/apache/bookkeeper/test/LedgerRecoveryTest.java
 Tue Apr  7 02:43:38 2009
@@ -260,4 +260,89 @@
 
 }
 
+@Test
+public void testEmptyLedgerRecovery(){
+/*
+ * Instantiate BookKeeper object.
+ */
+BookKeeper bk = null;
+try{
+bk = new BookKeeper(HOSTPORT);
+} catch (KeeperException ke){
+LOG.error(Error instantiating BookKeeper, ke);
+fail(ZooKeeper error);
+} catch (IOException ioe){
+LOG.error(ioe);
+fail(Failure due to IOException);
+}
+
+/*
+ * Create ledger.
+ */
+LedgerHandle beforelh = null;
+try{
+beforelh = bk.createLedger(.getBytes());
+} catch (KeeperException ke){
+LOG.error(Error creating a ledger, ke);
+fail(ZooKeeper error);
+} catch (BKException bke){
+LOG.error(BookKeeper error);
+fail(BookKeeper error);
+} catch (InterruptedException ie) {
+LOG.error(ie);
+fail(Failure due to interrupted exception);
+} catch (IOException ioe) {
+LOG.error(ioe);
+fail(Failure due to IO exception);
+}
+
+/*
+ * Write a 1 entry.
+ */
+try{
+String tmp = BookKeeper is cool!;
+for(int i = 0; i  1; i++){
+bk.addEntry(beforelh, tmp.getBytes());
+}
+} catch(InterruptedException e){
+LOG.error(Interrupted when adding entry, e);
+fail(Couldn't finish adding entries);
+}
+
+///*
+// * Sleep.
+// */
+//try{
+//Thread.sleep(2000);
+//} catch(InterruptedException e){
+//LOG.error(Interrupted while sleeping, e);
+//fail(Couldn't finish sleeping);
+//}
+
+/*
+ * Try to open ledger.
+ */
+try{
+LedgerHandle afterlh = bk.openLedger(beforelh.getId(), 
.getBytes());
+
+/*
+ * Check if has recovered properly.
+ */
+assertTrue(Has not recovered correctly:  + afterlh.getLast

svn commit: r763395 - in /hadoop/zookeeper/trunk: CHANGES.txt src/java/main/org/apache/zookeeper/server/quorum/LeaderElection.java src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.jav

2009-04-08 Thread mahadev
Author: mahadev
Date: Wed Apr  8 21:09:42 2009
New Revision: 763395

URL: http://svn.apache.org/viewvc?rev=763395view=rev
Log:
ZOOKEEPER-370. Fix critical problems reported by findbugs. (flavio via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/LeaderElection.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=763395r1=763394r2=763395view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Wed Apr  8 21:09:42 2009
@@ -41,6 +41,8 @@
 
   ZOOKEEPER-363. NPE when recovering ledger with no hint. (flavio via mahadev)
 
+  ZOOKEEPER-370. Fix critical problems reported by findbugs. (flavio via 
mahadev)
+
 IMPROVEMENTS:
   ZOOKEEPER-308. improve the atomic broadcast performance 3x.
   (breed via mahadev)

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/LeaderElection.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/LeaderElection.java?rev=763395r1=763394r2=763395view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/LeaderElection.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/LeaderElection.java
 Wed Apr  8 21:09:42 2009
@@ -39,7 +39,8 @@
 
 public class LeaderElection implements Election  {
 private static final Logger LOG = Logger.getLogger(LeaderElection.class);
-
+private static Random epochGen = new Random();
+
 QuorumPeer self;
 
 public LeaderElection(QuorumPeer self) {
@@ -130,7 +131,7 @@
 responseBytes.length);
 HashMapInetSocketAddress, Vote votes = new 
HashMapInetSocketAddress, Vote(
 self.quorumPeers.size());
-int xid = new Random().nextInt();
+int xid = epochGen.nextInt();
 while (self.running) {
 votes.clear();
 requestBuffer.clear();

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java?rev=763395r1=763394r2=763395view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
 Wed Apr  8 21:09:42 2009
@@ -72,12 +72,7 @@
  * Packet size
  */
 int packetSize;
-
-/*
- * Port to listen on
- */
-int port;
-
+
 /*
  * Challenge to initiate connections
  */
@@ -126,27 +121,11 @@
 this.senderWorkerMap = new ConcurrentHashMapLong, SendWorker();
 this.self = self;
 
-// Generates a challenge to guarantee one connection between pairs of
-// servers
-//genChallenge();
-
 // Starts listener thread that waits for connection requests 
 listener = new Listener();
 listener.start();
 }
 
-void genChallenge() {
-try{
-Random rand = new Random(System.currentTimeMillis()
-+ InetAddress.getLocalHost().hashCode());
-long newValue = rand.nextLong();
-challenge = newValue;
-} catch(UnknownHostException e){
-LOG.error(Cannot resolve local address);
-challenge = 0;
-}
-}
-
 /**
  * If this server has initiated the connection, then it gives up on the
  * connection if it loses challenge. Otherwise, it keeps the connection.
@@ -177,30 +156,25 @@
 }
 // Otherwise proceed with the connection
 } else {
-if (s != null) {
-SendWorker sw = new SendWorker(s, sid);
-RecvWorker rw = new RecvWorker(s, sid);
-sw.setRecv(rw);
-
-if (senderWorkerMap
-.containsKey(sid)) {
-senderWorkerMap.get(sid).finish();
-}
-
-if (!queueSendMap.containsKey(sid)) {
-queueSendMap.put(sid, new 
ArrayBlockingQueueByteBuffer(
-CAPACITY));
-}
+   SendWorker sw = new SendWorker(s, sid);
+   RecvWorker rw = new RecvWorker(s, sid);
+   sw.setRecv(rw);
+   
+   if (senderWorkerMap
+   .containsKey(sid

svn commit: r763435 - in /hadoop/zookeeper/trunk: CHANGES.txt src/contrib/zkfuse/src/zkfuse.cc

2009-04-08 Thread mahadev
Author: mahadev
Date: Wed Apr  8 22:39:10 2009
New Revision: 763435

URL: http://svn.apache.org/viewvc?rev=763435view=rev
Log:
ZOOKEEPER-347. zkfuse uses non-standard String. (patrick hunt via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/src/contrib/zkfuse/src/zkfuse.cc

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=763435r1=763434r2=763435view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Wed Apr  8 22:39:10 2009
@@ -43,6 +43,8 @@
 
   ZOOKEEPER-370. Fix critical problems reported by findbugs. (flavio via 
mahadev)
 
+  ZOOKEEPER-347. zkfuse uses non-standard String. (patrick hunt via mahadev)
+
 IMPROVEMENTS:
   ZOOKEEPER-308. improve the atomic broadcast performance 3x.
   (breed via mahadev)

Modified: hadoop/zookeeper/trunk/src/contrib/zkfuse/src/zkfuse.cc
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/contrib/zkfuse/src/zkfuse.cc?rev=763435r1=763434r2=763435view=diff
==
--- hadoop/zookeeper/trunk/src/contrib/zkfuse/src/zkfuse.cc (original)
+++ hadoop/zookeeper/trunk/src/contrib/zkfuse/src/zkfuse.cc Wed Apr  8 22:39:10 
2009
@@ -4279,7 +4279,7 @@
 /**
  * Initialize log4cxx 
  */
-const String file(log4cxx.properties);
+const std::string file(log4cxx.properties);
 PropertyConfigurator::configureAndWatch( file, 5000 );
 LOG_INFO(LOG, Starting zkfuse);
 




svn commit: r764673 - in /hadoop/zookeeper/trunk: CHANGES.txt build.xml src/c/tests/TestZookeeperInit.cc src/c/tests/zkServer.sh

2009-04-13 Thread mahadev
Author: mahadev
Date: Tue Apr 14 04:55:06 2009
New Revision: 764673

URL: http://svn.apache.org/viewvc?rev=764673view=rev
Log:
ZOOKEEPER-361. integrate cppunit testing as part of hudson patch process. (giri 
via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/build.xml
hadoop/zookeeper/trunk/src/c/tests/TestZookeeperInit.cc
hadoop/zookeeper/trunk/src/c/tests/zkServer.sh

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=764673r1=764672r2=764673view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Tue Apr 14 04:55:06 2009
@@ -84,6 +84,9 @@
   ZOOKEEPER-343. add tests that specifically verify the zkmain and 
 qpmain classes. (phunt via mahadev)
 
+  ZOOKEEPER-361. integrate cppunit testing as part of hudson patch 
+process. (giri via mahadev)
+
 NEW FEATURES:
 
 

Modified: hadoop/zookeeper/trunk/build.xml
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/build.xml?rev=764673r1=764672r2=764673view=diff
==
--- hadoop/zookeeper/trunk/build.xml (original)
+++ hadoop/zookeeper/trunk/build.xml Tue Apr 14 04:55:06 2009
@@ -597,6 +597,17 @@
/exec
 /target
 
+target name=call-test-cppunit description=to execute cppunit tests
+   antcall target=create-cppunit-configure
+   param name=cppunit value=true/
+/antcall
+   antcall target=create-cppunit-makefile/
+   antcall target=test-cppunit
+   param name=cppunit value=true/
+   /antcall
+/target  
+
+
 target name=test-cppunit depends=compile_jute, jar, 
create-cppunit-makefile if=cppunit 
description=to run cppunit test cases
 property name=fuser.bin value=/sbin/
@@ -638,7 +649,7 @@
!-- yet to implement --
 /target
 
-target name=test-core depends=test-init,test-category,junit.run/ 
+target name=test-core depends=test-init, test-category, junit.run, 
call-test-cppunit/ 
 
 !-- == --
 !-- Run optional third-party tool targets  --

Modified: hadoop/zookeeper/trunk/src/c/tests/TestZookeeperInit.cc
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/tests/TestZookeeperInit.cc?rev=764673r1=764672r2=764673view=diff
==
--- hadoop/zookeeper/trunk/src/c/tests/TestZookeeperInit.cc (original)
+++ hadoop/zookeeper/trunk/src/c/tests/TestZookeeperInit.cc Tue Apr 14 04:55:06 
2009
@@ -78,7 +78,7 @@
 
 void testBasic()
 {
-   const string EXPECTED_HOST(localhost:2121);
+   const string EXPECTED_HOST(127.0.0.1:2121);
const int EXPECTED_ADDRS_COUNT =1;
const int EXPECTED_RECV_TIMEOUT=1;
 clientid_t cid;

Modified: hadoop/zookeeper/trunk/src/c/tests/zkServer.sh
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/tests/zkServer.sh?rev=764673r1=764672r2=764673view=diff
==
--- hadoop/zookeeper/trunk/src/c/tests/zkServer.sh (original)
+++ hadoop/zookeeper/trunk/src/c/tests/zkServer.sh Tue Apr 14 04:55:06 2009
@@ -24,7 +24,12 @@
 
 if [ x$1 == xstartClean ]
 then
-   rm -rf /tmp/zkdata
+if [ x${base_dir} == x ]   
+then
+rm -rf /tmp/zkdata
+else
+rm -rf ${base_dir}/build/tmp
+fi
 fi
 
 # Make sure nothing is left over from before
@@ -32,12 +37,13 @@
 
 case $1 in
 start|startClean)
-   mkdir -p /tmp/zkdata
if [ x${base_dir} == x ]
 then
-java -cp 
../../zookeeper-dev.jar:../../src/java/lib/log4j-1.2.15.jar:../../conf 
org.apache.zookeeper.server.ZooKeeperServerMain 22181 /tmp/zkdata  
/tmp/zk.log 
+   mkdir -p /tmp/zkdata
+   java -cp 
../../zookeeper-dev.jar:../../src/java/lib/log4j-1.2.15.jar:../../conf 
org.apache.zookeeper.server.ZooKeeperServerMain 22181 /tmp/zkdata  
/tmp/zk.log 
 else
-java -cp 
${base_dir}/zookeeper-dev.jar:${base_dir}/src/java/lib/log4j-1.2.15.jar:${base_dir}/conf
 org.apache.zookeeper.server.ZooKeeperServerMain 22181 /tmp/zkdata  
/tmp/zk.log 
+mkdir -p ${base_dir}/build/tmp/zkdata
+java -cp 
${base_dir}/zookeeper-dev.jar:${base_dir}/src/java/lib/log4j-1.2.15.jar:${base_dir}/conf
 org.apache.zookeeper.server.ZooKeeperServerMain 22181 
${base_dir}/build/tmp/zkdata  ${base_dir}/build/tmp/zk.log 
fi
 sleep 5
;;




svn commit: r766160 - in /hadoop/zookeeper/trunk: ./ src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/ src/contrib/bookkeeper/test/org/apache/bookkeeper/test/

2009-04-17 Thread mahadev
Author: mahadev
Date: Fri Apr 17 21:28:30 2009
New Revision: 766160

URL: http://svn.apache.org/viewvc?rev=766160view=rev
Log:
ZOOKEEPER-373. One thread per bookie (flavio via mahadev) 

Modified:
hadoop/zookeeper/trunk/CHANGES.txt

hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/BookKeeper.java

hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/BookieHandle.java

hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/LedgerHandle.java

hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/QuorumEngine.java

hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/QuorumOpMonitor.java

hadoop/zookeeper/trunk/src/contrib/bookkeeper/test/org/apache/bookkeeper/test/BookieReadWriteTest.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=766160r1=766159r2=766160view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Fri Apr 17 21:28:30 2009
@@ -99,6 +99,8 @@
   ZOOKEEPER-361. integrate cppunit testing as part of hudson patch process.
   (giri via mahadev)
 
+  ZOOKEEPER-373. One thread per bookie (flavio via mahadev) 
+
 NEW FEATURES:
 
 

Modified: 
hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/BookKeeper.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/BookKeeper.java?rev=766160r1=766159r2=766160view=diff
==
--- 
hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/BookKeeper.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/BookKeeper.java
 Fri Apr 17 21:28:30 2009
@@ -22,6 +22,7 @@
 
 
 import java.io.IOException;
+import java.net.ConnectException;
 import java.io.ByteArrayOutputStream;
 import java.security.NoSuchAlgorithmException;
 import java.nio.ByteBuffer;
@@ -35,6 +36,7 @@
 import java.net.InetSocketAddress;
 
 import org.apache.bookkeeper.client.BKException;
+import org.apache.bookkeeper.client.BookieHandle;
 import org.apache.bookkeeper.client.LedgerSequence;
 import org.apache.bookkeeper.client.BKException.Code;
 import org.apache.bookkeeper.client.LedgerHandle.QMode;
@@ -77,8 +79,6 @@
 
 ZooKeeper zk = null;
 QuorumEngine engine = null;
-MessageDigest md = null;
-//HashMapLong, ArrayBlockingQueueOperation  qeMap;
 HashMapLong, QuorumEngine engines;
 HashSetInetSocketAddress bookieBlackList;
 
@@ -386,6 +386,7 @@
 ListString list = 
 zk.getChildren(prefix + getZKStringId(lId) + ensemble, false);
 
+LOG.info(Length of list of bookies:  + list.size());
 for(int i = 0 ; i  list.size() ; i++){
 for(String s : list){
 byte[] bindex = zk.getData(prefix + getZKStringId(lId) + 
ensemble + / + s, false, stat);
@@ -421,11 +422,6 @@
 return addr;
 }
 
-public void initMessageDigest(String alg)
-throws NoSuchAlgorithmException {
-md = MessageDigest.getInstance(alg);
-}
-
 /**
  * Add entry synchronously to an open ledger.
  * 
@@ -644,6 +640,38 @@
 return null;
 }
 
+HashMapInetSocketAddress, BookieHandle bhMap = 
+   new HashMapInetSocketAddress, BookieHandle();
+
+/**
+ *  Keeps a list of available BookieHandle objects and returns
+ *  the corresponding object given an address.
+ *  
+ *  @param a   InetSocketAddress
+ */
+
+synchronized BookieHandle getBookieHandle(InetSocketAddress a)
+throws ConnectException, IOException {
+   if(!bhMap.containsKey(a)){
+   bhMap.put(a, new BookieHandle(a));
+   }
+   bhMap.get(a).incRefCount();
+   
+   return bhMap.get(a);
+}
+
+/**
+ * When there are no more references to a BookieHandle,
+ * remove it from the list. 
+ */
+
+synchronized void haltBookieHandles(ArrayListBookieHandle bookies){
+for(BookieHandle bh : bookies){
+if(bh.halt() = 0)
+bhMap.remove(bh.addr);
+}
+}
+
 /**
  * Blacklists bookies.
  * 

Modified: 
hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/BookieHandle.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/BookieHandle.java?rev=766160r1=766159r2=766160view=diff
==
--- 
hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/BookieHandle.java

svn commit: r772795 - in /hadoop/zookeeper/trunk: CHANGES.txt src/contrib/bookkeeper/conf/log4j.properties

2009-05-07 Thread mahadev
Author: mahadev
Date: Thu May  7 22:27:26 2009
New Revision: 772795

URL: http://svn.apache.org/viewvc?rev=772795view=rev
Log:
ZOOKEEPER-392. Change log4j properties in bookkeeper. (flavio via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/src/contrib/bookkeeper/conf/log4j.properties

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=772795r1=772794r2=772795view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Thu May  7 22:27:26 2009
@@ -70,6 +70,8 @@
   ZOOKEEPER-365. javadoc is wrong for setLast in LedgerHandle
   (flavio via phunt)
 
+  ZOOKEEPER-392. Change log4j properties in bookkeeper. (flavio via mahadev)
+
 IMPROVEMENTS:
   ZOOKEEPER-308. improve the atomic broadcast performance 3x.
   (breed via mahadev)

Modified: hadoop/zookeeper/trunk/src/contrib/bookkeeper/conf/log4j.properties
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/contrib/bookkeeper/conf/log4j.properties?rev=772795r1=772794r2=772795view=diff
==
--- hadoop/zookeeper/trunk/src/contrib/bookkeeper/conf/log4j.properties 
(original)
+++ hadoop/zookeeper/trunk/src/contrib/bookkeeper/conf/log4j.properties Thu May 
 7 22:27:26 2009
@@ -26,7 +26,7 @@
 # Format is default threshold (, appender)+
 
 # DEFAULT: console appender only
-log4j.rootLogger=TRACE, CONSOLE
+log4j.rootLogger=INFO, CONSOLE
 
 # Example with rolling log file
 #log4j.rootLogger=DEBUG, CONSOLE, ROLLINGFILE
@@ -38,7 +38,7 @@
 # Log INFO level and above messages to the console
 #
 log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
-log4j.appender.CONSOLE.Threshold=TRACE
+log4j.appender.CONSOLE.Threshold=INFO
 log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
 log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} - %-5p - 
[%t:%c...@%l] - %m%n
 




svn commit: r772797 - in /hadoop/zookeeper/trunk: ./ src/docs/src/documentation/content/xdocs/ src/java/lib/ src/java/main/org/apache/zookeeper/

2009-05-07 Thread mahadev
Author: mahadev
Date: Thu May  7 22:34:36 2009
New Revision: 772797

URL: http://svn.apache.org/viewvc?rev=772797view=rev
Log:
ZOOKEEPER-386. improve java cli shell. (henry robinson via mahadev)

Added:
hadoop/zookeeper/trunk/src/java/lib/README.txt
hadoop/zookeeper/trunk/src/java/lib/jline-0.9.94.LICENSE.txt
hadoop/zookeeper/trunk/src/java/lib/jline-0.9.94.jar   (with props)

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/JLineZNodeCompletor.java
Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/build.xml

hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperAdmin.xml

hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperQuotas.xml
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeperMain.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=772797r1=772796r2=772797view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Thu May  7 22:34:36 2009
@@ -131,6 +131,8 @@
 
   ZOOKEEPER-378. perl binding for zookeeper (chris darroch via mahadev)
 
+  ZOOKEEPER-386. improve java cli shell. (henry robinson via mahadev)
+
 Release 3.1.0 - 2009-02-06
   
 Non-backward compatible changes:

Modified: hadoop/zookeeper/trunk/build.xml
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/build.xml?rev=772797r1=772796r2=772797view=diff
==
--- hadoop/zookeeper/trunk/build.xml (original)
+++ hadoop/zookeeper/trunk/build.xml Thu May  7 22:34:36 2009
@@ -169,6 +169,7 @@
 fileset dir=${build.classes} /
 pathelement path=${lib.dir}/log4j-1.2.15.jar /
 pathelement path=${clover.jar} /
+pathelement path=${lib.dir}/jline-0.9.94.jar /
 /path
 /target
 

Modified: 
hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperAdmin.xml
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperAdmin.xml?rev=772797r1=772796r2=772797view=diff
==
--- 
hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperAdmin.xml
 (original)
+++ 
hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperAdmin.xml
 Thu May  7 22:34:36 2009
@@ -222,8 +222,8 @@
   paraIn Java, you can run the following command to execute
   simple operations:/para
 
-  paracomputeroutput$ java -cp 
zookeeper.jar:src/java/lib/log4j-1.2.15.jar:conf \
-  org.apache.zookeeper.ZooKeeperMain 127.0.0.1:2181/computeroutput/para
+  paracomputeroutput$ java -cp 
zookeeper.jar:src/java/lib/log4j-1.2.15.jar:conf:src/java/lib/jline-0.9.94.jar \
+  org.apache.zookeeper.ZooKeeperMain -server 
127.0.0.1:2181/computeroutput/para
 /listitem
 
 listitem

Modified: 
hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperQuotas.xml
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperQuotas.xml?rev=772797r1=772796r2=772797view=diff
==
--- 
hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperQuotas.xml
 (original)
+++ 
hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperQuotas.xml
 Thu May  7 22:34:36 2009
@@ -43,8 +43,8 @@
ZooKeeper prints emphasisWARN/emphasis messages if users exceed the 
quota assigned to them. The messages 
are printed in the log of the ZooKeeper. 
/para
-   paracomputeroutput$java -cp 
zookeeper.jar:src/java/lib/log4j-1.2.15.jar/conf \
-org.apache.zookeeper.ZooKeeperMain host:port/computeroutput/para 
+   paracomputeroutput$java -cp 
zookeeper.jar:src/java/lib/log4j-1.2.15.jar/conf:src/java/lib/jline-0.9.94.jar \
+org.apache.zookeeper.ZooKeeperMain -server 
host:port/computeroutput/para 
 para The above command gives you a command line option of using 
quotas./para
 section
 titleSetting Quotas/title

Added: hadoop/zookeeper/trunk/src/java/lib/README.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/lib/README.txt?rev=772797view=auto
==
--- hadoop/zookeeper/trunk/src/java/lib/README.txt (added)
+++ hadoop/zookeeper/trunk/src/java/lib/README.txt Thu May  7 22:34:36 2009
@@ -0,0 +1,4 @@
+Folowing is the list of external jars contained in this directory and the 
sources from where they were obtained:
+---
+
+* jline

svn commit: r772798 - in /hadoop/zookeeper/trunk: CHANGES.txt build.xml

2009-05-07 Thread mahadev
Author: mahadev
Date: Thu May  7 22:37:54 2009
New Revision: 772798

URL: http://svn.apache.org/viewvc?rev=772798view=rev
Log:
ZOOKEEPER-376. ant test target re-compiles cppunit code every time (phunt via 
mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/build.xml

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=772798r1=772797r2=772798view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Thu May  7 22:37:54 2009
@@ -120,6 +120,9 @@
  
   ZOOKEEPER-389. add help/usage to the c shell cli.c (phunt via mahadev)
 
+  ZOOKEEPER-376. ant test target re-compiles cppunit code every time (phunt
+via mahadev)
+  
 NEW FEATURES:
 
   ZOOKEEPER-371. jdiff documentation included in build/release (giri via phunt)

Modified: hadoop/zookeeper/trunk/build.xml
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/build.xml?rev=772798r1=772797r2=772798view=diff
==
--- hadoop/zookeeper/trunk/build.xml (original)
+++ hadoop/zookeeper/trunk/build.xml Thu May  7 22:37:54 2009
@@ -613,11 +613,10 @@
 fail if=tests.failedTests failed!/fail
 /target
 
-target name=create-cppunit-configure depends=init if=cppunit
-   exec executable=autoreconf dir=${c.src.dir} searchpath=yes 
-   failonerror=yes
-   arg value=-if/
-   /exec
+target name=check-cppunit-configure depends=init 
+  condition property=need.cppunit.configure
+not available file=${c.src.dir}/configure/ /not
+  /condition
 /target  
 
 target name=check-cppunit-makefile depends=init 
@@ -626,8 +625,28 @@
/condition
 /target
 
+!--
+   1. If we have a Makefile it will handle up-to-date check and also
+  regenerate the configure script if missing. (done)
+   2. If we don't have a Makefile use the configure script to 
+  regenerate it. (done)
+   3. If we don't have a Makefile nor a configure script then it's
+  last resort and run autoreconf, then configure (done)
+  --
+
+target name=create-cppunit-configure depends=check-cppunit-configure
+if=need.cppunit.configure
+  exec executable=autoreconf dir=${c.src.dir} searchpath=yes
+failonerror=yes
+arg value=-if/
+  /exec
+/target
+
 target name=create-cppunit-makefile depends=check-cppunit-makefile 
if=need.cppunit.makefile
+  antcall target=create-cppunit-configure
+param name=cppunit value=true/
+  /antcall
mkdir dir=${test.cppunit.dir}/
exec executable=${c.src.dir}/configure dir=${test.cppunit.dir}
failonerror=yes
@@ -638,9 +657,6 @@
 /target
 
 target name=call-test-cppunit description=to execute cppunit tests
-   antcall target=create-cppunit-configure
-   param name=cppunit value=true/
-/antcall
antcall target=create-cppunit-makefile/
antcall target=test-cppunit
param name=cppunit value=true/
@@ -648,7 +664,9 @@
 /target  
 
 
-target name=test-cppunit depends=compile_jute, jar, 
create-cppunit-makefile if=cppunit 
+target name=test-cppunit
+depends=compile_jute, jar, create-cppunit-makefile
+if=cppunit
description=to run cppunit test cases
 property name=fuser.bin value=/sbin/
 property name=lib.cppunit value=/usr/local/lib/




svn commit: r774081 - in /hadoop/zookeeper/trunk: ./ src/contrib/bookkeeper/src/java/org/apache/bookkeeper/bookie/ src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/ src/contrib/bookkeeper/

2009-05-12 Thread mahadev
Author: mahadev
Date: Tue May 12 20:59:33 2009
New Revision: 774081

URL: http://svn.apache.org/viewvc?rev=774081view=rev
Log:
ZOOKEEPER-391. bookeeper mainline code should not be calling printStackTrace. 
(flavio via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt

hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/bookie/Bookie.java

hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/BookieHandle.java

hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/proto/BookieClient.java

hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/proto/NIOServerFactory.java

hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/util/LocalBookKeeper.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=774081r1=774080r2=774081view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Tue May 12 20:59:33 2009
@@ -122,6 +122,9 @@
 
   ZOOKEEPER-376. ant test target re-compiles cppunit code every time (phunt
 via mahadev)
+
+  ZOOKEEPER-391. bookeeper mainline code should not be calling
+printStackTrace. (flavio via mahadev) 
   
 NEW FEATURES:
 

Modified: 
hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/bookie/Bookie.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/bookie/Bookie.java?rev=774081r1=774080r2=774081view=diff
==
--- 
hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/bookie/Bookie.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/bookie/Bookie.java
 Tue May 12 20:59:33 2009
@@ -267,10 +267,8 @@
 }
 toFlush.add(qe);
 }
-} catch (InterruptedException e) {
-LOG.debug(Bookie thread exiting due to interrupt);
 } catch (Exception e) {
-e.printStackTrace();
+LOG.fatal(Bookie thread exiting, e);
 }
 }
 

Modified: 
hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/BookieHandle.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/BookieHandle.java?rev=774081r1=774080r2=774081view=diff
==
--- 
hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/BookieHandle.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/BookieHandle.java
 Tue May 12 20:59:33 2009
@@ -112,7 +112,7 @@
 try{
 incomingQueue.put(new ToSend(lh, r, entry));
 } catch(InterruptedException e){
-e.printStackTrace();
+LOG.warn(Interrupted while waiting for room in the incoming 
queue);
 }
 }
 
@@ -147,7 +147,7 @@
 try{
 incomingQueue.put(new ToSend(lh, r, entry));
 } catch(InterruptedException e){
-e.printStackTrace();
+LOG.warn(Interrupted while waiting for room in the incoming 
queue);
 }
 }
 

Modified: 
hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/proto/BookieClient.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/proto/BookieClient.java?rev=774081r1=774080r2=774081view=diff
==
--- 
hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/proto/BookieClient.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/proto/BookieClient.java
 Tue May 12 20:59:33 2009
@@ -312,8 +312,7 @@
 }
 }
 } catch(Exception e) {
-LOG.error(Len =  + len + , Type =  + type + , rc =  + rc);
-e.printStackTrace();
+LOG.error(Len =  + len + , Type =  + type + , rc =  + rc, e);
 }
 }
 

Modified: 
hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/proto/NIOServerFactory.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/proto/NIOServerFactory.java?rev=774081r1=774080r2=774081view=diff
==
--- 
hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/proto/NIOServerFactory.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/proto

svn commit: r779431 - in /hadoop/zookeeper/trunk: CHANGES.txt src/contrib/bookkeeper/build.xml

2009-05-27 Thread mahadev
Author: mahadev
Date: Thu May 28 04:55:19 2009
New Revision: 779431

URL: http://svn.apache.org/viewvc?rev=779431view=rev
Log:
ZOOKEEPER-416. bookkeeper jar includes unnnecessary files. (flavio via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/src/contrib/bookkeeper/build.xml

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=779431r1=779430r2=779431view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Thu May 28 04:55:19 2009
@@ -100,6 +100,8 @@
  
   ZOOKEEPER-409. address all findbugs warnings in jute related classes (phunt 
via breed)
 
+  ZOOKEEPER-416. bookkeeper jar includes unnnecessary files. (flavio via 
mahadev)
+
 IMPROVEMENTS:
   ZOOKEEPER-308. improve the atomic broadcast performance 3x.
   (breed via mahadev)

Modified: hadoop/zookeeper/trunk/src/contrib/bookkeeper/build.xml
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/contrib/bookkeeper/build.xml?rev=779431r1=779430r2=779431view=diff
==
--- hadoop/zookeeper/trunk/src/contrib/bookkeeper/build.xml (original)
+++ hadoop/zookeeper/trunk/src/contrib/bookkeeper/build.xml Thu May 28 04:55:19 
2009
@@ -69,7 +69,6 @@
   /manifest
   fileset file=${zk.root}/LICENSE.txt /
   fileset dir=${build.classes}/
-  fileset dir=${build.test}/
 /jar
   /target
 




svn commit: r780122 - in /hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client: AddCallback.java ErrorCodes.java LedgerStream.java ReadCallback.java

2009-05-29 Thread mahadev
Author: mahadev
Date: Fri May 29 22:04:28 2009
New Revision: 780122

URL: http://svn.apache.org/viewvc?rev=780122view=rev
Log:
ZOOKEEPER-383. Deleting 0 length source files in bookkeeper.

Removed:

hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/AddCallback.java

hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/ErrorCodes.java

hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/LedgerStream.java

hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/ReadCallback.java



svn commit: r782792 - in /hadoop/zookeeper/trunk: CHANGES.txt src/c/include/zookeeper.h

2009-06-08 Thread mahadev
Author: mahadev
Date: Mon Jun  8 21:30:55 2009
New Revision: 782792

URL: http://svn.apache.org/viewvc?rev=782792view=rev
Log:
ZOOKEEPER-196. doxygen comment for state argument of watcher_fn typedef and 
implementation differ (...one of the *_STATE constants, otherwise -1)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/src/c/include/zookeeper.h

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=782792r1=782791r2=782792view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Mon Jun  8 21:30:55 2009
@@ -190,6 +190,10 @@
 
   ZOOKEEPER-396. race condition in zookeeper client library between
 zookeeper_close and zoo_synchronous api. (mahadev)
+
+  ZOOKEEPER-196. doxygen comment for state argument of watcher_fn typedef and
+implementation differ (...one of the *_STATE constants, otherwise -1) (breed
+via mahadev)
  
 NEW FEATURES:
 

Modified: hadoop/zookeeper/trunk/src/c/include/zookeeper.h
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/include/zookeeper.h?rev=782792r1=782791r2=782792view=diff
==
--- hadoop/zookeeper/trunk/src/c/include/zookeeper.h (original)
+++ hadoop/zookeeper/trunk/src/c/include/zookeeper.h Mon Jun  8 21:30:55 2009
@@ -162,9 +162,7 @@
 /**
  * @name State Consts
  * These constants represent the states of a zookeeper connection. They are
- * possible parameters of the watcher callback. If a connection moves from
- * the ZOO_CONNECTED_STATE to the ZOO_CONNECTING_STATE, all outstanding 
- * watches will be removed.
+ * possible parameters of the watcher callback.
  */
 // @{
 extern ZOOAPI const int ZOO_EXPIRED_SESSION_STATE;
@@ -266,8 +264,7 @@
  * 
  * \param zh zookeeper handle
  * \param type event type. This is one of the *_EVENT constants. 
- * \param state connection state. If the type is ZOO_SESSION_EVENT, the state 
value 
- * will be one of the *_STATE constants, otherwise -1.
+ * \param state connection state. The state value will be one of the *_STATE 
constants.
  * \param path znode path for which the watcher is triggered. NULL if the 
event 
  * type is ZOO_SESSION_EVENT
  * \param watcherCtx watcher context.




svn commit: r783096 - in /hadoop/zookeeper/trunk: CHANGES.txt src/c/src/mt_adaptor.c src/c/src/zk_adaptor.h src/c/src/zookeeper.c src/c/tests/TestClient.cc

2009-06-09 Thread mahadev
Author: mahadev
Date: Tue Jun  9 19:01:11 2009
New Revision: 783096

URL: http://svn.apache.org/viewvc?rev=783096view=rev
Log:
ZOOKEEPER-375. zoo_add_auth only retains most recent auth on re-sync. (mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/src/c/src/mt_adaptor.c
hadoop/zookeeper/trunk/src/c/src/zk_adaptor.h
hadoop/zookeeper/trunk/src/c/src/zookeeper.c
hadoop/zookeeper/trunk/src/c/tests/TestClient.cc

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=783096r1=783095r2=783096view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Tue Jun  9 19:01:11 2009
@@ -115,6 +115,9 @@
 
   ZOOKEEPER-435. allow super admin digest based auth to be configurable 
(phunt via breed)
 
+  ZOOKEEPER-375. zoo_add_auth only retains most recent auth on re-sync.
+(mahadev)
+
 IMPROVEMENTS:
   ZOOKEEPER-308. improve the atomic broadcast performance 3x.
   (breed via mahadev)

Modified: hadoop/zookeeper/trunk/src/c/src/mt_adaptor.c
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/src/mt_adaptor.c?rev=783096r1=783095r2=783096view=diff
==
--- hadoop/zookeeper/trunk/src/c/src/mt_adaptor.c (original)
+++ hadoop/zookeeper/trunk/src/c/src/mt_adaptor.c Tue Jun  9 19:01:11 2009
@@ -43,11 +43,11 @@
 
 void zoo_lock_auth(zhandle_t *zh)
 {
-pthread_mutex_lock(zh-auth.lock);
+pthread_mutex_lock(zh-auth_h.lock);
 }
 void zoo_unlock_auth(zhandle_t *zh)
 {
-pthread_mutex_unlock(zh-auth.lock);
+pthread_mutex_unlock(zh-auth_h.lock);
 }
 void lock_buffer_list(buffer_head_t *l)
 {
@@ -175,7 +175,7 @@
 set_nonblock(adaptor_threads-self_pipe[1]);
 set_nonblock(adaptor_threads-self_pipe[0]);
 
-pthread_mutex_init(zh-auth.lock,0);
+pthread_mutex_init(zh-auth_h.lock,0);
 
 zh-adaptor_priv = adaptor_threads;
 pthread_mutex_init(zh-to_process.lock,0);
@@ -237,7 +237,7 @@
 pthread_cond_destroy(zh-completions_to_process.cond);
 pthread_mutex_destroy(adaptor-zh_lock);
 
-pthread_mutex_destroy(zh-auth.lock);
+pthread_mutex_destroy(zh-auth_h.lock);
 
 close(adaptor-self_pipe[0]);
 close(adaptor-self_pipe[1]);

Modified: hadoop/zookeeper/trunk/src/c/src/zk_adaptor.h
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/src/zk_adaptor.h?rev=783096r1=783095r2=783096view=diff
==
--- hadoop/zookeeper/trunk/src/c/src/zk_adaptor.h (original)
+++ hadoop/zookeeper/trunk/src/c/src/zk_adaptor.h Tue Jun  9 19:01:11 2009
@@ -107,9 +107,7 @@
 struct buffer auth;
 void_completion_t completion;
 const char* data;
-#ifdef THREADED
-pthread_mutex_t lock;
-#endif
+struct _auth_info *next;
 } auth_info;
 
 /**
@@ -156,7 +154,15 @@
  int self_pipe[2];
 };
 #endif
- 
+
+/** the auth list for adding auth */
+typedef struct _auth_list_head {
+ auth_info *auth;
+#ifdef THREADED
+ pthread_mutex_t lock;
+#endif
+} auth_list_head_t;
+
 /**
  * This structure represents the connection to zookeeper.
  */
@@ -187,7 +193,7 @@
 char primer_storage_buffer[40]; /* the true size of primer_storage */
 volatile int state;
 void *context;
-struct _auth_info auth; /* authentication data */
+auth_list_head_t auth_h; /* authentication data list */
 /* zookeeper_close is not reentrant because it de-allocates the zhandler. 
  * This guard variable is used to defer the destruction of zhandle till 
  * right before top-level API call returns to the caller */
@@ -204,6 +210,7 @@
 zk_hashtable* active_child_watchers;
 };
 
+
 int adaptor_init(zhandle_t *zh);
 void adaptor_finish(zhandle_t *zh);
 void adaptor_destroy(zhandle_t *zh);

Modified: hadoop/zookeeper/trunk/src/c/src/zookeeper.c
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/src/zookeeper.c?rev=783096r1=783095r2=783096view=diff
==
--- hadoop/zookeeper/trunk/src/c/src/zookeeper.c (original)
+++ hadoop/zookeeper/trunk/src/c/src/zookeeper.c Tue Jun  9 19:01:11 2009
@@ -139,6 +139,12 @@
 #define COMPLETION_ACLLIST 4
 #define COMPLETION_STRING 5
 
+typedef struct _auth_completion_list {
+void_completion_t completion;
+const char *auth_data;
+struct _auth_completion_list *next;
+} auth_completion_list_t;
+
 typedef struct _completion_list {
 int xid;
 int completion_type; /* one of the COMPLETION_* values */
@@ -198,22 +204,123 @@
 return zh-recv_timeout;
 }
 
-static void init_auth_info(auth_info *auth)
+/** these functions are thread unsafe, so make sure that 
+zoo_lock_auth is called before you access them **/
+static auth_info* get_last_auth(auth_list_head_t *auth_list) {
+auth_info

svn commit: r787780 [3/3] - in /hadoop/zookeeper/trunk: ./ docs/ src/docs/src/documentation/content/xdocs/

2009-06-23 Thread mahadev
Added: 
hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/bookkeeperStarted.xml
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/bookkeeperStarted.xml?rev=787780view=auto
==
--- 
hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/bookkeeperStarted.xml
 (added)
+++ 
hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/bookkeeperStarted.xml
 Tue Jun 23 18:38:33 2009
@@ -0,0 +1,204 @@
+?xml version=1.0 encoding=UTF-8?
+!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the License);
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an AS IS BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--
+
+!DOCTYPE article PUBLIC -//OASIS//DTD Simplified DocBook XML V1.0//EN
+http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd;
+article id=bk_GettStartedGuide
+  titleBookKeeper Getting Started Guide/title
+
+  articleinfo
+legalnotice
+  paraLicensed under the Apache License, Version 2.0 (the License);
+  you may not use this file except in compliance with the License. You may
+  obtain a copy of the License at ulink
+  
url=http://www.apache.org/licenses/LICENSE-2.0;http://www.apache.org/licenses/LICENSE-2.0/ulink./para
+
+  paraUnless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an AS IS
+  BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+  implied. See the License for the specific language governing permissions
+  and limitations under the License./para
+/legalnotice
+
+abstract
+  paraThis guide contains detailed information about using BookKeeper
+  for logging. It discusses the basic operations BookKeeper supports, 
+  and how to create logs and perform basic read and write operations on 
these
+  logs./para
+/abstract
+  /articleinfo
+  section id=bk_GettingStarted
+titleGetting Started: Setting up BookKeeper to write logs./title
+
+paraThis document contains information to get you started quickly with
+BookKeeper. It is aimed primarily at developers willing to try it out, and
+contains simple installation instructions for a simple BookKeeper 
installation
+and a simple programming example. For further programming detail, please 
refer to 
+ulink url=bookkeeperProgrammer.htmlBookKeeper Programmer's 
Guide/ulink.
+/para
+  
+ section id=bk_Prerequisites
+ titlePre-requisites/title
+ paraSee ulink url=bookkeeperConfig.html#bk_sysReq
+ System Requirements/ulink in the Admin guide./para
+   /section
+
+ section id=bk_Download
+   titleDownload/title
+   para BookKeeper is distributed along with ZooKeeper. To get a 
ZooKeeper distribution, 
+  download a recent
+   ulink url=http://hadoop.apache.org/zookeeper/releases.html;
+ stable/ulink release from one of the Apache Download
+Mirrors./para
+ /section
+ 
+ section id=bk_localBK
+   titleLocalBookKeeper/title
+   para Under org.apache.bookkeeper.util, you'll find a java 
program
+   called LocalBookKeeper.java that sets you up to run BookKeeper 
on a 
+   single machine. This is far from ideal from a performance 
perspective,
+   but the program is useful for both test and educational 
purposes.
+   /para
+ /section
+ 
+ section id=bk_setupBookies
+   titleSetting up bookies/title
+   para If you're bold and you want more than just running 
things locally, then
+   you'll need to run bookies in different servers. You'll need at 
least three bookies
+   to start with.  
+   /para
+   
+   para
+   For each bookie, we need to execute a command like the 
following:
+   /para
+   
+   paracomputeroutput
+   java -cp 
.:./zookeeper-dev-bookkeeper.jar:./zookeeper-dev.jar:../log4j/apache-log4j-1.2.15/log4j-1.2.15.jar\
+   -Dlog4j.configuration=log4j.properties 
org.apache.bookkeeper.proto.BookieServer 3181 /path_to_log_device/\
+   /path_to_ledger_device/
+   /computeroutput/para
+   
+   para /path_to_log_device/ and /path_to_ledger_device/ are 
different 

svn commit: r788238 - in /hadoop/zookeeper/trunk: CHANGES.txt docs/zookeeperProgrammers.html docs/zookeeperProgrammers.pdf src/docs/src/documentation/content/xdocs/zookeeperProgrammers.xml

2009-06-24 Thread mahadev
Author: mahadev
Date: Thu Jun 25 01:48:18 2009
New Revision: 788238

URL: http://svn.apache.org/viewvc?rev=788238view=rev
Log:
document effects (latency) of storing large amounts of data in znodes. (breed 
via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/docs/zookeeperProgrammers.html
hadoop/zookeeper/trunk/docs/zookeeperProgrammers.pdf

hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperProgrammers.xml

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=788238r1=788237r2=788238view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Thu Jun 25 01:48:18 2009
@@ -234,6 +234,9 @@
 
   ZOOKEEPER-356. Masking bookie failure during writes to a ledger (flavio via 
breed)
 
+  ZOOKEEPER-327. document effects (latency) of storing large amounts of data
+in znodes. (breed via mahadev)
+
 NEW FEATURES:
 
   ZOOKEEPER-371. jdiff documentation included in build/release (giri via phunt)

Modified: hadoop/zookeeper/trunk/docs/zookeeperProgrammers.html
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/docs/zookeeperProgrammers.html?rev=788238r1=788237r2=788238view=diff
==
--- hadoop/zookeeper/trunk/docs/zookeeperProgrammers.html (original)
+++ hadoop/zookeeper/trunk/docs/zookeeperProgrammers.html Thu Jun 25 01:48:18 
2009
@@ -530,13 +530,27 @@
 atomically. Reads get all the data bytes associated with a znode and a
 write replaces all the data. Each node has an Access Control List
 (ACL) that restricts who can do what./p
-a name=N100E2/aa name=Ephemeral+Nodes/a
+pZooKeeper was not designed to be a general database or large
+object store. Instead, it manages coordination data. This data can
+come in the form of configuration, status information, rendezvous, etc.
+A common property of the various forms of coordination data is that
+they are relatively small: measured in kilobytes.
+The ZooKeeper client and the server implementations have sanity checks
+to ensure that znodes have less than 1M of data, but the data should
+be much less than that on average. Operating on relatively large data
+sizes will cause some operations to take much more time than others and
+will affect the latencies of some operations because of the extra time
+needed to move more data over the network and onto storage media. If
+large data storage is needed, the usually pattern of dealing with such
+data is to store it on a bulk storage system, such as NFS or HDFS, and
+store pointers to the storage locations in ZooKeeper./p
+a name=N100E5/aa name=Ephemeral+Nodes/a
 h4Ephemeral Nodes/h4
 pZooKeeper also has the notion of ephemeral nodes. These znodes
 exists as long as the session that created the znode is active. When
 the session ends the znode is deleted. Because of this behavior
 ephemeral znodes are not allowed to have children./p
-a name=N100EC/aa name=Sequence+Nodes+--+Unique+Naming/a
+a name=N100EF/aa name=Sequence+Nodes+--+Unique+Naming/a
 h4Sequence Nodes -- Unique Naming/h4
 pWhen creating a znode you can also request that
 ZooKeeper append a monotonicly increasing counter to the end
@@ -550,7 +564,7 @@
 (4bytes) maintained by the parent node, the counter will
 overflow when incremented beyond 2147483647 (resulting in a
 name lt;pathgt;-2147483647)./p
-a name=N100FB/aa name=sc_timeInZk/a
+a name=N100FE/aa name=sc_timeInZk/a
 h3 class=h4Time in ZooKeeper/h3
 pZooKeeper tracks time multiple ways:/p
 ul
@@ -619,7 +633,7 @@
 /li
   
 /ul
-a name=N10133/aa name=sc_zkStatStructure/a
+a name=N10136/aa name=sc_zkStatStructure/a
 h3 class=h4ZooKeeper Stat Structure/h3
 pThe Stat structure for each znode in ZooKeeper is made up of the
   following fields:/p
@@ -754,7 +768,7 @@
 /div
 
   
-a name=N101A5/aa name=ch_zkSessions/a
+a name=N101A8/aa name=ch_zkSessions/a
 h2 class=h3ZooKeeper Sessions/h2
 div class=section
 pTo create a client session the application code must provide
@@ -842,7 +856,7 @@
 /div
 
   
-a name=N101CF/aa name=ch_zkWatches/a
+a name=N101D2/aa name=ch_zkWatches/a
 h2 class=h3ZooKeeper Watches/h2
 div class=section
 pAll of the read operations in ZooKeeper - stronggetData()/strong, 
stronggetChildren()/strong, and strongexists()/strong - have the option 
of setting a watch as a
@@ -925,7 +939,7 @@
 general this all occurs transparently. There is one case where a watch
 may be missed: a watch for the existance of a znode not yet created will
 be missed if the znode is created and deleted while disconnected./p
-a name=N10205/aa name=sc_WatchGuarantees/a
+a name=N10208/aa name=sc_WatchGuarantees

svn commit: r788502 - in /hadoop/zookeeper/trunk: CHANGES.txt src/java/main/org/apache/zookeeper/ClientCnxn.java src/java/test/org/apache/zookeeper/test/ACLTest.java

2009-06-25 Thread mahadev
Author: mahadev
Date: Thu Jun 25 20:41:37 2009
New Revision: 788502

URL: http://svn.apache.org/viewvc?rev=788502view=rev
Log:
ZOOKEEPER-438.  addauth fails to register auth on new client that's not yet 
connected (breed 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/ACLTest.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=788502r1=788501r2=788502view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Thu Jun 25 20:41:37 2009
@@ -128,6 +128,9 @@
 
   ZOOKEEPER-446. some traces of the host auth scheme left (breed via mahadev)
 
+  ZOOKEEPER-438.  addauth fails to register auth on new client that's not yet
+connected (breed via mahadev)
+
 IMPROVEMENTS:
   ZOOKEEPER-308. improve the atomic broadcast performance 3x.
   (breed 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=788502r1=788501r2=788502view=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 Jun 25 20:41:37 2009
@@ -1130,11 +1130,12 @@
 }
 
 public void addAuthInfo(String scheme, byte auth[]) {
-authInfo.add(new AuthData(scheme, auth));
-if (zooKeeper.state == States.CONNECTED) {
-queuePacket(new RequestHeader(-4, OpCode.auth), null,
-new AuthPacket(0, scheme, auth), null, null, null, null,
-null, null);
+if (!zooKeeper.state.isAlive()) {
+return;
 }
+authInfo.add(new AuthData(scheme, auth));
+queuePacket(new RequestHeader(-4, OpCode.auth), null,
+new AuthPacket(0, scheme, auth), null, null, null, null,
+null, null);
 }
 }

Modified: 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ACLTest.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ACLTest.java?rev=788502r1=788501r2=788502view=diff
==
--- hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ACLTest.java 
(original)
+++ hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ACLTest.java 
Thu Jun 25 20:41:37 2009
@@ -55,6 +55,32 @@
 LOG.info(FINISHED  + getName());
 }
 
+public void testDisconnectedAddAuth() throws Exception {
+File tmpDir = ClientBase.createTmpDir();
+ClientBase.setupTestEnv();
+zks = new ZooKeeperServer(tmpDir, tmpDir, 3000);
+SyncRequestProcessor.setSnapCount(1000);
+final int PORT = Integer.parseInt(HOSTPORT.split(:)[1]);
+NIOServerCnxn.Factory f = new NIOServerCnxn.Factory(PORT);
+f.startup(zks);
+LOG.info(starting up the zookeeper server .. waiting);
+assertTrue(waiting for server being up, 
+ClientBase.waitForServerUp(HOSTPORT,CONNECTION_TIMEOUT));
+ZooKeeper zk = new ZooKeeper(HOSTPORT, CONNECTION_TIMEOUT, this);
+try {
+zk.addAuthInfo(digest, pat:test.getBytes());
+zk.setACL(/, Ids.CREATOR_ALL_ACL, -1);
+} finally {
+zk.close();
+}
+
+f.shutdown();
+
+assertTrue(waiting for server down,
+   ClientBase.waitForServerDown(HOSTPORT,
+   ClientBase.CONNECTION_TIMEOUT));
+}
+
 /**
  * Verify that acl optimization of storing just
  * a few acls and there references in the data
@@ -149,4 +175,4 @@
 startSignal.countDown();
 }
 }
-}
\ No newline at end of file
+}




svn commit: r788539 - in /hadoop/zookeeper/trunk: ./ docs/ docs/images/ src/docs/src/documentation/content/xdocs/ src/docs/src/documentation/resources/images/

2009-06-25 Thread mahadev
Author: mahadev
Date: Thu Jun 25 22:42:42 2009
New Revision: 788539

URL: http://svn.apache.org/viewvc?rev=788539view=rev
Log:
ZOOKEEPER-264. docs should include a state transition diagram for client state 
(breed via mahadev)

Added:
hadoop/zookeeper/trunk/docs/images/state_dia.jpg   (with props)

hadoop/zookeeper/trunk/src/docs/src/documentation/resources/images/state_dia.dia
   (with props)

hadoop/zookeeper/trunk/src/docs/src/documentation/resources/images/state_dia.jpg
   (with props)
Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/docs/zookeeperProgrammers.html
hadoop/zookeeper/trunk/docs/zookeeperProgrammers.pdf

hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperProgrammers.xml

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=788539r1=788538r2=788539view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Thu Jun 25 22:42:42 2009
@@ -240,6 +240,9 @@
   ZOOKEEPER-327. document effects (latency) of storing large amounts of data
 in znodes. (breed via mahadev)
 
+  ZOOKEEPER-264. docs should include a state transition diagram for client
+state (breed via mahadev)
+
 NEW FEATURES:
 
   ZOOKEEPER-371. jdiff documentation included in build/release (giri via phunt)

Added: hadoop/zookeeper/trunk/docs/images/state_dia.jpg
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/docs/images/state_dia.jpg?rev=788539view=auto
==
Binary file - no diff available.

Propchange: hadoop/zookeeper/trunk/docs/images/state_dia.jpg
--
svn:mime-type = application/octet-stream

Modified: hadoop/zookeeper/trunk/docs/zookeeperProgrammers.html
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/docs/zookeeperProgrammers.html?rev=788539r1=788538r2=788539view=diff
==
--- hadoop/zookeeper/trunk/docs/zookeeperProgrammers.html (original)
+++ hadoop/zookeeper/trunk/docs/zookeeperProgrammers.html Thu Jun 25 22:42:42 
2009
@@ -771,7 +771,18 @@
 a name=N101A8/aa name=ch_zkSessions/a
 h2 class=h3ZooKeeper Sessions/h2
 div class=section
-pTo create a client session the application code must provide
+pA ZooKeeper client establishes a session with the ZooKeeper
+service by creating a handle to the service using a language
+binding. Once created, the handle starts of in the CONNECTING state
+and the client library tries to connect to one of the servers that
+make up the ZooKeeper service at which point it switches to the
+CONNECTED state. During normal operation will be in one of these
+two states. If an unrecoverable error occurs, such as session
+expiration or authentication failure, or if the application explicitly
+closes the handle, the handle will move to the CLOSED state.
+The following figure shows the possible state transitions of a
+ZooKeeper client:/p
+img alt= src=images/state_dia.jpgpTo create a client session the 
application code must provide
 a connection string containing a comma separated list of host:port pairs,
 each corresponding to a ZooKeeper server (e.g. 127.0.0.1:4545 or
 127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002). The ZooKeeper
@@ -856,7 +867,7 @@
 /div
 
   
-a name=N101D2/aa name=ch_zkWatches/a
+a name=N101D9/aa name=ch_zkWatches/a
 h2 class=h3ZooKeeper Watches/h2
 div class=section
 pAll of the read operations in ZooKeeper - stronggetData()/strong, 
stronggetChildren()/strong, and strongexists()/strong - have the option 
of setting a watch as a
@@ -939,7 +950,7 @@
 general this all occurs transparently. There is one case where a watch
 may be missed: a watch for the existance of a znode not yet created will
 be missed if the znode is created and deleted while disconnected./p
-a name=N10208/aa name=sc_WatchGuarantees/a
+a name=N1020F/aa name=sc_WatchGuarantees/a
 h3 class=h4What ZooKeeper Guarantees about Watches/h3
 pWith regard to watches, ZooKeeper maintains these
   guarantees:/p
@@ -974,7 +985,7 @@
 /li
   
 /ul
-a name=N1022D/aa name=sc_WatchRememberThese/a
+a name=N10234/aa name=sc_WatchRememberThese/a
 h3 class=h4Things to Remember about Watches/h3
 ul
 
@@ -1033,7 +1044,7 @@
 /div
 
   
-a name=N10259/aa name=sc_ZooKeeperAccessControl/a
+a name=N10260/aa name=sc_ZooKeeperAccessControl/a
 h2 class=h3ZooKeeper access control using ACLs/h2
 div class=section
 pZooKeeper uses ACLs to control access to its znodes (the
@@ -1068,7 +1079,7 @@
 example, the pair em(ip:19.22.0.0/16, READ)/em
 gives the emREAD/em permission to any clients with
 an IP address that starts with 19.22./p
-a name=N1028C/aa name=sc_ACLPermissions

svn commit: r788816 - in /hadoop/zookeeper/trunk: ./ docs/ docs/images/ src/docs/src/documentation/content/xdocs/ src/docs/src/documentation/resources/images/

2009-06-26 Thread mahadev
Author: mahadev
Date: Fri Jun 26 18:51:20 2009
New Revision: 788816

URL: http://svn.apache.org/viewvc?rev=788816view=rev
Log:
ZOOKEEPER-448. png files do nto work with forrest. (mahadev)

Added:
hadoop/zookeeper/trunk/docs/images/2pc.jpg   (with props)
hadoop/zookeeper/trunk/src/docs/src/documentation/resources/images/2pc.jpg  
 (with props)
Removed:
hadoop/zookeeper/trunk/docs/images/2pc.png
hadoop/zookeeper/trunk/src/docs/src/documentation/resources/images/2pc.png
Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/docs/zookeeperInternals.html
hadoop/zookeeper/trunk/docs/zookeeperInternals.pdf

hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperInternals.xml

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=788816r1=788815r2=788816view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Fri Jun 26 18:51:20 2009
@@ -131,6 +131,8 @@
   ZOOKEEPER-438.  addauth fails to register auth on new client that's not yet
 connected (breed via mahadev)
 
+  ZOOKEEPER-448. png files do nto work with forrest. (mahadev)
+
 IMPROVEMENTS:
   ZOOKEEPER-308. improve the atomic broadcast performance 3x.
   (breed via mahadev)

Added: hadoop/zookeeper/trunk/docs/images/2pc.jpg
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/docs/images/2pc.jpg?rev=788816view=auto
==
Binary file - no diff available.

Propchange: hadoop/zookeeper/trunk/docs/images/2pc.jpg
--
svn:mime-type = application/octet-stream

Modified: hadoop/zookeeper/trunk/docs/zookeeperInternals.html
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/docs/zookeeperInternals.html?rev=788816r1=788815r2=788816view=diff
==
--- hadoop/zookeeper/trunk/docs/zookeeperInternals.html (original)
+++ hadoop/zookeeper/trunk/docs/zookeeperInternals.html Fri Jun 26 18:51:20 2009
@@ -566,7 +566,7 @@
 mess left over during her leadership activation.
 /p
 pZooKeeper messaging operates similar to a classic two-phase commit./p
-img alt= src=images/2pc.pngp
+img alt= src=images/2pc.jpgp
 All communication channels are FIFO, so everything is done in order. 
Specifically 
 the following operating constraints are observed:/p
 ul

Modified: hadoop/zookeeper/trunk/docs/zookeeperInternals.pdf
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/docs/zookeeperInternals.pdf?rev=788816r1=788815r2=788816view=diff
==
Binary files - no diff available.

Modified: 
hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperInternals.xml
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperInternals.xml?rev=788816r1=788815r2=788816view=diff
==
--- 
hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperInternals.xml
 (original)
+++ 
hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperInternals.xml
 Fri Jun 26 18:51:20 2009
@@ -289,7 +289,7 @@
 
 mediaobject id=fg_2phaseCommit 
   imageobject
-imagedata fileref=images/2pc.png/
+imagedata fileref=images/2pc.jpg/
   /imageobject
 /mediaobject
 

Added: 
hadoop/zookeeper/trunk/src/docs/src/documentation/resources/images/2pc.jpg
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/docs/src/documentation/resources/images/2pc.jpg?rev=788816view=auto
==
Binary file - no diff available.

Propchange: 
hadoop/zookeeper/trunk/src/docs/src/documentation/resources/images/2pc.jpg
--
svn:executable = *

Propchange: 
hadoop/zookeeper/trunk/src/docs/src/documentation/resources/images/2pc.jpg
--
svn:mime-type = application/octet-stream




svn commit: r788860 - in /hadoop/zookeeper/trunk: ./ src/java/main/org/apache/zookeeper/ src/java/main/org/apache/zookeeper/server/ src/java/main/org/apache/zookeeper/server/quorum/ src/java/test/org/

2009-06-26 Thread mahadev
Author: mahadev
Date: Fri Jun 26 20:29:54 2009
New Revision: 788860

URL: http://svn.apache.org/viewvc?rev=788860view=rev
Log:
ZOOKEEPER-417. stray message problem when changing servers (breed via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/KeeperException.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/FinalRequestProcessor.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/Request.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/SessionTracker.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/SessionTrackerImpl.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServer.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FollowerHandler.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FollowerSessionTracker.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/LeaderZooKeeperServer.java

hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerMainTest.java

hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/AsyncTest.java

hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/QuorumTest.java

hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/SessionTest.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=788860r1=788859r2=788860view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Fri Jun 26 20:29:54 2009
@@ -133,6 +133,9 @@
 
   ZOOKEEPER-448. png files do nto work with forrest. (mahadev)
 
+  ZOOKEEPER-417. stray message problem when changing servers (breed via
+mahadev)
+
 IMPROVEMENTS:
   ZOOKEEPER-308. improve the atomic broadcast performance 3x.
   (breed via mahadev)

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/KeeperException.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/KeeperException.java?rev=788860r1=788859r2=788860view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/KeeperException.java 
(original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/KeeperException.java 
Fri Jun 26 20:29:54 2009
@@ -118,7 +118,9 @@
 return new SessionExpiredException();
 case INVALIDCALLBACK:
 return new InvalidCallbackException();
-
+case SESSIONMOVED:
+return new SessionMovedException();
+   
 case OK:
 default:
 throw new IllegalArgumentException(Invalid exception code);
@@ -264,6 +266,10 @@
  */
 @Deprecated
 public static final int AuthFailed = -115;
+/**
+ * This value will be used directly in {...@link CODE#SESSIONMOVED}
+ */
+// public static final int SessionMoved = -116;
 }
 
 /** Codes which represent the various KeeperException
@@ -296,7 +302,7 @@
 OPERATIONTIMEOUT (OperationTimeout),
 /** Invalid arguments */
 BADARGUMENTS (BadArguments),
-
+
 /** API errors.
  * This is never thrown by the server, it shouldn't be used other than
  * to indicate a range. Specifically error codes greater than this
@@ -324,7 +330,9 @@
 /** Invalid ACL specified */
 INVALIDACL (InvalidACL),
 /** Client authentication failed */
-AUTHFAILED (AuthFailed);
+AUTHFAILED (AuthFailed),
+/** Session moved to another server, so operation is ignored */
+SESSIONMOVED (-116);
 
 private static final MapInteger,Code lookup
 = new HashMapInteger,Code();
@@ -397,6 +405,8 @@
 return Session expired;
 case INVALIDCALLBACK:
 return Invalid callback;
+case SESSIONMOVED:
+return Session moved;
 default:
 return Unknown error  + code;
 }
@@ -601,6 +611,15 @@
 super(Code.SESSIONEXPIRED);
 }
 }
+
+/**
+ * @see Code#SESSIONMOVED
+ */
+public static class SessionMovedException extends KeeperException {
+public SessionMovedException() {
+super(Code.SESSIONMOVED);
+}
+}
 
 /**
  * @see Code#SYSTEMERROR

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/FinalRequestProcessor.java
URL

svn commit: r788872 - in /hadoop/zookeeper/trunk: CHANGES.txt src/c/include/zookeeper.h src/c/src/zookeeper.c src/java/main/org/apache/zookeeper/KeeperException.java

2009-06-26 Thread mahadev
Author: mahadev
Date: Fri Jun 26 21:15:58 2009
New Revision: 788872

URL: http://svn.apache.org/viewvc?rev=788872view=rev
Log:
ZOOKEEPER-449. sesssionmoved in java code and ZCLOSING in C have the same 
value. (mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/src/c/include/zookeeper.h
hadoop/zookeeper/trunk/src/c/src/zookeeper.c

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/KeeperException.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=788872r1=788871r2=788872view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Fri Jun 26 21:15:58 2009
@@ -136,6 +136,9 @@
   ZOOKEEPER-417. stray message problem when changing servers (breed via
 mahadev)
 
+  ZOOKEEPER-449. sesssionmoved in java code and ZCLOSING in C have the same
+value. (mahadev)
+
 IMPROVEMENTS:
   ZOOKEEPER-308. improve the atomic broadcast performance 3x.
   (breed via mahadev)

Modified: hadoop/zookeeper/trunk/src/c/include/zookeeper.h
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/include/zookeeper.h?rev=788872r1=788871r2=788872view=diff
==
--- hadoop/zookeeper/trunk/src/c/include/zookeeper.h (original)
+++ hadoop/zookeeper/trunk/src/c/include/zookeeper.h Fri Jun 26 21:15:58 2009
@@ -106,7 +106,8 @@
   ZINVALIDACL = -114, /*! Invalid ACL specified */
   ZAUTHFAILED = -115, /*! Client authentication failed */
   ZCLOSING = -116, /*! ZooKeeper is closing */
-  ZNOTHING = -117 /*! (not error) no server responses to process */
+  ZNOTHING = -117, /*! (not error) no server responses to process */
+  ZSESSIONMOVED = -118 /*!session moved to another server, so operation is 
ignored */ 
 };
 
 #ifdef __cplusplus

Modified: hadoop/zookeeper/trunk/src/c/src/zookeeper.c
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/src/zookeeper.c?rev=788872r1=788871r2=788872view=diff
==
--- hadoop/zookeeper/trunk/src/c/src/zookeeper.c (original)
+++ hadoop/zookeeper/trunk/src/c/src/zookeeper.c Fri Jun 26 21:15:58 2009
@@ -2638,6 +2638,8 @@
   return zookeeper is closing;
 case ZNOTHING:
   return (not error) no server responses to process;
+case ZSESSIONMOVED:
+  return session moved to another server, so operation is ignored;
 }
 if (c  0) {
   return strerror(c);

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/KeeperException.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/KeeperException.java?rev=788872r1=788871r2=788872view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/KeeperException.java 
(original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/KeeperException.java 
Fri Jun 26 21:15:58 2009
@@ -269,7 +269,7 @@
 /**
  * This value will be used directly in {...@link CODE#SESSIONMOVED}
  */
-// public static final int SessionMoved = -116;
+// public static final int SessionMoved = -118;
 }
 
 /** Codes which represent the various KeeperException
@@ -332,7 +332,7 @@
 /** Client authentication failed */
 AUTHFAILED (AuthFailed),
 /** Session moved to another server, so operation is ignored */
-SESSIONMOVED (-116);
+SESSIONMOVED (-118);
 
 private static final MapInteger,Code lookup
 = new HashMapInteger,Code();




svn commit: r794899 - in /hadoop/zookeeper/trunk: CHANGES.txt src/c/configure.ac

2009-07-16 Thread mahadev
Author: mahadev
Date: Thu Jul 16 23:09:22 2009
New Revision: 794899

URL: http://svn.apache.org/viewvc?rev=794899view=rev
Log:
ZOOKEEPER-469. make sure CPPUNIT_CFLAGS isn't overwritten (chris via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/src/c/configure.ac

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=794899r1=794898r2=794899view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Thu Jul 16 23:09:22 2009
@@ -7,6 +7,8 @@
 Backward compatible changes:
 
 BUGFIXES: 
+  ZOOKEEPER-469. make sure CPPUNIT_CFLAGS isn't overwritten (chris via
+mahadev)
 
 IMPROVEMENTS:
   ZOOKEEPER-473. cleanup junit tests to eliminate false positives due to

Modified: hadoop/zookeeper/trunk/src/c/configure.ac
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/configure.ac?rev=794899r1=794898r2=794899view=diff
==
--- hadoop/zookeeper/trunk/src/c/configure.ac (original)
+++ hadoop/zookeeper/trunk/src/c/configure.ac Thu Jul 16 23:09:22 2009
@@ -34,9 +34,9 @@
 fi
 
 if test $CALLER = ANT ; then
-CPPUNIT_CFLAGS=-DZKSERVER_CMD=${base_dir}/src/c/tests/zkServer.sh
+CPPUNIT_CFLAGS=$CPPUNIT_CFLAGS 
-DZKSERVER_CMD=${base_dir}/src/c/tests/zkServer.sh
 else
-CPPUNIT_CFLAGS=-DZKSERVER_CMD=./tests/zkServer.sh
+CPPUNIT_CFLAGS=$CPPUNIT_CFLAGS -DZKSERVER_CMD=./tests/zkServer.sh
 AC_CHECK_FILES([generated/zookeeper.jute.c generated/zookeeper.jute.h],[],
 [AC_MSG_ERROR([jute files are missing! Please run ant compile_jute while 
in the zookeeper top level directory.])
 ])




svn commit: r794932 - in /hadoop/zookeeper/trunk: CHANGES.txt src/contrib/zkperl/Changes src/contrib/zkperl/MANIFEST src/contrib/zkperl/Makefile.PL src/contrib/zkperl/README src/contrib/zkperl/ZooKeep

2009-07-16 Thread mahadev
Author: mahadev
Date: Fri Jul 17 01:12:33 2009
New Revision: 794932

URL: http://svn.apache.org/viewvc?rev=794932view=rev
Log:
ZOOKEEPER-471. update zkperl for 3.2.x branch (chris via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/src/contrib/zkperl/Changes
hadoop/zookeeper/trunk/src/contrib/zkperl/MANIFEST
hadoop/zookeeper/trunk/src/contrib/zkperl/Makefile.PL
hadoop/zookeeper/trunk/src/contrib/zkperl/README
hadoop/zookeeper/trunk/src/contrib/zkperl/ZooKeeper.pm
hadoop/zookeeper/trunk/src/contrib/zkperl/t/50_access.t

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=794932r1=794931r2=794932view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Fri Jul 17 01:12:33 2009
@@ -10,6 +10,8 @@
   ZOOKEEPER-469. make sure CPPUNIT_CFLAGS isn't overwritten (chris via
 mahadev)
 
+  ZOOKEEPER-471. update zkperl for 3.2.x branch (chris 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/contrib/zkperl/Changes
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/contrib/zkperl/Changes?rev=794932r1=794931r2=794932view=diff
==
--- hadoop/zookeeper/trunk/src/contrib/zkperl/Changes (original)
+++ hadoop/zookeeper/trunk/src/contrib/zkperl/Changes Fri Jul 17 01:12:33 2009
@@ -51,5 +51,11 @@
 - initial documentation completed, first public release
 
 0.33  Apr 20, 2009
-   - copyright donated to ASF
+- copyright donated to ASF
+
+0.34  Jul 14, 2009
+- support ZooKeeper 3.2.0 release
+
+0.35  Jul 15, 2009
+- support multiple include and library locations
 

Modified: hadoop/zookeeper/trunk/src/contrib/zkperl/MANIFEST
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/contrib/zkperl/MANIFEST?rev=794932r1=794931r2=794932view=diff
==
--- hadoop/zookeeper/trunk/src/contrib/zkperl/MANIFEST (original)
+++ hadoop/zookeeper/trunk/src/contrib/zkperl/MANIFEST Fri Jul 17 01:12:33 2009
@@ -20,3 +20,4 @@
 t/45_class.t
 t/50_access.t
 t/60_watch.t
+t/util.pl

Modified: hadoop/zookeeper/trunk/src/contrib/zkperl/Makefile.PL
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/contrib/zkperl/Makefile.PL?rev=794932r1=794931r2=794932view=diff
==
--- hadoop/zookeeper/trunk/src/contrib/zkperl/Makefile.PL (original)
+++ hadoop/zookeeper/trunk/src/contrib/zkperl/Makefile.PL Fri Jul 17 01:12:33 
2009
@@ -22,22 +22,25 @@
 use ExtUtils::MakeMaker;
 use Getopt::Long;
 
-my $zk_inc_path;
-my $zk_lib_path;
+my @zk_inc_paths;
+my @zk_lib_paths;
 
 GetOptions(
-'zookeeper-include=s' = \$zk_inc_path,
-'zookeeper-lib=s' = \$zk_lib_path
+'zookeeper-include=s' = \...@zk_inc_paths,
+'zookeeper-lib=s' = \...@zk_lib_paths
 );
 
-$zk_inc_path = defined($zk_inc_path) ? -I$zk_inc_path  : '';
-$zk_lib_path = defined($zk_lib_path) ? -L$zk_lib_path  : '';
+my $zk_inc_paths = join(' ', map(-I$_, @zk_inc_paths));
+my $zk_lib_paths = join(' ', map(-L$_, @zk_lib_paths));
+
+$zk_inc_paths .= ' ' unless ($zk_inc_paths eq '');
+$zk_lib_paths .= ' ' unless ($zk_lib_paths eq '');
 
 my $cc = $Config{'cc'};
 my $check_file = 'build/check_zk_version';
 
 my $check_out =
-qx($cc -c $zk_inc_path -I. -c $check_file.c -o $check_file.o 21);
+qx($cc -c $zk_inc_paths -I. -c $check_file.c -o $check_file.o 21);
 
 if ($?) {
 if ($check_out =~ /zookeeper_version\.h/) {
@@ -50,8 +53,8 @@
 }
 
 WriteMakefile(
-'INC'  = $zk_inc_path-I.,
-'LIBS' = [ $zk_lib_path-lzookeeper_mt ],
+'INC'  = $zk_inc_paths-I.,
+'LIBS' = [ $zk_lib_paths-lzookeeper_mt ],
 'NAME' = 'Net::ZooKeeper',
 'VERSION_FROM' = 'ZooKeeper.pm',
 'clean'= { 'FILES' = 'build/check_zk_version.o' }

Modified: hadoop/zookeeper/trunk/src/contrib/zkperl/README
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/contrib/zkperl/README?rev=794932r1=794931r2=794932view=diff
==
--- hadoop/zookeeper/trunk/src/contrib/zkperl/README (original)
+++ hadoop/zookeeper/trunk/src/contrib/zkperl/README Fri Jul 17 01:12:33 2009
@@ -42,12 +42,18 @@
 
 Version 3.1.1 of ZooKeeper is required at a minimum.
 
-You may also want to apply some of these additional patches to
-the ZooKeeper C API code:
+For version 3.1.1, you may also want to apply some of these
+additional patches to the ZooKeeper C API code:
 
 https://issues.apache.org/jira/browse/ZOOKEEPER-262
 https://issues.apache.org

svn commit: r794934 - in /hadoop/zookeeper/branches/branch-3.2: CHANGES.txt src/contrib/zkperl/Changes src/contrib/zkperl/MANIFEST src/contrib/zkperl/Makefile.PL src/contrib/zkperl/README src/contrib/

2009-07-16 Thread mahadev
Author: mahadev
Date: Fri Jul 17 01:13:59 2009
New Revision: 794934

URL: http://svn.apache.org/viewvc?rev=794934view=rev
Log:
ZOOKEEPER-471. update zkperl for 3.2.x branch. (chris via mahadev)

Modified:
hadoop/zookeeper/branches/branch-3.2/CHANGES.txt
hadoop/zookeeper/branches/branch-3.2/src/contrib/zkperl/Changes
hadoop/zookeeper/branches/branch-3.2/src/contrib/zkperl/MANIFEST
hadoop/zookeeper/branches/branch-3.2/src/contrib/zkperl/Makefile.PL
hadoop/zookeeper/branches/branch-3.2/src/contrib/zkperl/README
hadoop/zookeeper/branches/branch-3.2/src/contrib/zkperl/ZooKeeper.pm
hadoop/zookeeper/branches/branch-3.2/src/contrib/zkperl/t/50_access.t

Modified: hadoop/zookeeper/branches/branch-3.2/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/CHANGES.txt?rev=794934r1=794933r2=794934view=diff
==
--- hadoop/zookeeper/branches/branch-3.2/CHANGES.txt (original)
+++ hadoop/zookeeper/branches/branch-3.2/CHANGES.txt Fri Jul 17 01:13:59 2009
@@ -7,6 +7,8 @@
 
   ZOOKEEPER-469. make sure CPPUNIT_CFLAGS isn't overwritten (chris via mahadev)
 
+  ZOOKEEPER-471. update zkperl for 3.2.x branch. (chris via mahadev)
+
 IMPROVEMENTS:
 
 NEW FEATURES:

Modified: hadoop/zookeeper/branches/branch-3.2/src/contrib/zkperl/Changes
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/src/contrib/zkperl/Changes?rev=794934r1=794933r2=794934view=diff
==
--- hadoop/zookeeper/branches/branch-3.2/src/contrib/zkperl/Changes (original)
+++ hadoop/zookeeper/branches/branch-3.2/src/contrib/zkperl/Changes Fri Jul 17 
01:13:59 2009
@@ -51,5 +51,11 @@
 - initial documentation completed, first public release
 
 0.33  Apr 20, 2009
-   - copyright donated to ASF
+- copyright donated to ASF
+
+0.34  Jul 14, 2009
+- support ZooKeeper 3.2.0 release
+
+0.35  Jul 15, 2009
+- support multiple include and library locations
 

Modified: hadoop/zookeeper/branches/branch-3.2/src/contrib/zkperl/MANIFEST
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/src/contrib/zkperl/MANIFEST?rev=794934r1=794933r2=794934view=diff
==
--- hadoop/zookeeper/branches/branch-3.2/src/contrib/zkperl/MANIFEST (original)
+++ hadoop/zookeeper/branches/branch-3.2/src/contrib/zkperl/MANIFEST Fri Jul 17 
01:13:59 2009
@@ -20,3 +20,4 @@
 t/45_class.t
 t/50_access.t
 t/60_watch.t
+t/util.pl

Modified: hadoop/zookeeper/branches/branch-3.2/src/contrib/zkperl/Makefile.PL
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/src/contrib/zkperl/Makefile.PL?rev=794934r1=794933r2=794934view=diff
==
--- hadoop/zookeeper/branches/branch-3.2/src/contrib/zkperl/Makefile.PL 
(original)
+++ hadoop/zookeeper/branches/branch-3.2/src/contrib/zkperl/Makefile.PL Fri Jul 
17 01:13:59 2009
@@ -22,22 +22,25 @@
 use ExtUtils::MakeMaker;
 use Getopt::Long;
 
-my $zk_inc_path;
-my $zk_lib_path;
+my @zk_inc_paths;
+my @zk_lib_paths;
 
 GetOptions(
-'zookeeper-include=s' = \$zk_inc_path,
-'zookeeper-lib=s' = \$zk_lib_path
+'zookeeper-include=s' = \...@zk_inc_paths,
+'zookeeper-lib=s' = \...@zk_lib_paths
 );
 
-$zk_inc_path = defined($zk_inc_path) ? -I$zk_inc_path  : '';
-$zk_lib_path = defined($zk_lib_path) ? -L$zk_lib_path  : '';
+my $zk_inc_paths = join(' ', map(-I$_, @zk_inc_paths));
+my $zk_lib_paths = join(' ', map(-L$_, @zk_lib_paths));
+
+$zk_inc_paths .= ' ' unless ($zk_inc_paths eq '');
+$zk_lib_paths .= ' ' unless ($zk_lib_paths eq '');
 
 my $cc = $Config{'cc'};
 my $check_file = 'build/check_zk_version';
 
 my $check_out =
-qx($cc -c $zk_inc_path -I. -c $check_file.c -o $check_file.o 21);
+qx($cc -c $zk_inc_paths -I. -c $check_file.c -o $check_file.o 21);
 
 if ($?) {
 if ($check_out =~ /zookeeper_version\.h/) {
@@ -50,8 +53,8 @@
 }
 
 WriteMakefile(
-'INC'  = $zk_inc_path-I.,
-'LIBS' = [ $zk_lib_path-lzookeeper_mt ],
+'INC'  = $zk_inc_paths-I.,
+'LIBS' = [ $zk_lib_paths-lzookeeper_mt ],
 'NAME' = 'Net::ZooKeeper',
 'VERSION_FROM' = 'ZooKeeper.pm',
 'clean'= { 'FILES' = 'build/check_zk_version.o' }

Modified: hadoop/zookeeper/branches/branch-3.2/src/contrib/zkperl/README
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/src/contrib/zkperl/README?rev=794934r1=794933r2=794934view=diff
==
--- hadoop/zookeeper/branches/branch-3.2/src/contrib/zkperl/README (original)
+++ hadoop/zookeeper/branches/branch-3.2/src/contrib/zkperl/README Fri Jul 17 
01:13:59 2009
@@ -42,12 +42,18 @@
 
 Version 3.1.1 of ZooKeeper is required at a minimum.
 
-You may also want

svn commit: r796045 - in /hadoop/zookeeper/trunk: CHANGES.txt src/c/tests/TestClient.cc src/c/tests/TestClientRetry.cc

2009-07-20 Thread mahadev
Author: mahadev
Date: Mon Jul 20 22:30:40 2009
New Revision: 796045

URL: http://svn.apache.org/viewvc?rev=796045view=rev
Log:
ZOOKEEPER-470. include unistd.h for sleep() in c tests (chris via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/src/c/tests/TestClient.cc
hadoop/zookeeper/trunk/src/c/tests/TestClientRetry.cc

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=796045r1=796044r2=796045view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Mon Jul 20 22:30:40 2009
@@ -12,6 +12,8 @@
 
   ZOOKEEPER-471. update zkperl for 3.2.x branch (chris via mahadev)
 
+  ZOOKEEPER-470. include unistd.h for sleep() in c tests (chris 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/c/tests/TestClient.cc
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/tests/TestClient.cc?rev=796045r1=796044r2=796045view=diff
==
--- hadoop/zookeeper/trunk/src/c/tests/TestClient.cc (original)
+++ hadoop/zookeeper/trunk/src/c/tests/TestClient.cc Mon Jul 20 22:30:40 2009
@@ -20,6 +20,7 @@
 #include CppAssertHelper.h
 
 #include stdlib.h
+#include unistd.h
 #include sys/select.h
 
 #include CollectionUtil.h

Modified: hadoop/zookeeper/trunk/src/c/tests/TestClientRetry.cc
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/tests/TestClientRetry.cc?rev=796045r1=796044r2=796045view=diff
==
--- hadoop/zookeeper/trunk/src/c/tests/TestClientRetry.cc (original)
+++ hadoop/zookeeper/trunk/src/c/tests/TestClientRetry.cc Mon Jul 20 22:30:40 
2009
@@ -20,6 +20,7 @@
 #include CppAssertHelper.h
 
 #include stdlib.h
+#include unistd.h
 #include sys/select.h
 
 #include CollectionUtil.h




svn commit: r796048 - in /hadoop/zookeeper/branches/branch-3.2: CHANGES.txt src/c/tests/TestClient.cc src/c/tests/TestClientRetry.cc

2009-07-20 Thread mahadev
Author: mahadev
Date: Mon Jul 20 22:55:34 2009
New Revision: 796048

URL: http://svn.apache.org/viewvc?rev=796048view=rev
Log:
ZOOKEEPER-470. include unistd.h for sleep() in c tests (chris via mahadev)

Modified:
hadoop/zookeeper/branches/branch-3.2/CHANGES.txt
hadoop/zookeeper/branches/branch-3.2/src/c/tests/TestClient.cc
hadoop/zookeeper/branches/branch-3.2/src/c/tests/TestClientRetry.cc

Modified: hadoop/zookeeper/branches/branch-3.2/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/CHANGES.txt?rev=796048r1=796047r2=796048view=diff
==
--- hadoop/zookeeper/branches/branch-3.2/CHANGES.txt (original)
+++ hadoop/zookeeper/branches/branch-3.2/CHANGES.txt Mon Jul 20 22:55:34 2009
@@ -9,6 +9,8 @@
 
   ZOOKEEPER-471. update zkperl for 3.2.x branch. (chris via mahadev)
 
+  ZOOKEEPER-470. include unistd.h for sleep() in c tests (chris via mahadev)
+
 IMPROVEMENTS:
 
 NEW FEATURES:

Modified: hadoop/zookeeper/branches/branch-3.2/src/c/tests/TestClient.cc
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/src/c/tests/TestClient.cc?rev=796048r1=796047r2=796048view=diff
==
--- hadoop/zookeeper/branches/branch-3.2/src/c/tests/TestClient.cc (original)
+++ hadoop/zookeeper/branches/branch-3.2/src/c/tests/TestClient.cc Mon Jul 20 
22:55:34 2009
@@ -20,6 +20,7 @@
 #include CppAssertHelper.h
 
 #include stdlib.h
+#include unistd.h
 #include sys/select.h
 
 #include CollectionUtil.h

Modified: hadoop/zookeeper/branches/branch-3.2/src/c/tests/TestClientRetry.cc
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/src/c/tests/TestClientRetry.cc?rev=796048r1=796047r2=796048view=diff
==
--- hadoop/zookeeper/branches/branch-3.2/src/c/tests/TestClientRetry.cc 
(original)
+++ hadoop/zookeeper/branches/branch-3.2/src/c/tests/TestClientRetry.cc Mon Jul 
20 22:55:34 2009
@@ -20,6 +20,7 @@
 #include CppAssertHelper.h
 
 #include stdlib.h
+#include unistd.h
 #include sys/select.h
 
 #include CollectionUtil.h




svn commit: r796531 - in /hadoop/zookeeper/trunk: CHANGES.txt build.xml

2009-07-21 Thread mahadev
Author: mahadev
Date: Tue Jul 21 21:00:33 2009
New Revision: 796531

URL: http://svn.apache.org/viewvc?rev=796531view=rev
Log:
ZOOKEEPR-460. bad testRetry in cppunit tests (hudson failure) (giri via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/build.xml

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=796531r1=796530r2=796531view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Tue Jul 21 21:00:33 2009
@@ -14,6 +14,9 @@
 
   ZOOKEEPER-470. include unistd.h for sleep() in c tests (chris via mahadev)
 
+  ZOOKEEPR-460. bad testRetry in cppunit tests (hudson failure) (giri 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/build.xml
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/build.xml?rev=796531r1=796530r2=796531view=diff
==
--- hadoop/zookeeper/trunk/build.xml (original)
+++ hadoop/zookeeper/trunk/build.xml Tue Jul 21 21:00:33 2009
@@ -704,6 +704,7 @@
env key=LD_LIBRARY_PATH value=${lib.cppunit}/
env key=PATH path=${env.PATH};${c.src.dir};/
 env key=CALLER value=ANT/
+env key=CLOVER_HOME value={clover.home}/
 env key=base_dir value=${basedir}/
arg line=clean run-check/
/exec




svn commit: r796532 - in /hadoop/zookeeper/branches/branch-3.2: CHANGES.txt build.xml

2009-07-21 Thread mahadev
Author: mahadev
Date: Tue Jul 21 21:02:00 2009
New Revision: 796532

URL: http://svn.apache.org/viewvc?rev=796532view=rev
Log:
ZOOKEEPER-460. bad testRetry in cppunit tests (hudson failure) (giri via 
mahadev)

Modified:
hadoop/zookeeper/branches/branch-3.2/CHANGES.txt
hadoop/zookeeper/branches/branch-3.2/build.xml

Modified: hadoop/zookeeper/branches/branch-3.2/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/CHANGES.txt?rev=796532r1=796531r2=796532view=diff
==
--- hadoop/zookeeper/branches/branch-3.2/CHANGES.txt (original)
+++ hadoop/zookeeper/branches/branch-3.2/CHANGES.txt Tue Jul 21 21:02:00 2009
@@ -11,6 +11,9 @@
 
   ZOOKEEPER-470. include unistd.h for sleep() in c tests (chris via mahadev)
 
+  ZOOKEEPER-460. bad testRetry in cppunit tests (hudson failure) (giri via
+mahadev)
+
 IMPROVEMENTS:
 
 NEW FEATURES:

Modified: hadoop/zookeeper/branches/branch-3.2/build.xml
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/build.xml?rev=796532r1=796531r2=796532view=diff
==
--- hadoop/zookeeper/branches/branch-3.2/build.xml (original)
+++ hadoop/zookeeper/branches/branch-3.2/build.xml Tue Jul 21 21:02:00 2009
@@ -704,6 +704,7 @@
env key=LD_LIBRARY_PATH value=${lib.cppunit}/
env key=PATH path=${env.PATH};${c.src.dir};/
 env key=CALLER value=ANT/
+env key=CLOVER_HOME value={clover.home}/
 env key=base_dir value=${basedir}/
arg line=clean run-check/
/exec




svn commit: r799452 - in /hadoop/zookeeper/trunk: CHANGES.txt src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/BookieHandle.java

2009-07-30 Thread mahadev
Author: mahadev
Date: Thu Jul 30 21:52:38 2009
New Revision: 799452

URL: http://svn.apache.org/viewvc?rev=799452view=rev
Log:
ZOOKEEPER-467.  Change log level in BookieHandle. (flavio via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt

hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/BookieHandle.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=799452r1=799451r2=799452view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Thu Jul 30 21:52:38 2009
@@ -17,6 +17,8 @@
   ZOOKEEPR-460. bad testRetry in cppunit tests (hudson failure) (giri via
 mahadev)
 
+  ZOOKEEPER-467.  Change log level in BookieHandle. (flavio 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/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/BookieHandle.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/BookieHandle.java?rev=799452r1=799451r2=799452view=diff
==
--- 
hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/BookieHandle.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/BookieHandle.java
 Thu Jul 30 21:52:38 2009
@@ -247,7 +247,7 @@
 else ((SubReadOp) ts.ctx).rcb.readEntryComplete(-1, 
ts.lh.getId(), ts.entry, null, ts.ctx);
 break;
 }
-} else LOG.warn(Empty queue:  + addr);
+} else LOG.debug(Empty queue:  + addr);
 }
 } catch (Exception e){
 LOG.error(Handling exception before halting BookieHandle, e);




svn commit: r800574 - in /hadoop/zookeeper/trunk: CHANGES.txt src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java src/java/test/org/apache/zookeeper/test/CnxManagerTest.java

2009-08-03 Thread mahadev
Author: mahadev
Date: Mon Aug  3 21:27:09 2009
New Revision: 800574

URL: http://svn.apache.org/viewvc?rev=800574view=rev
Log:
ZOOKEEPER-481. Add lastMessageSent to QuorumCnxManager. (flavio via mahadev)

Added:

hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/CnxManagerTest.java
Modified:
hadoop/zookeeper/trunk/CHANGES.txt

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=800574r1=800573r2=800574view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Mon Aug  3 21:27:09 2009
@@ -27,6 +27,9 @@
   ZOOKEEPER-457. Make ZookeeperMain public, support for HBase (and other)
   embedded clients (ryan rawson via phunt)
 
+  ZOOKEEPER-481. Add lastMessageSent to QuorumCnxManager. (flavio 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/server/quorum/QuorumCnxManager.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java?rev=800574r1=800573r2=800574view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
 Mon Aug  3 21:27:09 2009
@@ -78,11 +78,12 @@
  */
 ConcurrentHashMapLong, SendWorker senderWorkerMap;
 ConcurrentHashMapLong, ArrayBlockingQueueByteBuffer queueSendMap;
+ConcurrentHashMapLong, ByteBuffer lastMessageSent;
 
 /*
  * Reception queue
  */
-ArrayBlockingQueueMessage recvQueue;
+public ArrayBlockingQueueMessage recvQueue;
 
 /*
  * Shutdown flag
@@ -93,7 +94,7 @@
 /*
  * Listener thread
  */
-Listener listener;
+public Listener listener;
 
 static class Message {
 Message(ByteBuffer buffer, long sid) {
@@ -109,6 +110,8 @@
 this.recvQueue = new ArrayBlockingQueueMessage(CAPACITY);
 this.queueSendMap = new ConcurrentHashMapLong, 
ArrayBlockingQueueByteBuffer();
 this.senderWorkerMap = new ConcurrentHashMapLong, SendWorker();
+this.lastMessageSent = new ConcurrentHashMapLong, ByteBuffer();
+
 this.self = self;
 
 // Starts listener thread that waits for connection requests 
@@ -116,11 +119,25 @@
 }
 
 /**
+ * Invokes initiateConnection for testing purposes
+ * 
+ * @param sid
+ */
+public void testInitiateConnection(long sid) throws Exception {
+SocketChannel channel;
+LOG.debug(Opening channel to server   + sid);
+channel = SocketChannel
+.open(self.quorumPeers.get(sid).electionAddr);
+channel.socket().setTcpNoDelay(true);
+initiateConnection(channel, sid);
+}
+
+/**
  * If this server has initiated the connection, then it gives up on the
  * connection if it loses challenge. Otherwise, it keeps the connection.
  */
 
-boolean initiateConnection(SocketChannel s, Long sid) {
+public boolean initiateConnection(SocketChannel s, Long sid) {
  try {
 // Sending id and challenge
 byte[] msgBytes = new byte[8];
@@ -144,31 +161,26 @@
 + reopen connection: , e);
 }
 // Otherwise proceed with the connection
-} else {
-   SendWorker sw = new SendWorker(s, sid);
-   RecvWorker rw = new RecvWorker(s, sid);
-   sw.setRecv(rw);
-   
-   if (senderWorkerMap
-   .containsKey(sid)) {
-   SendWorker vsw = senderWorkerMap.get(sid);
-   if(vsw != null)
-   vsw.finish();
-   else LOG.error(No SendWorker for this identifier ( + sid 
+ ));
-   } else {
-   LOG.error(Cannot open channel to server   + sid);
-   }
-
-   if (!queueSendMap.containsKey(sid)) {
-   queueSendMap.put(sid, new 
ArrayBlockingQueueByteBuffer(
-   CAPACITY));
-   }
-
-   senderWorkerMap.put(sid, sw);
-   sw.start();
-   rw.start();
+} else {
+SendWorker sw = new SendWorker(s, sid);
+RecvWorker rw = new RecvWorker(s, sid);
+sw.setRecv(rw);
+
+SendWorker vsw = senderWorkerMap.get(sid);
+senderWorkerMap.put(sid, sw

svn commit: r800597 - in /hadoop/zookeeper/trunk: ./ src/java/main/org/apache/zookeeper/server/quorum/flexible/ src/java/test/org/apache/zookeeper/test/

2009-08-03 Thread mahadev
Author: mahadev
Date: Mon Aug  3 22:28:19 2009
New Revision: 800597

URL: http://svn.apache.org/viewvc?rev=800597view=rev
Log:
ZOOKEEPER-479.  QuorumHierarchical does not count groups correctly (flavio via 
mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/flexible/QuorumHierarchical.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/flexible/QuorumMaj.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/flexible/QuorumVerifier.java

hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/HierarchicalQuorumTest.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=800597r1=800596r2=800597view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Mon Aug  3 22:28:19 2009
@@ -30,6 +30,9 @@
   ZOOKEEPER-481. Add lastMessageSent to QuorumCnxManager. (flavio via
 mahadev)
 
+  ZOOKEEPER-479.  QuorumHierarchical does not count groups correctly (flavio
+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/server/quorum/flexible/QuorumHierarchical.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/flexible/QuorumHierarchical.java?rev=800597r1=800596r2=800597view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/flexible/QuorumHierarchical.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/flexible/QuorumHierarchical.java
 Mon Aug  3 22:28:19 2009
@@ -104,12 +104,15 @@
 LOG.info(serverWeight.size() + ,  + serverGroup.size() + ,  + 
groupWeight.size());
 }
 
-/**
- * This contructor takes the two hash maps needed to enable 
- * validating quorums. We use it with QuorumPeerConfig. That is,
- * we declare weights and groups in the server configuration
- * file along with the other parameters.
- */
+   /**
+*  This contructor takes the two hash maps needed to enable 
+*  validating quorums. We use it with QuorumPeerConfig. That is,
+*  we declare weights and groups in the server configuration
+*  file along with the other parameters.
+* @param numGroups
+* @param serverWeight
+* @param serverGroup
+*/
 public QuorumHierarchical(int numGroups,
 HashMapLong, Long serverWeight,
 HashMapLong, Long serverGroup)
@@ -124,6 +127,15 @@
 
 
 /**
+ * Returns the weight of a server.
+ * 
+ * @param id
+ */
+public long getWeight(long id){
+return serverWeight.get(id);
+}
+
+/**
  * Reads a configration file. Called from the constructor
  * that takes a file as an input.
  */
@@ -200,9 +212,15 @@
 else {
 long totalWeight = serverWeight.get(sid) + 
groupWeight.get(gid);
 groupWeight.put(gid, totalWeight);
-}
-
-}
+} 
+}
+
+/*
+ * Do not consider groups with weight zero
+ */
+for(long weight: groupWeight.values()){
+if(weight == 0) numGroups--;
+}
 }
 
 /**
@@ -230,14 +248,14 @@
 /*
  * Check if all groups have majority
  */
-boolean majPerGroup = true;
+int majGroupCounter = 0;
 for(long gid : expansion.keySet()) {
 LOG.info(gid:  + expansion.get(gid));
-if(expansion.get(gid) = (groupWeight.get(gid) / 2) )
-majPerGroup = false;
+if(expansion.get(gid)  (groupWeight.get(gid) / 2) )
+majGroupCounter++;
 }
 
-if((expansion.size()  (numGroups / 2))  majPerGroup){
+if((majGroupCounter  (numGroups / 2))){
 LOG.info(Positive set size:  + set.size());
 return true;
 }

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/flexible/QuorumMaj.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/flexible/QuorumMaj.java?rev=800597r1=800596r2=800597view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/flexible/QuorumMaj.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/flexible/QuorumMaj.java
 Mon Aug  3 22:28:19 2009
@@ -31,12 +31,23

svn commit: r800598 - in /hadoop/zookeeper/branches/branch-3.2: ./ src/java/main/org/apache/zookeeper/server/quorum/flexible/ src/java/test/org/apache/zookeeper/test/

2009-08-03 Thread mahadev
Author: mahadev
Date: Mon Aug  3 22:29:42 2009
New Revision: 800598

URL: http://svn.apache.org/viewvc?rev=800598view=rev
Log:
ZOOKEEPER-479.  QuorumHierarchical does not count groups correctly (flavio via 
mahadev)

Modified:
hadoop/zookeeper/branches/branch-3.2/CHANGES.txt

hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/flexible/QuorumHierarchical.java

hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/flexible/QuorumMaj.java

hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/flexible/QuorumVerifier.java

hadoop/zookeeper/branches/branch-3.2/src/java/test/org/apache/zookeeper/test/HierarchicalQuorumTest.java

Modified: hadoop/zookeeper/branches/branch-3.2/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/CHANGES.txt?rev=800598r1=800597r2=800598view=diff
==
--- hadoop/zookeeper/branches/branch-3.2/CHANGES.txt (original)
+++ hadoop/zookeeper/branches/branch-3.2/CHANGES.txt Mon Aug  3 22:29:42 2009
@@ -26,6 +26,9 @@
 
   ZOOKEEPER-481. Add lastMessageSent to QuorumCnxManager. (flavio via mahadev)
 
+  ZOOKEEPER-479.  QuorumHierarchical does not count groups correctly (flavio
+via mahadev)
+
 IMPROVEMENTS:
 
 NEW FEATURES:

Modified: 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/flexible/QuorumHierarchical.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/flexible/QuorumHierarchical.java?rev=800598r1=800597r2=800598view=diff
==
--- 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/flexible/QuorumHierarchical.java
 (original)
+++ 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/flexible/QuorumHierarchical.java
 Mon Aug  3 22:29:42 2009
@@ -104,12 +104,15 @@
 LOG.info(serverWeight.size() + ,  + serverGroup.size() + ,  + 
groupWeight.size());
 }
 
-/**
- * This contructor takes the two hash maps needed to enable 
- * validating quorums. We use it with QuorumPeerConfig. That is,
- * we declare weights and groups in the server configuration
- * file along with the other parameters.
- */
+   /**
+*  This contructor takes the two hash maps needed to enable 
+*  validating quorums. We use it with QuorumPeerConfig. That is,
+*  we declare weights and groups in the server configuration
+*  file along with the other parameters.
+* @param numGroups
+* @param serverWeight
+* @param serverGroup
+*/
 public QuorumHierarchical(int numGroups,
 HashMapLong, Long serverWeight,
 HashMapLong, Long serverGroup)
@@ -124,6 +127,15 @@
 
 
 /**
+ * Returns the weight of a server.
+ * 
+ * @param id
+ */
+public long getWeight(long id){
+return serverWeight.get(id);
+}
+
+/**
  * Reads a configration file. Called from the constructor
  * that takes a file as an input.
  */
@@ -200,9 +212,15 @@
 else {
 long totalWeight = serverWeight.get(sid) + 
groupWeight.get(gid);
 groupWeight.put(gid, totalWeight);
-}
-
-}
+} 
+}
+
+/*
+ * Do not consider groups with weight zero
+ */
+for(long weight: groupWeight.values()){
+if(weight == 0) numGroups--;
+}
 }
 
 /**
@@ -230,14 +248,14 @@
 /*
  * Check if all groups have majority
  */
-boolean majPerGroup = true;
+int majGroupCounter = 0;
 for(long gid : expansion.keySet()) {
 LOG.info(gid:  + expansion.get(gid));
-if(expansion.get(gid) = (groupWeight.get(gid) / 2) )
-majPerGroup = false;
+if(expansion.get(gid)  (groupWeight.get(gid) / 2) )
+majGroupCounter++;
 }
 
-if((expansion.size()  (numGroups / 2))  majPerGroup){
+if((majGroupCounter  (numGroups / 2))){
 LOG.info(Positive set size:  + set.size());
 return true;
 }

Modified: 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/flexible/QuorumMaj.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/flexible/QuorumMaj.java?rev=800598r1=800597r2=800598view=diff
==
--- 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/flexible/QuorumMaj.java
 (original)
+++ 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org

svn commit: r800891 - in /hadoop/zookeeper/trunk: CHANGES.txt src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java src/java/test/org/apache/zookeeper/test/FLELostMessageTest.java

2009-08-04 Thread mahadev
Author: mahadev
Date: Tue Aug  4 17:59:58 2009
New Revision: 800891

URL: http://svn.apache.org/viewvc?rev=800891view=rev
Log:
ZOOKEEPER-480. FLE should perform leader check when node is not leading and add 
vote of follower (flavio via mahadev)

Added:

hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/FLELostMessageTest.java
Modified:
hadoop/zookeeper/trunk/CHANGES.txt

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=800891r1=800890r2=800891view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Tue Aug  4 17:59:58 2009
@@ -35,6 +35,9 @@
   ZOOKEEPER-466. crash on zookeeper_close() when using auth with empty cert
   (Chris Darroch via phunt)
 
+  ZOOKEEPER-480. FLE should perform leader check when node is not leading and
+  add vote of follower (flavio 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/server/quorum/FastLeaderElection.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java?rev=800891r1=800890r2=800891view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java
 Tue Aug  4 17:59:58 2009
@@ -490,9 +490,20 @@
 long epoch){
 
 boolean predicate = true;
-if(votes.get(leader) == null) predicate = false;
-else if(votes.get(leader).state != ServerState.LEADING) predicate = 
false;
+
+/*
+ * If everyone else thinks I'm the leader, I must be the leader.
+ * The other two checks are just for the case in which I'm not the
+ * leader. If I'm not the leader and I haven't received a message 
+ * from leader stating that it is leading, then predicate is false.
  
+ */
+
+if(leader != self.getId()){
+if(votes.get(leader) == null) predicate = false;
+else if(votes.get(leader).state != ServerState.LEADING) predicate 
= false;
+}
 
+//LOG.info(Leader predicate:  + predicate);
 return predicate;
 }
 
@@ -643,13 +654,18 @@
  * this leader, then processes will naturally move
  * to a new epoch.
  */
-if((n.state == ServerState.LEADING)  
-(n.epoch == logicalclock)){
-self.setPeerState((n.leader == self.getId()) ? 
-ServerState.LEADING: 
ServerState.FOLLOWING);
+if(n.epoch == logicalclock){
+recvset.put(n.sid, new Vote(n.leader, n.zxid, 
n.epoch));
+if((n.state == ServerState.LEADING) ||
+(termPredicate(recvset, new Vote(n.leader,
+n.zxid, n.epoch, n.state))
+ checkLeader(outofelection, 
n.leader, n.epoch)) ){
+self.setPeerState((n.leader == self.getId()) ? 
+ServerState.LEADING: 
ServerState.FOLLOWING);

-leaveInstance();
-return new Vote(n.leader, n.zxid);
+leaveInstance();
+return new Vote(n.leader, n.zxid);
+} 
 }
 
 LOG.info(Notification:  + n.leader + ,  + n.zxid + 
@@ -671,6 +687,7 @@
 leaveInstance();
 return new Vote(n.leader, n.zxid);
 }
+
 break;
 }
 }

Added: 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/FLELostMessageTest.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/FLELostMessageTest.java?rev=800891view=auto
==
--- 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/FLELostMessageTest.java
 (added)
+++ 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/FLELostMessageTest.java
 Tue

svn commit: r800893 - in /hadoop/zookeeper/branches/branch-3.2: CHANGES.txt src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java

2009-08-04 Thread mahadev
Author: mahadev
Date: Tue Aug  4 18:05:13 2009
New Revision: 800893

URL: http://svn.apache.org/viewvc?rev=800893view=rev
Log:
ZOOKEEPER-480. FLE should perform leader check when node is not leading and add 
vote of follower (flavio via mahadev)

Modified:
hadoop/zookeeper/branches/branch-3.2/CHANGES.txt

hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java

Modified: hadoop/zookeeper/branches/branch-3.2/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/CHANGES.txt?rev=800893r1=800892r2=800893view=diff
==
--- hadoop/zookeeper/branches/branch-3.2/CHANGES.txt (original)
+++ hadoop/zookeeper/branches/branch-3.2/CHANGES.txt Tue Aug  4 18:05:13 2009
@@ -32,6 +32,9 @@
   ZOOKEEPER-466. crash on zookeeper_close() when using auth with empty cert
   (Chris Darroch via phunt)
 
+  ZOOKEEPER-480. FLE should perform leader check when node is not leading and
+  add vote of follower (flavio via mahadev)
+
 IMPROVEMENTS:
 
 NEW FEATURES:

Modified: 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java?rev=800893r1=800892r2=800893view=diff
==
--- 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java
 (original)
+++ 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java
 Tue Aug  4 18:05:13 2009
@@ -490,9 +490,20 @@
 long epoch){
 
 boolean predicate = true;
-if(votes.get(leader) == null) predicate = false;
-else if(votes.get(leader).state != ServerState.LEADING) predicate = 
false;
+
+/*
+ * If everyone else thinks I'm the leader, I must be the leader.
+ * The other two checks are just for the case in which I'm not the
+ * leader. If I'm not the leader and I haven't received a message 
+ * from leader stating that it is leading, then predicate is false.
  
+ */
+
+if(leader != self.getId()){
+if(votes.get(leader) == null) predicate = false;
+else if(votes.get(leader).state != ServerState.LEADING) predicate 
= false;
+}
 
+//LOG.info(Leader predicate:  + predicate);
 return predicate;
 }
 
@@ -643,13 +654,18 @@
  * this leader, then processes will naturally move
  * to a new epoch.
  */
-if((n.state == ServerState.LEADING)  
-(n.epoch == logicalclock)){
-self.setPeerState((n.leader == self.getId()) ? 
-ServerState.LEADING: 
ServerState.FOLLOWING);
+if(n.epoch == logicalclock){
+recvset.put(n.sid, new Vote(n.leader, n.zxid, 
n.epoch));
+if((n.state == ServerState.LEADING) ||
+(termPredicate(recvset, new Vote(n.leader,
+n.zxid, n.epoch, n.state))
+ checkLeader(outofelection, 
n.leader, n.epoch)) ){
+self.setPeerState((n.leader == self.getId()) ? 
+ServerState.LEADING: 
ServerState.FOLLOWING);

-leaveInstance();
-return new Vote(n.leader, n.zxid);
+leaveInstance();
+return new Vote(n.leader, n.zxid);
+} 
 }
 
 LOG.info(Notification:  + n.leader + ,  + n.zxid + 
@@ -671,6 +687,7 @@
 leaveInstance();
 return new Vote(n.leader, n.zxid);
 }
+
 break;
 }
 }




svn commit: r800895 - in /hadoop/zookeeper/trunk: CHANGES.txt src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java src/java/test/org/apache/zookeeper/test/FLEZeroWeightTest.java

2009-08-04 Thread mahadev
Author: mahadev
Date: Tue Aug  4 18:11:16 2009
New Revision: 800895

URL: http://svn.apache.org/viewvc?rev=800895view=rev
Log:
ZOOKEEPER-491. Prevent zero-weight servers from being elected. (flavio via 
mahadev)

Added:

hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/FLEZeroWeightTest.java
Modified:
hadoop/zookeeper/trunk/CHANGES.txt

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=800895r1=800894r2=800895view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Tue Aug  4 18:11:16 2009
@@ -38,6 +38,9 @@
   ZOOKEEPER-480. FLE should perform leader check when node is not leading and
   add vote of follower (flavio via mahadev)
 
+  ZOOKEEPER-491. Prevent zero-weight servers from being elected. (flavio 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/server/quorum/FastLeaderElection.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java?rev=800895r1=800894r2=800895view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java
 Tue Aug  4 18:11:16 2009
@@ -577,8 +577,7 @@
tmpTimeOut : maxNotificationInterval);
LOG.info(Notification time out:  + notTimeout);
 }
-else { 
-//notTimeout = finalizeWait;
+else{
 switch (n.state) { 
 case LOOKING:
 // If notification  current, replace and send 
messages out
@@ -607,7 +606,11 @@
 }
 
 LOG.info(Adding vote);
-recvset.put(n.sid, new Vote(n.leader, n.zxid, 
n.epoch));
+/*
+ * Skip zero-weight servers
+ */
+if(self.getQuorumVerifier().getWeight(n.sid) != 0) 
+recvset.put(n.sid, new Vote(n.leader, n.zxid, 
n.epoch));
 
 //If have received from all nodes, then terminate
 if (self.quorumPeers.size() == recvset.size()) {

Added: 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/FLEZeroWeightTest.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/FLEZeroWeightTest.java?rev=800895view=auto
==
--- 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/FLEZeroWeightTest.java
 (added)
+++ 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/FLEZeroWeightTest.java
 Tue Aug  4 18:11:16 2009
@@ -0,0 +1,181 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * License); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zookeeper.test;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.net.InetSocketAddress;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Properties;
+import java.util.Random;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.Logger;
+import org.apache.zookeeper.PortAssignment;
+import org.apache.zookeeper.server.quorum.FastLeaderElection;
+import org.apache.zookeeper.server.quorum.QuorumPeer;
+import org.apache.zookeeper.server.quorum.Vote;
+import org.apache.zookeeper.server.quorum.QuorumPeer.QuorumServer;
+import org.apache.zookeeper.server.quorum.QuorumPeer.ServerState;
+import org.apache.zookeeper.server.quorum.flexible.QuorumHierarchical;
+import

svn commit: r800897 - in /hadoop/zookeeper/branches/branch-3.2: CHANGES.txt src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java src/java/test/org/apache/zookeeper/test/FLEZeroWeig

2009-08-04 Thread mahadev
Author: mahadev
Date: Tue Aug  4 18:15:08 2009
New Revision: 800897

URL: http://svn.apache.org/viewvc?rev=800897view=rev
Log:
ZOOKEEPER-491. Prevent zero-weight servers from being elected (flavio via 
mahadev)

Added:

hadoop/zookeeper/branches/branch-3.2/src/java/test/org/apache/zookeeper/test/FLEZeroWeightTest.java
Modified:
hadoop/zookeeper/branches/branch-3.2/CHANGES.txt

hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java

Modified: hadoop/zookeeper/branches/branch-3.2/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/CHANGES.txt?rev=800897r1=800896r2=800897view=diff
==
--- hadoop/zookeeper/branches/branch-3.2/CHANGES.txt (original)
+++ hadoop/zookeeper/branches/branch-3.2/CHANGES.txt Tue Aug  4 18:15:08 2009
@@ -35,6 +35,9 @@
   ZOOKEEPER-480. FLE should perform leader check when node is not leading and
   add vote of follower (flavio via mahadev)
 
+  ZOOKEEPER-491. Prevent zero-weight servers from being elected (flavio via
+  mahadev)
+
 IMPROVEMENTS:
 
 NEW FEATURES:

Modified: 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java?rev=800897r1=800896r2=800897view=diff
==
--- 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java
 (original)
+++ 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java
 Tue Aug  4 18:15:08 2009
@@ -577,8 +577,7 @@
tmpTimeOut : maxNotificationInterval);
LOG.info(Notification time out:  + notTimeout);
 }
-else { 
-//notTimeout = finalizeWait;
+else{
 switch (n.state) { 
 case LOOKING:
 // If notification  current, replace and send 
messages out
@@ -607,7 +606,11 @@
 }
 
 LOG.info(Adding vote);
-recvset.put(n.sid, new Vote(n.leader, n.zxid, 
n.epoch));
+/*
+ * Skip zero-weight servers
+ */
+if(self.getQuorumVerifier().getWeight(n.sid) != 0) 
+recvset.put(n.sid, new Vote(n.leader, n.zxid, 
n.epoch));
 
 //If have received from all nodes, then terminate
 if (self.quorumPeers.size() == recvset.size()) {

Added: 
hadoop/zookeeper/branches/branch-3.2/src/java/test/org/apache/zookeeper/test/FLEZeroWeightTest.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/src/java/test/org/apache/zookeeper/test/FLEZeroWeightTest.java?rev=800897view=auto
==
--- 
hadoop/zookeeper/branches/branch-3.2/src/java/test/org/apache/zookeeper/test/FLEZeroWeightTest.java
 (added)
+++ 
hadoop/zookeeper/branches/branch-3.2/src/java/test/org/apache/zookeeper/test/FLEZeroWeightTest.java
 Tue Aug  4 18:15:08 2009
@@ -0,0 +1,183 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * License); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zookeeper.test;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.net.InetSocketAddress;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Properties;
+import java.util.Random;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.Logger;
+import org.apache.zookeeper.server.quorum.FastLeaderElection;
+import org.apache.zookeeper.server.quorum.QuorumPeer;
+import org.apache.zookeeper.server.quorum.Vote;
+import org.apache.zookeeper.server.quorum.QuorumPeer.QuorumServer;
+import org.apache.zookeeper.server.quorum.QuorumPeer.ServerState;
+import

svn commit: r801839 - in /hadoop/zookeeper/trunk: ./ src/java/main/org/apache/zookeeper/server/ src/java/main/org/apache/zookeeper/server/quorum/ src/java/test/org/apache/zookeeper/test/

2009-08-06 Thread mahadev
Author: mahadev
Date: Thu Aug  6 23:23:32 2009
New Revision: 801839

URL: http://svn.apache.org/viewvc?rev=801839view=rev
Log:
ZOOKEEPER-484.  Clients get SESSION MOVED exception when switching from 
follower to a leader. (mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ServerCnxn.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServer.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FollowerHandler.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/LeaderZooKeeperServer.java

hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/QuorumTest.java

hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/SessionTest.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=801839r1=801838r2=801839view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Thu Aug  6 23:23:32 2009
@@ -48,6 +48,9 @@
 
   ZOOKEEPER-311. handle small path lengths in zoo_create() (chris barroch via 
breed)
 
+  ZOOKEEPER-484.  Clients get SESSION MOVED exception when switching from
+  follower to a leader. (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/server/NIOServerCnxn.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java?rev=801839r1=801838r2=801839view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
 Thu Aug  6 23:23:32 2009
@@ -70,10 +70,7 @@
 
 private ConnectionBean jmxConnectionBean;
 
-// This is just an arbitrary object to represent requests issued by
-// (aka owned by) this class
-final private static Object me = new Object();
-
+   
 static public class Factory extends Thread {
 ZooKeeperServer zks;
 
@@ -545,7 +542,7 @@
 return;
 } else {
 Request si = new Request(this, sessionId, h.getXid(), h.getType(), 
incomingBuffer, authInfo);
-si.setOwner(me);
+si.setOwner(ServerCnxn.me);
 zk.submitRequest(si);
 }
 if (h.getXid() = 0) {

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java?rev=801839r1=801838r2=801839view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java
 Thu Aug  6 23:23:32 2009
@@ -356,7 +356,7 @@
 txn = new CreateSessionTxn(to);
 request.request.rewind();
 zks.sessionTracker.addSession(request.sessionId, to);
-zks.sessionTracker.setOwner(request.sessionId, 
request.getOwner());
+zks.setOwner(request.sessionId, request.getOwner());
 break;
 case OpCode.closeSession:
 txnHeader = new TxnHeader(request.sessionId, request.cxid, zks

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ServerCnxn.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ServerCnxn.java?rev=801839r1=801838r2=801839view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ServerCnxn.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ServerCnxn.java
 Thu Aug  6 23:23:32 2009
@@ -55,6 +55,10 @@
 
 final static ByteBuffer imok = ByteBuffer.wrap(imok.getBytes());
 
+// This is just an arbitrary object to represent requests issued by
+// (aka owned by) this class
+final public static Object me = new Object();
+
 public abstract int getSessionTimeout();
 
 public abstract void close();

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServer.java
URL: 
http://svn.apache.org/viewvc/hadoop

svn commit: r801852 - in /hadoop/zookeeper/branches/branch-3.2: ./ src/java/main/org/apache/zookeeper/server/ src/java/main/org/apache/zookeeper/server/quorum/ src/java/test/org/apache/zookeeper/test/

2009-08-06 Thread mahadev
Author: mahadev
Date: Fri Aug  7 00:39:19 2009
New Revision: 801852

URL: http://svn.apache.org/viewvc?rev=801852view=rev
Log:
ZOOKEEPER-484.  Clients get SESSION MOVED exception when switching from 
follower to a leader. (mahadev)

Modified:
hadoop/zookeeper/branches/branch-3.2/CHANGES.txt

hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java

hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java

hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/ServerCnxn.java

hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/ZooKeeperServer.java

hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/FollowerHandler.java

hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/LeaderZooKeeperServer.java

hadoop/zookeeper/branches/branch-3.2/src/java/test/org/apache/zookeeper/test/QuorumTest.java

hadoop/zookeeper/branches/branch-3.2/src/java/test/org/apache/zookeeper/test/SessionTest.java

Modified: hadoop/zookeeper/branches/branch-3.2/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/CHANGES.txt?rev=801852r1=801851r2=801852view=diff
==
--- hadoop/zookeeper/branches/branch-3.2/CHANGES.txt (original)
+++ hadoop/zookeeper/branches/branch-3.2/CHANGES.txt Fri Aug  7 00:39:19 2009
@@ -45,6 +45,9 @@
 
   ZOOKEEPER-311. handle small path lengths in zoo_create() (chris barroch via 
breed)
 
+  ZOOKEEPER-484.  Clients get SESSION MOVED exception when switching from
+  follower to a leader. (mahadev)
+
 IMPROVEMENTS:
 
 NEW FEATURES:

Modified: 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java?rev=801852r1=801851r2=801852view=diff
==
--- 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
 (original)
+++ 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
 Fri Aug  7 00:39:19 2009
@@ -70,10 +70,7 @@
 
 private ConnectionBean jmxConnectionBean;
 
-// This is just an arbitrary object to represent requests issued by
-// (aka owned by) this class
-final private static Object me = new Object();
-
+   
 static public class Factory extends Thread {
 ZooKeeperServer zks;
 
@@ -544,7 +541,7 @@
 return;
 } else {
 Request si = new Request(this, sessionId, h.getXid(), h.getType(), 
incomingBuffer, authInfo);
-si.setOwner(me);
+si.setOwner(ServerCnxn.me);
 zk.submitRequest(si);
 }
 if (h.getXid() = 0) {

Modified: 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java?rev=801852r1=801851r2=801852view=diff
==
--- 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java
 (original)
+++ 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java
 Fri Aug  7 00:39:19 2009
@@ -356,7 +356,7 @@
 txn = new CreateSessionTxn(to);
 request.request.rewind();
 zks.sessionTracker.addSession(request.sessionId, to);
-zks.sessionTracker.setOwner(request.sessionId, 
request.getOwner());
+zks.setOwner(request.sessionId, request.getOwner());
 break;
 case OpCode.closeSession:
 txnHeader = new TxnHeader(request.sessionId, request.cxid, zks

Modified: 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/ServerCnxn.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/ServerCnxn.java?rev=801852r1=801851r2=801852view=diff
==
--- 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/ServerCnxn.java
 (original)
+++ 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/ServerCnxn.java
 Fri Aug  7 00:39:19 2009
@@ -55,6 +55,10 @@
 
 final static ByteBuffer imok = ByteBuffer.wrap(imok.getBytes());
 
+// This is just an arbitrary object to represent requests issued by
+// (aka owned by) this class
+final public static Object me = new Object

svn commit: r802187 - in /hadoop/zookeeper/branches/branch-3.2: CHANGES.txt src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java src/java/test/org/apache/zookeeper/test/CnxManagerTes

2009-08-07 Thread mahadev
Author: mahadev
Date: Fri Aug  7 20:57:09 2009
New Revision: 802187

URL: http://svn.apache.org/viewvc?rev=802187view=rev
Log:
ZOOKEEPER-501. CnxManagerTest failed on hudson. (flavio via mahadev)

Modified:
hadoop/zookeeper/branches/branch-3.2/CHANGES.txt

hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java

hadoop/zookeeper/branches/branch-3.2/src/java/test/org/apache/zookeeper/test/CnxManagerTest.java

Modified: hadoop/zookeeper/branches/branch-3.2/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/CHANGES.txt?rev=802187r1=802186r2=802187view=diff
==
--- hadoop/zookeeper/branches/branch-3.2/CHANGES.txt (original)
+++ hadoop/zookeeper/branches/branch-3.2/CHANGES.txt Fri Aug  7 20:57:09 2009
@@ -51,6 +51,8 @@
   ZOOKEEPER-490. the java docs for session creation are misleading/incomplete
   (phunt)
 
+  ZOOKEEPER-501. CnxManagerTest failed on hudson. (flavio via mahadev) 
+
 IMPROVEMENTS:
 
 NEW FEATURES:

Modified: 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java?rev=802187r1=802186r2=802187view=diff
==
--- 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
 (original)
+++ 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
 Fri Aug  7 20:57:09 2009
@@ -96,7 +96,7 @@
  */
 public Listener listener;
 
-static class Message {
+static public class Message {
 Message(ByteBuffer buffer, long sid) {
 this.buffer = buffer;
 this.sid = sid;
@@ -339,7 +339,7 @@
  * doesn't exist.
  */
 
-void connectAll(){
+public void connectAll(){
 long sid;
 for(EnumerationLong en = queueSendMap.keys();
 en.hasMoreElements();){

Modified: 
hadoop/zookeeper/branches/branch-3.2/src/java/test/org/apache/zookeeper/test/CnxManagerTest.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/src/java/test/org/apache/zookeeper/test/CnxManagerTest.java?rev=802187r1=802186r2=802187view=diff
==
--- 
hadoop/zookeeper/branches/branch-3.2/src/java/test/org/apache/zookeeper/test/CnxManagerTest.java
 (original)
+++ 
hadoop/zookeeper/branches/branch-3.2/src/java/test/org/apache/zookeeper/test/CnxManagerTest.java
 Fri Aug  7 20:57:09 2009
@@ -26,12 +26,14 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
 
 import junit.framework.TestCase;
 
 import org.apache.log4j.Logger;
 import org.apache.zookeeper.server.quorum.FastLeaderElection;
 import org.apache.zookeeper.server.quorum.QuorumCnxManager;
+import org.apache.zookeeper.server.quorum.QuorumCnxManager.Message;
 import org.apache.zookeeper.server.quorum.QuorumPeer;
 import org.apache.zookeeper.server.quorum.Vote;
 import org.apache.zookeeper.server.quorum.QuorumPeer.QuorumServer;
@@ -52,6 +54,7 @@
  */
 public class CnxManagerTest extends TestCase {
 protected static final Logger LOG = 
Logger.getLogger(FLENewEpochTest.class);
+protected static final int THRESHOLD = 4;
 
 int baseport;
 int baseLEport;
@@ -102,7 +105,10 @@
 
 class CnxManagerThread extends Thread {
 
-CnxManagerThread(){}
+boolean failed;
+CnxManagerThread(){
+failed = false;
+}
 
 public void run(){
 try {
@@ -117,10 +123,26 @@
 
 long sid = 1;
 cnxManager.toSend(sid, 
createMsg(ServerState.LOOKING.ordinal(), 0, -1, 1));
-cnxManager.recvQueue.take();
+
+Message m = null;
+int numRetries = 1;
+while((m == null)  (numRetries++ = THRESHOLD)){
+m = cnxManager.recvQueue.poll(3000, TimeUnit.MILLISECONDS);
+if(m == null) cnxManager.connectAll();
+}
+
+if(numRetries  THRESHOLD){
+failed = true;
+return;
+}
+
 cnxManager.testInitiateConnection(sid);
 
-cnxManager.recvQueue.take();
+m = cnxManager.recvQueue.poll(3000, TimeUnit.MILLISECONDS);
+if(m == null){
+failed = true;
+return;
+}
 } catch (Exception e) {
 LOG.error(Exception while running mock thread

svn commit: r802188 - in /hadoop/zookeeper/trunk: CHANGES.txt src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java src/java/test/org/apache/zookeeper/test/CnxManagerTest.java

2009-08-07 Thread mahadev
Author: mahadev
Date: Fri Aug  7 21:00:05 2009
New Revision: 802188

URL: http://svn.apache.org/viewvc?rev=802188view=rev
Log:
ZOOKEEPER-501. CnxManagerTest failed on hudson. (flavio via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java

hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/CnxManagerTest.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=802188r1=802187r2=802188view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Fri Aug  7 21:00:05 2009
@@ -55,6 +55,8 @@
   ZOOKEEPER-490. the java docs for session creation are misleading/incomplete
   (phunt)
 
+  ZOOKEEPER-501. CnxManagerTest failed on hudson. (flavio 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/server/quorum/QuorumCnxManager.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java?rev=802188r1=802187r2=802188view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
 Fri Aug  7 21:00:05 2009
@@ -96,7 +96,7 @@
  */
 public Listener listener;
 
-static class Message {
+static public class Message {
 Message(ByteBuffer buffer, long sid) {
 this.buffer = buffer;
 this.sid = sid;
@@ -339,7 +339,7 @@
  * doesn't exist.
  */
 
-void connectAll(){
+public void connectAll(){
 long sid;
 for(EnumerationLong en = queueSendMap.keys();
 en.hasMoreElements();){

Modified: 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/CnxManagerTest.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/CnxManagerTest.java?rev=802188r1=802187r2=802188view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/CnxManagerTest.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/CnxManagerTest.java
 Fri Aug  7 21:00:05 2009
@@ -26,6 +26,7 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
 
 import junit.framework.TestCase;
 
@@ -33,6 +34,7 @@
 import org.apache.zookeeper.PortAssignment;
 import org.apache.zookeeper.server.quorum.FastLeaderElection;
 import org.apache.zookeeper.server.quorum.QuorumCnxManager;
+import org.apache.zookeeper.server.quorum.QuorumCnxManager.Message;
 import org.apache.zookeeper.server.quorum.QuorumPeer;
 import org.apache.zookeeper.server.quorum.Vote;
 import org.apache.zookeeper.server.quorum.QuorumPeer.QuorumServer;
@@ -53,6 +55,7 @@
  */
 public class CnxManagerTest extends TestCase {
 protected static final Logger LOG = 
Logger.getLogger(FLENewEpochTest.class);
+protected static final int THRESHOLD = 4;
 
 int count;
 HashMapLong,QuorumServer peers;
@@ -101,7 +104,10 @@
 
 class CnxManagerThread extends Thread {
 
-CnxManagerThread(){}
+boolean failed;
+CnxManagerThread(){
+failed = false;
+}
 
 public void run(){
 try {
@@ -116,10 +122,26 @@
 
 long sid = 1;
 cnxManager.toSend(sid, 
createMsg(ServerState.LOOKING.ordinal(), 0, -1, 1));
-cnxManager.recvQueue.take();
+
+Message m = null;
+int numRetries = 1;
+while((m == null)  (numRetries++ = THRESHOLD)){
+m = cnxManager.recvQueue.poll(3000, TimeUnit.MILLISECONDS);
+if(m == null) cnxManager.connectAll();
+}
+
+if(numRetries  THRESHOLD){
+failed = true;
+return;
+}
+
 cnxManager.testInitiateConnection(sid);
 
-cnxManager.recvQueue.take();
+m = cnxManager.recvQueue.poll(3000, TimeUnit.MILLISECONDS);
+if(m == null){
+failed = true;
+return;
+}
 } catch (Exception e) {
 LOG.error(Exception while running mock thread, e);
 fail(Unexpected exception

svn commit: r802944 - in /hadoop/zookeeper/branches/branch-3.2: ./ src/java/main/org/apache/zookeeper/server/quorum/ src/java/test/org/apache/zookeeper/server/quorum/

2009-08-10 Thread mahadev
Author: mahadev
Date: Mon Aug 10 22:25:40 2009
New Revision: 802944

URL: http://svn.apache.org/viewvc?rev=802944view=rev
Log:
ZOOKEEPER-499. electionAlg should default to FLE (3) - regression (phunt via 
mahadev)

Modified:
hadoop/zookeeper/branches/branch-3.2/CHANGES.txt

hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java

hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java

hadoop/zookeeper/branches/branch-3.2/src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerMainTest.java

Modified: hadoop/zookeeper/branches/branch-3.2/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/CHANGES.txt?rev=802944r1=802943r2=802944view=diff
==
--- hadoop/zookeeper/branches/branch-3.2/CHANGES.txt (original)
+++ hadoop/zookeeper/branches/branch-3.2/CHANGES.txt Mon Aug 10 22:25:40 2009
@@ -53,6 +53,9 @@
 
   ZOOKEEPER-501. CnxManagerTest failed on hudson. (flavio via mahadev) 
 
+  ZOOKEEPER-499. electionAlg should default to FLE (3) - regression (phunt via
+  mahadev)
+
 IMPROVEMENTS:
 
 NEW FEATURES:

Modified: 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java?rev=802944r1=802943r2=802944view=diff
==
--- 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
 (original)
+++ 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
 Mon Aug 10 22:25:40 2009
@@ -19,15 +19,13 @@
 package org.apache.zookeeper.server.quorum;
 
 import java.io.IOException;
-import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.net.Socket;
-import java.net.UnknownHostException;
 import java.nio.ByteBuffer;
 import java.nio.channels.ServerSocketChannel;
 import java.nio.channels.SocketChannel;
+import java.nio.channels.UnresolvedAddressException;
 import java.util.Enumeration;
-import java.util.Random;
 import java.util.concurrent.ArrayBlockingQueue;
 import java.util.concurrent.ConcurrentHashMap;
 
@@ -316,17 +314,28 @@
  */
 
 synchronized void connectOne(long sid){
-
-if ((senderWorkerMap.get(sid) == null)){ 
+if (senderWorkerMap.get(sid) == null){ 
+InetSocketAddress electionAddr =
+self.quorumPeers.get(sid).electionAddr;
 try {
 SocketChannel channel;
 LOG.debug(Opening channel to server   + sid);
-channel = SocketChannel
-.open(self.quorumPeers.get(sid).electionAddr);
+channel = SocketChannel.open(electionAddr);
 channel.socket().setTcpNoDelay(true);
 initiateConnection(channel, sid);
+} catch (UnresolvedAddressException e) {
+// Sun doesn't include the address that causes this
+// exception to be thrown, also UAE cannot be wrapped cleanly
+// so we log the exception in order to capture this critical
+// detail.
+LOG.warn(Cannot open channel to  + sid
++  at election address  + electionAddr,
+e);
+throw e;
 } catch (IOException e) {
-LOG.warn(Cannot open channel to  + sid, e);
+LOG.warn(Cannot open channel to  + sid
++  at election address  + electionAddr,
+e);
 }
 } else {
 LOG.error(There is a connection for server  + sid);

Modified: 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java?rev=802944r1=802943r2=802944view=diff
==
--- 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java
 (original)
+++ 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java
 Mon Aug 10 22:25:40 2009
@@ -47,8 +47,8 @@
 
 protected int initLimit;
 protected int syncLimit;
-protected int electionAlg;
-protected int electionPort;
+protected int electionAlg = 3;
+protected int electionPort = 2182;
 protected int maxClientCnxns = 10;
 protected final HashMapLong,QuorumServer servers =
 new HashMapLong, QuorumServer();

Modified: 
hadoop

svn commit: r802964 - in /hadoop/zookeeper/trunk: CHANGES.txt bin/zkCleanup.sh

2009-08-10 Thread mahadev
Author: mahadev
Date: Tue Aug 11 00:28:06 2009
New Revision: 802964

URL: http://svn.apache.org/viewvc?rev=802964view=rev
Log:
ZOOKEEPER-477. zkCleanup.sh is flaky (fernando via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/bin/zkCleanup.sh

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=802964r1=802963r2=802964view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Tue Aug 11 00:28:06 2009
@@ -60,6 +60,9 @@
   ZOOKEEPER-499. electionAlg should default to FLE (3) - regression (phunt via
   mahadev) 
 
+  ZOOKEEPER-477. zkCleanup.sh is flaky (fernando 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/bin/zkCleanup.sh
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/bin/zkCleanup.sh?rev=802964r1=802963r2=802964view=diff
==
--- hadoop/zookeeper/trunk/bin/zkCleanup.sh (original)
+++ hadoop/zookeeper/trunk/bin/zkCleanup.sh Tue Aug 11 00:28:06 2009
@@ -36,8 +36,16 @@
 
 . $ZOOBINDIR/zkEnv.sh
 
-eval `grep -e ^dataDir= $ZOOCFG`
+ZOODATADIR=$(grep '^dataDir=' $ZOOCFG | sed -e 's/.*=//')
+ZOODATALOGDIR=$(grep '^dataLogDir=' $ZOOCFG | sed -e 's/.*=//')
 
-java -Dzookeeper.log.dir=${ZOO_LOG_DIR} 
-Dzookeeper.root.logger=${ZOO_LOG4J_PROP} \
+if [ x${ZOODATALOGDIR} = x ]
+then
+echo java -Dzookeeper.log.dir=${ZOO_LOG_DIR} 
-Dzookeeper.root.logger=${ZOO_LOG4J_PROP} \
  -cp $CLASSPATH $JVMFLAGS \
- org.apache.zookeeper.server.PurgeTxnLog $dataDir
+ org.apache.zookeeper.server.PurgeTxnLog $ZOODATADIR $*
+else
+echo java -Dzookeeper.log.dir=${ZOO_LOG_DIR} 
-Dzookeeper.root.logger=${ZOO_LOG4J_PROP} \
+ -cp $CLASSPATH $JVMFLAGS \
+ org.apache.zookeeper.server.PurgeTxnLog $ZOODATALOGDIR $ZOODATADIR $*
+fi




svn commit: r802965 - in /hadoop/zookeeper/branches/branch-3.2: CHANGES.txt bin/zkCleanup.sh

2009-08-10 Thread mahadev
Author: mahadev
Date: Tue Aug 11 00:30:01 2009
New Revision: 802965

URL: http://svn.apache.org/viewvc?rev=802965view=rev
Log:
ZOOKEEPER-477. zkCleanup.sh is flaky (fernando via mahadev)

Modified:
hadoop/zookeeper/branches/branch-3.2/CHANGES.txt
hadoop/zookeeper/branches/branch-3.2/bin/zkCleanup.sh

Modified: hadoop/zookeeper/branches/branch-3.2/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/CHANGES.txt?rev=802965r1=802964r2=802965view=diff
==
--- hadoop/zookeeper/branches/branch-3.2/CHANGES.txt (original)
+++ hadoop/zookeeper/branches/branch-3.2/CHANGES.txt Tue Aug 11 00:30:01 2009
@@ -56,6 +56,8 @@
   ZOOKEEPER-499. electionAlg should default to FLE (3) - regression (phunt via
   mahadev)
 
+  ZOOKEEPER-477. zkCleanup.sh is flaky (fernando via mahadev)
+
 IMPROVEMENTS:
 
 NEW FEATURES:

Modified: hadoop/zookeeper/branches/branch-3.2/bin/zkCleanup.sh
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/bin/zkCleanup.sh?rev=802965r1=802964r2=802965view=diff
==
--- hadoop/zookeeper/branches/branch-3.2/bin/zkCleanup.sh (original)
+++ hadoop/zookeeper/branches/branch-3.2/bin/zkCleanup.sh Tue Aug 11 00:30:01 
2009
@@ -36,8 +36,16 @@
 
 . $ZOOBINDIR/zkEnv.sh
 
-eval `grep -e ^dataDir= $ZOOCFG`
+ZOODATADIR=$(grep '^dataDir=' $ZOOCFG | sed -e 's/.*=//')
+ZOODATALOGDIR=$(grep '^dataLogDir=' $ZOOCFG | sed -e 's/.*=//')
 
-java -Dzookeeper.log.dir=${ZOO_LOG_DIR} 
-Dzookeeper.root.logger=${ZOO_LOG4J_PROP} \
+if [ x${ZOODATALOGDIR} = x ]
+then
+echo java -Dzookeeper.log.dir=${ZOO_LOG_DIR} 
-Dzookeeper.root.logger=${ZOO_LOG4J_PROP} \
  -cp $CLASSPATH $JVMFLAGS \
- org.apache.zookeeper.server.PurgeTxnLog $dataDir
+ org.apache.zookeeper.server.PurgeTxnLog $ZOODATADIR $*
+else
+echo java -Dzookeeper.log.dir=${ZOO_LOG_DIR} 
-Dzookeeper.root.logger=${ZOO_LOG4J_PROP} \
+ -cp $CLASSPATH $JVMFLAGS \
+ org.apache.zookeeper.server.PurgeTxnLog $ZOODATALOGDIR $ZOODATADIR $*
+fi




svn commit: r803305 - in /hadoop/zookeeper/branches/branch-3.2: ./ docs/ src/docs/src/documentation/content/xdocs/ src/java/main/org/apache/zookeeper/server/quorum/ src/java/main/org/apache/zookeeper/

2009-08-11 Thread mahadev
Author: mahadev
Date: Tue Aug 11 21:26:12 2009
New Revision: 803305

URL: http://svn.apache.org/viewvc?rev=803305view=rev
Log:
ZOOKEEPER-498. Unending Leader Elections : WAN configuration (flavio via 
mahadev)

Added:
hadoop/zookeeper/branches/branch-3.2/docs/zookeeperHierarchicalQuorums.html
hadoop/zookeeper/branches/branch-3.2/docs/zookeeperHierarchicalQuorums.pdf

hadoop/zookeeper/branches/branch-3.2/src/docs/src/documentation/content/xdocs/zookeeperHierarchicalQuorums.xml
Modified:
hadoop/zookeeper/branches/branch-3.2/CHANGES.txt
hadoop/zookeeper/branches/branch-3.2/docs/index.html
hadoop/zookeeper/branches/branch-3.2/docs/index.pdf
hadoop/zookeeper/branches/branch-3.2/docs/zookeeperAdmin.html
hadoop/zookeeper/branches/branch-3.2/docs/zookeeperAdmin.pdf

hadoop/zookeeper/branches/branch-3.2/src/docs/src/documentation/content/xdocs/index.xml

hadoop/zookeeper/branches/branch-3.2/src/docs/src/documentation/content/xdocs/zookeeperAdmin.xml

hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java

hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java

hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/flexible/QuorumHierarchical.java

hadoop/zookeeper/branches/branch-3.2/src/java/test/org/apache/zookeeper/test/FLEZeroWeightTest.java

hadoop/zookeeper/branches/branch-3.2/src/java/test/org/apache/zookeeper/test/HierarchicalQuorumTest.java

Modified: hadoop/zookeeper/branches/branch-3.2/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/CHANGES.txt?rev=803305r1=803304r2=803305view=diff
==
--- hadoop/zookeeper/branches/branch-3.2/CHANGES.txt (original)
+++ hadoop/zookeeper/branches/branch-3.2/CHANGES.txt Tue Aug 11 21:26:12 2009
@@ -58,6 +58,9 @@
 
   ZOOKEEPER-477. zkCleanup.sh is flaky (fernando via mahadev)
 
+  ZOOKEEPER-498. Unending Leader Elections : WAN configuration (flavio via
+  mahadev) 
+
 IMPROVEMENTS:
 
 NEW FEATURES:

Modified: hadoop/zookeeper/branches/branch-3.2/docs/index.html
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/docs/index.html?rev=803305r1=803304r2=803305view=diff
==
--- hadoop/zookeeper/branches/branch-3.2/docs/index.html (original)
+++ hadoop/zookeeper/branches/branch-3.2/docs/index.html Tue Aug 11 21:26:12 
2009
@@ -284,6 +284,10 @@
 li
 a href=zookeeperJMX.htmlJMX/a - how to enable JMX in ZooKeeper/li
   
+li
+a href=zookeeperHierarchicalQuorums.htmlHierarchical quorums/a
+/li
+  
 /ul
   
 /li

Modified: hadoop/zookeeper/branches/branch-3.2/docs/index.pdf
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/docs/index.pdf?rev=803305r1=803304r2=803305view=diff
==
Binary files - no diff available.

Modified: hadoop/zookeeper/branches/branch-3.2/docs/zookeeperAdmin.html
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/docs/zookeeperAdmin.html?rev=803305r1=803304r2=803305view=diff
==
--- hadoop/zookeeper/branches/branch-3.2/docs/zookeeperAdmin.html (original)
+++ hadoop/zookeeper/branches/branch-3.2/docs/zookeeperAdmin.html Tue Aug 11 
21:26:12 2009
@@ -1150,6 +1150,9 @@
   The left-hand side of the assignment is a colon-separated list 
of server
   identifiers. Note that groups must be disjoint and the union of 
all groups
   must be the ZooKeeper ensemble. /p
+p You will find an example a 
href=zookeeperHierarchicalQuorums.htmlhere/a
+  
+/p
 /dd
 
   
@@ -1165,11 +1168,14 @@
   the weight of server is 1. If the configuration defines groups, 
but not
   weights, then a value of 1 will be assigned to all servers.  
   /p
+p You will find an example a 
href=zookeeperHierarchicalQuorums.htmlhere/a
+  
+/p
 /dd
 
 /dl
 p/p
-a name=N10383/aa name=sc_authOptions/a
+a name=N1038F/aa name=sc_authOptions/a
 h4Authentication amp; Authorization Options/h4
 pThe options in this section allow control over
 authentication/authorization performed by the service./p
@@ -1203,7 +1209,7 @@
 /dd
 
 /dl
-a name=N103A6/aa name=Unsafe+Options/a
+a name=N103B2/aa name=Unsafe+Options/a
 h4Unsafe Options/h4
 pThe following options can be useful, but be careful when you use
 them. The risk of each is explained along with the explanation of what
@@ -1248,7 +1254,7 @@
 /dd
 
 /dl
-a name=N103D8/aa name=sc_zkCommands/a
+a name=N103E4/aa name=sc_zkCommands/a
 h3 class=h4ZooKeeper Commands: The Four Letter Words/h3
 pZooKeeper responds to a small set

svn commit: r807484 - in /hadoop/zookeeper/trunk: ./ src/java/main/org/apache/zookeeper/server/persistence/ src/java/main/org/apache/zookeeper/server/quorum/ src/java/test/org/apache/zookeeper/test/

2009-08-24 Thread mahadev
Author: mahadev
Date: Tue Aug 25 05:45:24 2009
New Revision: 807484

URL: http://svn.apache.org/viewvc?rev=807484view=rev
Log:
ZOOKEEPER-508. proposals and commits for DIFF and Truncate messages from the 
leader to the followers is buggy. (mahadev and ben via mahadev)

Added:

hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/TruncateTest.java
Modified:
hadoop/zookeeper/trunk/CHANGES.txt

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/persistence/FileTxnLog.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Follower.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FollowerHandler.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Leader.java

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/SendAckRequestProcessor.java

hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ClientBase.java

hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/QuorumTest.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=807484r1=807483r2=807484view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Tue Aug 25 05:45:24 2009
@@ -65,6 +65,9 @@
   ZOOKEEPER-498. Unending Leader Elections : WAN configuration (flavio via
   mahadev)
 
+  ZOOKEEPER-508. proposals and commits for DIFF and Truncate messages from the
+  leader to the followers is buggy. (mahadev and ben 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/server/persistence/FileTxnLog.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/persistence/FileTxnLog.java?rev=807484r1=807483r2=807484view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/persistence/FileTxnLog.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/persistence/FileTxnLog.java
 Tue Aug 25 05:45:24 2009
@@ -24,6 +24,7 @@
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
+import java.io.FilterInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.RandomAccessFile;
@@ -271,8 +272,8 @@
  */
 public boolean truncate(long zxid) throws IOException {
 FileTxnIterator itr = new FileTxnIterator(this.logDir, zxid);
-FileInputStream input = itr.inputStream;
-long pos = input.getChannel().position();
+PositionInputStream input = itr.inputStream;
+long pos = input.getPosition();
 // now, truncate at the current position
 RandomAccessFile raf=new RandomAccessFile(itr.logFile,rw);
 raf.setLength(pos);
@@ -322,6 +323,48 @@
 }
 
 /**
+ * a class that keeps track of the position 
+ * in the input stream. The position points to offset
+ * that has been consumed by the applications. It can 
+ * wrap buffered input streams to provide the right offset 
+ * for the application.
+ */
+static class PositionInputStream extends FilterInputStream {
+long position;
+protected PositionInputStream(InputStream in) {
+super(in);
+}
+
+@Override
+public int read() throws IOException {
+int rc = super.read();
+if (rc  0) {
+position++;
+}
+return rc;
+}
+
+@Override
+public int read(byte[] b, int off, int len) throws IOException {
+int rc = super.read(b, off, len);
+position += rc;
+return rc;
+}
+
+@Override
+public long skip(long n) throws IOException {
+long rc = super.skip(n);
+if (rc  0) {
+position += rc;
+}
+return rc;
+}
+public long getPosition() {
+return position;
+}
+}
+
+/**
  * this class implements the txnlog iterator interface
  * which is used for reading the transaction logs
  */
@@ -333,7 +376,8 @@
 File logFile;
 InputArchive ia;
 static final String CRC_ERROR=CRC check failed;
-FileInputStream inputStream=null;
+   
+PositionInputStream inputStream=null;
 //stored files is the list of files greater than
 //the zxid we are looking for.
 private ArrayListFile storedFiles;
@@ -398,7 +442,7 @@
  * @param is the inputstream
  * @throws IOException

svn commit: r807486 - in /hadoop/zookeeper/branches/branch-3.2: ./ src/java/main/org/apache/zookeeper/server/persistence/ src/java/main/org/apache/zookeeper/server/quorum/ src/java/test/org/apache/zoo

2009-08-24 Thread mahadev
Author: mahadev
Date: Tue Aug 25 05:47:20 2009
New Revision: 807486

URL: http://svn.apache.org/viewvc?rev=807486view=rev
Log:
ZOOKEEPER-408. proposals and commits for DIFF and Truncate messages from the 
leader to followers is buggy. (mahadev and ben via mahadev)

Modified:
hadoop/zookeeper/branches/branch-3.2/CHANGES.txt

hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/persistence/FileTxnLog.java

hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/Follower.java

hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/FollowerHandler.java

hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/Leader.java

hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/SendAckRequestProcessor.java

hadoop/zookeeper/branches/branch-3.2/src/java/test/org/apache/zookeeper/test/ClientBase.java

hadoop/zookeeper/branches/branch-3.2/src/java/test/org/apache/zookeeper/test/QuorumTest.java

Modified: hadoop/zookeeper/branches/branch-3.2/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/CHANGES.txt?rev=807486r1=807485r2=807486view=diff
==
--- hadoop/zookeeper/branches/branch-3.2/CHANGES.txt (original)
+++ hadoop/zookeeper/branches/branch-3.2/CHANGES.txt Tue Aug 25 05:47:20 2009
@@ -61,6 +61,9 @@
   ZOOKEEPER-498. Unending Leader Elections : WAN configuration (flavio via
   mahadev) 
 
+  ZOOKEEPER-408. proposals and commits for DIFF and Truncate messages from the 
+  leader to followers is buggy. (mahadev and ben via mahadev)
+
 IMPROVEMENTS:
 
 NEW FEATURES:

Modified: 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/persistence/FileTxnLog.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/persistence/FileTxnLog.java?rev=807486r1=807485r2=807486view=diff
==
--- 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/persistence/FileTxnLog.java
 (original)
+++ 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/persistence/FileTxnLog.java
 Tue Aug 25 05:47:20 2009
@@ -24,6 +24,7 @@
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
+import java.io.FilterInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.RandomAccessFile;
@@ -271,8 +272,8 @@
  */
 public boolean truncate(long zxid) throws IOException {
 FileTxnIterator itr = new FileTxnIterator(this.logDir, zxid);
-FileInputStream input = itr.inputStream;
-long pos = input.getChannel().position();
+PositionInputStream input = itr.inputStream;
+long pos = input.getPosition();
 // now, truncate at the current position
 RandomAccessFile raf=new RandomAccessFile(itr.logFile,rw);
 raf.setLength(pos);
@@ -322,6 +323,48 @@
 }
 
 /**
+ * a class that keeps track of the position 
+ * in the input stream. The position points to offset
+ * that has been consumed by the applications. It can 
+ * wrap buffered input streams to provide the right offset 
+ * for the application.
+ */
+static class PositionInputStream extends FilterInputStream {
+long position;
+protected PositionInputStream(InputStream in) {
+super(in);
+}
+
+@Override
+public int read() throws IOException {
+int rc = super.read();
+if (rc  0) {
+position++;
+}
+return rc;
+}
+
+@Override
+public int read(byte[] b, int off, int len) throws IOException {
+int rc = super.read(b, off, len);
+position += rc;
+return rc;
+}
+
+@Override
+public long skip(long n) throws IOException {
+long rc = super.skip(n);
+if (rc  0) {
+position += rc;
+}
+return rc;
+}
+public long getPosition() {
+return position;
+}
+}
+
+/**
  * this class implements the txnlog iterator interface
  * which is used for reading the transaction logs
  */
@@ -333,7 +376,8 @@
 File logFile;
 InputArchive ia;
 static final String CRC_ERROR=CRC check failed;
-FileInputStream inputStream=null;
+   
+PositionInputStream inputStream=null;
 //stored files is the list of files greater than
 //the zxid we are looking for.
 private ArrayListFile storedFiles;
@@ -398,7 +442,7 @@
  * @param is the inputstream
  * @throws IOException

svn commit: r807488 - /hadoop/zookeeper/branches/branch-3.2/CHANGES.txt

2009-08-24 Thread mahadev
Author: mahadev
Date: Tue Aug 25 05:50:44 2009
New Revision: 807488

URL: http://svn.apache.org/viewvc?rev=807488view=rev
Log:
ZOOKEEPER-508. the last commit message should have been for ZOOKEEPER-508 and 
not ZOOKEEPER-408.

Modified:
hadoop/zookeeper/branches/branch-3.2/CHANGES.txt

Modified: hadoop/zookeeper/branches/branch-3.2/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/CHANGES.txt?rev=807488r1=807487r2=807488view=diff
==
--- hadoop/zookeeper/branches/branch-3.2/CHANGES.txt (original)
+++ hadoop/zookeeper/branches/branch-3.2/CHANGES.txt Tue Aug 25 05:50:44 2009
@@ -61,7 +61,7 @@
   ZOOKEEPER-498. Unending Leader Elections : WAN configuration (flavio via
   mahadev) 
 
-  ZOOKEEPER-408. proposals and commits for DIFF and Truncate messages from the 
+  ZOOKEEPER-508. proposals and commits for DIFF and Truncate messages from the 
   leader to followers is buggy. (mahadev and ben via mahadev)
 
 IMPROVEMENTS:




svn commit: r817885 - in /hadoop/zookeeper/trunk: ./ bin/ src/c/tests/ src/contrib/ src/contrib/bookkeeper/ src/contrib/fatjar/ src/contrib/rest/ src/contrib/rest/src/test/ src/contrib/zkpython/src/te

2009-09-22 Thread mahadev
Author: mahadev
Date: Tue Sep 22 22:59:34 2009
New Revision: 817885

URL: http://svn.apache.org/viewvc?rev=817885view=rev
Log:
ZOOKEEPER-529. Use Ivy to pull dependencies and also generate pom (phunt via 
mahadev)

Removed:
hadoop/zookeeper/trunk/src/java/lib/README.txt
hadoop/zookeeper/trunk/src/java/lib/jline-0.9.94.jar
hadoop/zookeeper/trunk/src/java/lib/junit-4.4.LICENSE.txt
hadoop/zookeeper/trunk/src/java/lib/junit-4.4.jar
hadoop/zookeeper/trunk/src/java/lib/log4j-1.2.15.NOTICE.txt
hadoop/zookeeper/trunk/src/java/lib/log4j-1.2.15.jar
Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/NOTICE.txt
hadoop/zookeeper/trunk/bin/zkEnv.sh
hadoop/zookeeper/trunk/build.xml
hadoop/zookeeper/trunk/src/c/tests/zkServer.sh
hadoop/zookeeper/trunk/src/contrib/bookkeeper/README.txt
hadoop/zookeeper/trunk/src/contrib/bookkeeper/build.xml
hadoop/zookeeper/trunk/src/contrib/build-contrib.xml
hadoop/zookeeper/trunk/src/contrib/fatjar/build.xml
hadoop/zookeeper/trunk/src/contrib/rest/build.xml
hadoop/zookeeper/trunk/src/contrib/rest/src/test/zkServer.sh
hadoop/zookeeper/trunk/src/contrib/zkpython/src/test/zkServer.sh

hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/bookkeeperConfig.xml

hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/bookkeeperStarted.xml
hadoop/zookeeper/trunk/src/java/systest/README.txt
hadoop/zookeeper/trunk/src/recipes/build-recipes.xml
hadoop/zookeeper/trunk/src/recipes/lock/build.xml
hadoop/zookeeper/trunk/src/recipes/lock/src/c/tests/zkServer.sh

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=817885r1=817884r2=817885view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Tue Sep 22 22:59:34 2009
@@ -80,6 +80,9 @@
 
   ZOOKEEPER-516. add support for 10 minute test ie pre-commit test (phunt)
 
+  ZOOKEEPER-529. Use Ivy to pull dependencies and also generate pom (phunt
+  via mahadev)
+
 NEW FEATURES:
 
 

Modified: hadoop/zookeeper/trunk/NOTICE.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/NOTICE.txt?rev=817885r1=817884r2=817885view=diff
==
--- hadoop/zookeeper/trunk/NOTICE.txt (original)
+++ hadoop/zookeeper/trunk/NOTICE.txt Tue Sep 22 22:59:34 2009
@@ -1,2 +1,5 @@
-This product includes software developed by The Apache Software
-Foundation (http://www.apache.org/).
+Apache ZooKeeper
+Copyright 2009 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).

Modified: hadoop/zookeeper/trunk/bin/zkEnv.sh
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/bin/zkEnv.sh?rev=817885r1=817884r2=817885view=diff
==
--- hadoop/zookeeper/trunk/bin/zkEnv.sh (original)
+++ hadoop/zookeeper/trunk/bin/zkEnv.sh Tue Sep 22 22:59:34 2009
@@ -65,6 +65,14 @@
 CLASSPATH=$CLASSPATH:$i
 done
 #make it work for developers
+for d in ${ZOOBINDIR}/../build/classes
+do
+   CLASSPATH=$CLASSPATH:$d
+done
+for d in ${ZOOBINDIR}/../build/lib/*.jar
+do
+   CLASSPATH=$CLASSPATH:$d
+done
 for d in ${ZOOBINDIR}/../src/java/lib/*.jar
 do
CLASSPATH=$CLASSPATH:$d

Modified: hadoop/zookeeper/trunk/build.xml
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/build.xml?rev=817885r1=817884r2=817885view=diff
==
--- hadoop/zookeeper/trunk/build.xml (original)
+++ hadoop/zookeeper/trunk/build.xml Tue Sep 22 22:59:34 2009
@@ -17,7 +17,7 @@
limitations under the License.
 --
 
-project name=ZooKeeper default=jar
+project name=ZooKeeper default=jar xmlns:ivy=antlib:org.apache.ivy.ant
 
 property name=Name value=ZooKeeper /
 property name=name value=zookeeper /
@@ -36,28 +36,30 @@
 
 property name=src.dir value=${basedir}/src /
 property name=java.src.dir value=${src.dir}/java/main /
-property name=jmx.src.dir value=${src.dir}/java/jmx /
 property name=lib.dir value=${src.dir}/java/lib /
 property name=build.dir value=${basedir}/build /
 property name=distribution value=${basedir}/distribution /
 property name=src_generated.dir value=${src.dir}/java/generated /
 property name=c.src.dir value=${src.dir}/c /
 property name=csrc_generated.dir value=${c.src.dir}/generated /
-property name=build.classes value=${build.dir}/classes /
-property name=jar.name value=zookeeper-dev.jar /
 
 property name=jute.file value=${src.dir}/zookeeper.jute /
 
-property name=build.testclasses value=${build.dir}/testclasses/
-property name=test.build.dir value=${build.dir}/test /
+property name=build.classes value=${build.dir

svn commit: r818276 - in /hadoop/zookeeper/trunk/src: contrib/build-contrib.xml recipes/build-recipes.xml

2009-09-23 Thread mahadev
Author: mahadev
Date: Wed Sep 23 21:53:55 2009
New Revision: 818276

URL: http://svn.apache.org/viewvc?rev=818276view=rev
Log:
ZOOKEEPER-533. fix for ant version 1.7.0

Modified:
hadoop/zookeeper/trunk/src/contrib/build-contrib.xml
hadoop/zookeeper/trunk/src/recipes/build-recipes.xml

Modified: hadoop/zookeeper/trunk/src/contrib/build-contrib.xml
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/contrib/build-contrib.xml?rev=818276r1=818275r2=818276view=diff
==
--- hadoop/zookeeper/trunk/src/contrib/build-contrib.xml (original)
+++ hadoop/zookeeper/trunk/src/contrib/build-contrib.xml Wed Sep 23 21:53:55 
2009
@@ -48,10 +48,10 @@
 pathelement location=${build.classes}/
 fileset refid=lib.jars/
 pathelement location=${zk.root}/build/classes/
-fileset dir=${zk.root}/build/lib erroronmissingdir=false
+fileset dir=${zk.root}/build/lib
   include name=**/*.jar /
 /fileset
-fileset dir=${zk.root}/build/test/lib erroronmissingdir=false
+fileset dir=${zk.root}/build/test/lib
   include name=**/*.jar /
 /fileset
 fileset dir=${zk.root}/src/java/lib
@@ -128,8 +128,13 @@
 
   target name=checkMainIsAvailable
 available classname=org.apache.zookeeper.ZooKeeperMain
-   classpathref=classpath
-   property=mainIsCompiled/
+   property=mainIsCompiled
+  !-- we can't use id=classpath, because available fails if fileset 
directory
+   doesn't exist --
+  classpath
+pathelement location=${zk.root}/build/classes/
+  /classpath
+/available
   /target
 
   target name=checkMainCompiled unless=mainIsCompiled 
depends=checkMainIsAvailable

Modified: hadoop/zookeeper/trunk/src/recipes/build-recipes.xml
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/recipes/build-recipes.xml?rev=818276r1=818275r2=818276view=diff
==
--- hadoop/zookeeper/trunk/src/recipes/build-recipes.xml (original)
+++ hadoop/zookeeper/trunk/src/recipes/build-recipes.xml Wed Sep 23 21:53:55 
2009
@@ -48,7 +48,7 @@
 pathelement location=${build.classes}/
 fileset refid=lib.jars/
 pathelement location=${zk.root}/build/classes/
-fileset dir=${zk.root}/build/lib erroronmissingdir=false
+fileset dir=${zk.root}/build/lib
   include name=**/*.jar /
 /fileset
 fileset dir=${zk.root}/src/java/lib
@@ -125,8 +125,13 @@
 
   target name=checkMainIsAvailable
 available classname=org.apache.zookeeper.ZooKeeperMain
-   classpathref=classpath
-   property=mainIsCompiled/
+   property=mainIsCompiled
+  !-- we can't use id=classpath, because available fails if fileset 
directory
+   doesn't exist --
+  classpath
+pathelement location=${zk.root}/build/classes/
+  /classpath
+/available
   /target
 
   target name=checkMainCompiled unless=mainIsCompiled 
depends=checkMainIsAvailable




svn commit: r818584 - in /hadoop/zookeeper/trunk: CHANGES.txt build.xml

2009-09-24 Thread mahadev
Author: mahadev
Date: Thu Sep 24 18:50:23 2009
New Revision: 818584

URL: http://svn.apache.org/viewvc?rev=818584view=rev
Log:
ZOOKEEPER-535. ivy task does not enjoy being defined twice (build error) (phunt 
via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/build.xml

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=818584r1=818583r2=818584view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Thu Sep 24 18:50:23 2009
@@ -73,6 +73,9 @@
 
   ZOOKEEPER-533.  ant error running clean twice (phunt via mahadev)
 
+  ZOOKEEPER-535. ivy task does not enjoy being defined twice 
+  (build error) (phunt 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/build.xml
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/build.xml?rev=818584r1=818583r2=818584view=diff
==
--- hadoop/zookeeper/trunk/build.xml (original)
+++ hadoop/zookeeper/trunk/build.xml Thu Sep 24 18:50:23 2009
@@ -269,9 +269,11 @@
dest=${lib.dir}/ivy-${ivy.version}.jar usetimestamp=true/
 /target
 
-target name=ivy-init depends=ivy-download
+target name=ivy-init depends=ivy-download unless=ivy.initialized
   taskdef resource=org/apache/ivy/ant/antlib.xml
uri=antlib:org.apache.ivy.ant classpathref=java.classpath/
+  !-- ensure that ivy taskdef is only run once, otw ant will error --
+  property name=ivy.initialized value=true/
 /target
 
 target name=ivy-retrieve depends=init,ivy-init
@@ -1044,6 +1046,9 @@
/exec
  /target
 
+ !-- this target runs the hudson trunk build --
+ target name=hudson-test-trunk depends=docs,tar,findbugs/
+
  target name=api-xml depends=ivy-retrieve-jdiff, javadoc, write-null
javadoc
  doclet name=jdiff.JDiff




svn commit: r822065 - in /hadoop/zookeeper/trunk: CHANGES.txt build.xml

2009-10-05 Thread mahadev
Author: mahadev
Date: Mon Oct  5 22:37:24 2009
New Revision: 822065

URL: http://svn.apache.org/viewvc?rev=822065view=rev
Log:
ZOOKEEPER-539. generate eclipse project via ant target. (phunt via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/build.xml

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=822065r1=822064r2=822065view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Mon Oct  5 22:37:24 2009
@@ -95,7 +95,7 @@
   via mahadev)
 
 NEW FEATURES:
-
+  ZOOKEEPER-539. generate eclipse project via ant target. (phunt via mahadev)
 
 Release 3.2.0 - 2009-06-30
 

Modified: hadoop/zookeeper/trunk/build.xml
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/build.xml?rev=822065r1=822064r2=822065view=diff
==
--- hadoop/zookeeper/trunk/build.xml (original)
+++ hadoop/zookeeper/trunk/build.xml Mon Oct  5 22:37:24 2009
@@ -133,6 +133,12 @@
 property name=jdiff.stable.javadoc 
 
value=http://hadoop.apache.org/zookeeper/docs/r${jdiff.stable}/api//
 
+!-- eclipse property set --
+property name=build.dir.eclipse value=.eclipse/
+property name=build.dir.eclipse-main-classes 
value=${build.dir.eclipse}/classes-main/
+property name=build.dir.eclipse-test-classes 
value=${build.dir.eclipse}/classes-test/
+
+
 !-- == --
 !-- Macro definitions  --
 !-- == --
@@ -1108,4 +1114,65 @@
/javadoc
  /target
 
+ condition property=ant-eclipse.jar.exists
+   available file=${lib.dir}/ant-eclipse-1.0-jvm1.2.jar/
+ /condition
+
+ target name=ant-eclipse-download unless=ant-eclipse.jar.exists
+   get 
src=http://downloads.sourceforge.net/project/ant-eclipse/ant-eclipse/1.0/ant-eclipse-1.0.bin.tar.bz2;
+dest=${src.dir}/java/ant-eclipse-1.0.bin.tar.bz2 
usetimestamp=false /
+
+   bunzip2 src=${src.dir}/java/ant-eclipse-1.0.bin.tar.bz2/
+
+   untar src=${src.dir}/java/ant-eclipse-1.0.bin.tar
+  dest=${src.dir}/java
+ patternset
+   include name=lib/ant-eclipse-1.0-jvm1.2.jar/
+ /patternset
+   /untar
+
+   delete file=${src.dir}/java/ant-eclipse-1.0.bin.tar /
+   delete file=${src.dir}/java/ant-eclipse-1.0.bin.tar.bz2 /
+ /target
+
+ target name=eclipse
+ 
depends=ant-eclipse-download,init,ivy-retrieve,build-generated,ivy-retrieve-test
+ description=Create eclipse project files
+   ivy:resolve useOrigin=true conf=test/
+   ivy:cachepath pathid=default.path.id conf=default /
+   ivy:cachepath pathid=junit.path.id conf=test transitive=false/
+   taskdef name=eclipse
+classname=prantl.ant.eclipse.EclipseTask
+classpathref=java.classpath /
+   eclipse updatealways=true
+ settings
+   jdtcore compilercompliance=6.0 /
+   resources encoding=UTF-8 /
+ /settings
+ project name=${ant.project.name} /
+ classpath
+   source path=${java.src.dir}
+   output=${build.dir.eclipse-main-classes} /
+   source path=${src_generated.dir}
+   output=${build.dir.eclipse-main-classes} /
+   source path=${test.src.dir}
+   output=${build.dir.eclipse-test-classes} /
+   source path=${systest.src.dir}
+   output=${build.dir.eclipse-test-classes} /
+
+   output path=${build.dir.eclipse-main-classes} /
+   library pathref=default.path.id exported=true /
+   library pathref=junit.path.id exported=false /
+ /classpath
+   /eclipse
+ /target
+
+ target name=clean-eclipse description=Clean eclipse files
+   delete file=.classpath /
+   delete file=.eclipse /
+   delete file=.project /
+   delete dir=.settings /
+   delete dir=${build.dir.eclipse} /
+ /target
+
 /project




svn commit: r823371 - in /hadoop/zookeeper/trunk: ./ src/contrib/zkpython/ src/contrib/zkpython/src/c/ src/contrib/zkpython/src/test/

2009-10-08 Thread mahadev
Author: mahadev
Date: Fri Oct  9 00:42:18 2009
New Revision: 823371

URL: http://svn.apache.org/viewvc?rev=823371view=rev
Log:
ZOOKEEPER-510. zkpython lumps all exceptions as IOError, needs specialized 
exceptions for KeeperException types (henry  pat via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/src/contrib/zkpython/build.xml
hadoop/zookeeper/trunk/src/contrib/zkpython/src/c/zookeeper.c
hadoop/zookeeper/trunk/src/contrib/zkpython/src/test/connection_test.py
hadoop/zookeeper/trunk/src/contrib/zkpython/src/test/create_test.py
hadoop/zookeeper/trunk/src/contrib/zkpython/src/test/delete_test.py
hadoop/zookeeper/trunk/src/contrib/zkpython/src/test/exists_test.py
hadoop/zookeeper/trunk/src/contrib/zkpython/src/test/get_set_test.py
hadoop/zookeeper/trunk/src/contrib/zkpython/src/test/run_tests.sh
hadoop/zookeeper/trunk/src/contrib/zkpython/src/test/zktestbase.py

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=823371r1=823370r2=823371view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Fri Oct  9 00:42:18 2009
@@ -84,6 +84,9 @@
 
   ZOOKEEPER-542. c-client can spin when server unresponsive (Christian
   Wiedmann via mahadev)
+
+  ZOOKEEEPER-510. zkpython lumps all exceptions as IOError, needs specialized
+  exceptions for KeeperException types (henry  pat via mahadev)
  
 IMPROVEMENTS:
   ZOOKEEPER-473. cleanup junit tests to eliminate false positives due to

Modified: hadoop/zookeeper/trunk/src/contrib/zkpython/build.xml
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/contrib/zkpython/build.xml?rev=823371r1=823370r2=823371view=diff
==
--- hadoop/zookeeper/trunk/src/contrib/zkpython/build.xml (original)
+++ hadoop/zookeeper/trunk/src/contrib/zkpython/build.xml Fri Oct  9 00:42:18 
2009
@@ -22,7 +22,7 @@
   property name=python.src.dir value=src/python/
   property name=test.build.dir value=build/test/ /
   property name=test.src.dir value=src/test/
-  property name=test.log.dir value=${test.build.dir}/logs /
+  property name=test.log.dir value=${build.test}/logs /
   property name=test.output value=no /
   property name=test.timeout value=90 /
 
@@ -53,6 +53,7 @@
 target name=python-test
   exec executable=${test.src.dir}/run_tests.sh failonerror=true
 arg value=${test.src.dir}/
+arg value=${test.log.dir}/
   /exec
 /target
 

Modified: hadoop/zookeeper/trunk/src/contrib/zkpython/src/c/zookeeper.c
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/contrib/zkpython/src/c/zookeeper.c?rev=823371r1=823370r2=823371view=diff
==
--- hadoop/zookeeper/trunk/src/contrib/zkpython/src/c/zookeeper.c (original)
+++ hadoop/zookeeper/trunk/src/contrib/zkpython/src/c/zookeeper.c Fri Oct  9 
00:42:18 2009
@@ -24,10 +24,91 @@
 static zhandle_t* zhandles[MAX_ZHANDLES];
 static int num_zhandles = 0;
 
-#define CHECK_ZHANDLE(z) if ( (z)  0 || (z) = num_zhandles ) { \
-  PyErr_SetString( PyExc_ValueError, zhandle out of range ); \
-  return NULL; \
-  }
+//
+// EXCEPTIONS
+PyObject *ZooKeeperException = NULL;
+PyObject *SystemErrorException;
+PyObject *RuntimeInconsistencyException;
+PyObject *DataInconsistencyException;
+PyObject *ConnectionLossException;
+PyObject *MarshallingErrorException;
+PyObject *UnimplementedException;
+PyObject *OperationTimeoutException;
+PyObject *BadArgumentsException;
+PyObject *InvalidStateException;
+
+PyObject *ApiErrorException;
+PyObject *NoNodeException;
+PyObject *NoAuthException;
+PyObject *NodeExistsException;
+PyObject *BadVersionException;
+PyObject *NoChildrenForEphemeralsException;
+PyObject *NotEmptyException;
+PyObject *SessionExpiredException;
+PyObject *SessionMovedException;
+PyObject *InvalidCallbackException;
+PyObject *InvalidACLException;
+PyObject *AuthFailedException;
+PyObject *ClosingException;
+PyObject *NothingException;
+
+PyObject *err_to_exception(int errcode) {
+  switch (errcode) {
+case ZSYSTEMERROR:
+  return SystemErrorException;
+case ZRUNTIMEINCONSISTENCY:
+  return RuntimeInconsistencyException;
+case ZDATAINCONSISTENCY:
+  return DataInconsistencyException;
+case ZCONNECTIONLOSS:
+  return ConnectionLossException;
+case ZMARSHALLINGERROR:
+  return MarshallingErrorException;
+case ZUNIMPLEMENTED:
+  return UnimplementedException;
+case ZOPERATIONTIMEOUT:
+  return OperationTimeoutException;
+case ZBADARGUMENTS:
+  return BadArgumentsException;
+case ZAPIERROR:
+  return ApiErrorException;
+case ZNONODE:
+  return NoNodeException;
+case ZNOAUTH:
+  return

svn commit: r828216 - in /hadoop/zookeeper/trunk: CHANGES.txt src/c/src/zk_adaptor.h src/c/src/zookeeper.c

2009-10-21 Thread mahadev
Author: mahadev
Date: Wed Oct 21 21:00:37 2009
New Revision: 828216

URL: http://svn.apache.org/viewvc?rev=828216view=rev
Log:
ZOOKEEPER-530. Memory corruption: Zookeeper c client IPv6 implementation does 
not honor struct sockaddr_in6 size (isabel drost via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/src/c/src/zk_adaptor.h
hadoop/zookeeper/trunk/src/c/src/zookeeper.c

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=828216r1=828215r2=828216view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Wed Oct 21 21:00:37 2009
@@ -104,6 +104,9 @@
 
   ZOOKEEPER-529. Use Ivy to pull dependencies and also generate pom (phunt
   via mahadev)
+  
+  ZOOKEEPER-530. Memory corruption: Zookeeper c client IPv6 implementation
+  does not honor struct sockaddr_in6 size (isabel drost via mahadev)
 
 NEW FEATURES:
   ZOOKEEPER-539. generate eclipse project via ant target. (phunt via mahadev)

Modified: hadoop/zookeeper/trunk/src/c/src/zk_adaptor.h
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/src/zk_adaptor.h?rev=828216r1=828215r2=828216view=diff
==
--- hadoop/zookeeper/trunk/src/c/src/zk_adaptor.h (original)
+++ hadoop/zookeeper/trunk/src/c/src/zk_adaptor.h Wed Oct 21 21:00:37 2009
@@ -170,7 +170,7 @@
 struct _zhandle {
 int fd; /* the descriptor used to talk to zookeeper */
 char *hostname; /* the hostname of zookeeper */
-struct sockaddr *addrs; /* the addresses that correspond to the hostname */
+struct sockaddr_storage *addrs; /* the addresses that correspond to the 
hostname */
 int addrs_count; /* The number of addresses in the addrs array */
 watcher_fn watcher; /* the registered watcher */
 struct timeval last_recv; /* The time that the last message was received */

Modified: hadoop/zookeeper/trunk/src/c/src/zookeeper.c
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/src/zookeeper.c?rev=828216r1=828215r2=828216view=diff
==
--- hadoop/zookeeper/trunk/src/c/src/zookeeper.c (original)
+++ hadoop/zookeeper/trunk/src/c/src/zookeeper.c Wed Oct 21 21:00:37 2009
@@ -165,7 +165,7 @@
 
 const char*err2string(int err);
 static int queue_session_event(zhandle_t *zh, int state);
-static const char* format_endpoint_info(const struct sockaddr* ep);
+static const char* format_endpoint_info(const struct sockaddr_storage* ep);
 static const char* format_current_endpoint_info(zhandle_t* zh);
 
 /* completion routine forward declarations */
@@ -406,7 +406,7 @@
 int getaddrs(zhandle_t *zh)
 {
 struct addrinfo hints, *res, *res0;
-struct sockaddr *addr;
+struct sockaddr_storage *addr;
 char *hosts = strdup(zh-hostname);
 char *host;
 char *strtok_last;
@@ -500,10 +500,10 @@
 setup_random();
 /* Permute */
 for(i = 0; i  zh-addrs_count; i++) {
-struct sockaddr *s1 = zh-addrs + random()%zh-addrs_count;
-struct sockaddr *s2 = zh-addrs + random()%zh-addrs_count;
+struct sockaddr_storage *s1 = zh-addrs + random()%zh-addrs_count;
+struct sockaddr_storage *s2 = zh-addrs + random()%zh-addrs_count;
 if (s1 != s2) {
-struct sockaddr t = *s1;
+struct sockaddr_storage t = *s1;
 *s1 = *s2;
 *s2 = t;
 }
@@ -1347,11 +1347,18 @@
 int rc;
 int on = 1;
 
-zh-fd = socket(PF_INET, SOCK_STREAM, 0);
+zh-fd = socket(zh-addrs[zh-connect_index].ss_family, 
SOCK_STREAM, 0);
+if (zh-fd  0) {
+return api_epilog(zh,handle_socket_error_msg(zh,__LINE__,
+ ZSYSTEMERROR, 
socket() call failed));
+}
 setsockopt(zh-fd, IPPROTO_TCP, TCP_NODELAY, on, sizeof(int));
 fcntl(zh-fd, F_SETFL, O_NONBLOCK|fcntl(zh-fd, F_GETFL, 0));
-rc = connect(zh-fd, zh-addrs[zh-connect_index],
-sizeof(struct sockaddr));
+if (zh-addrs[zh-connect_index].ss_family == AF_INET6) {
+rc = connect(zh-fd, (struct sockaddr*) 
zh-addrs[zh-connect_index], sizeof(struct sockaddr_in6));
+} else {
+rc = connect(zh-fd, (struct sockaddr*) 
zh-addrs[zh-connect_index], sizeof(struct sockaddr_in));
+}
 if (rc == -1) {
 /* we are handling the non-blocking connect according to
  * the description in section 16.3 Non-blocking connect
@@ -2695,7 +2702,7 @@
 return ZOK;
 }
 
-static const char* format_endpoint_info(const struct sockaddr* ep)
+static const char

svn commit: r831096 - in /hadoop/zookeeper/branches/branch-3.2: CHANGES.txt src/c/src/zookeeper.c src/c/tests/TestOperations.cc

2009-10-29 Thread mahadev
Author: mahadev
Date: Thu Oct 29 21:34:08 2009
New Revision: 831096

URL: http://svn.apache.org/viewvc?rev=831096view=rev
Log:
ZOOKEEPER-562. c client can flood server with pings if tcp send queue filled 
(ben reed via mahadev)

Modified:
hadoop/zookeeper/branches/branch-3.2/CHANGES.txt
hadoop/zookeeper/branches/branch-3.2/src/c/src/zookeeper.c
hadoop/zookeeper/branches/branch-3.2/src/c/tests/TestOperations.cc

Modified: hadoop/zookeeper/branches/branch-3.2/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/CHANGES.txt?rev=831096r1=831095r2=831096view=diff
==
--- hadoop/zookeeper/branches/branch-3.2/CHANGES.txt (original)
+++ hadoop/zookeeper/branches/branch-3.2/CHANGES.txt Thu Oct 29 21:34:08 2009
@@ -67,6 +67,9 @@
   ZOOKEEPER-518. DEBUG message for outstanding proposals in leader should be
moved to trace. (phunt)
 
+  ZOOKEEPER-562. c client can flood server with pings if tcp send queue
+  filled (ben reed via mahadev)
+
 IMPROVEMENTS:
 
 NEW FEATURES:

Modified: hadoop/zookeeper/branches/branch-3.2/src/c/src/zookeeper.c
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/src/c/src/zookeeper.c?rev=831096r1=831095r2=831096view=diff
==
--- hadoop/zookeeper/branches/branch-3.2/src/c/src/zookeeper.c (original)
+++ hadoop/zookeeper/branches/branch-3.2/src/c/src/zookeeper.c Thu Oct 29 
21:34:08 2009
@@ -1392,7 +1392,7 @@
 // a PING
 if (zh-state==ZOO_CONNECTED_STATE) {
 send_to = zh-recv_timeout/3 - idle_send;
-if (send_to = 0) {
+if (send_to = 0  zh-sent_requests.head==0) {
 //LOG_DEBUG((Sending PING to %s (exceeded idle by %dms),
 //format_current_endpoint_info(zh),-send_to));
 int rc=send_ping(zh);

Modified: hadoop/zookeeper/branches/branch-3.2/src/c/tests/TestOperations.cc
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/src/c/tests/TestOperations.cc?rev=831096r1=831095r2=831096view=diff
==
--- hadoop/zookeeper/branches/branch-3.2/src/c/tests/TestOperations.cc 
(original)
+++ hadoop/zookeeper/branches/branch-3.2/src/c/tests/TestOperations.cc Thu Oct 
29 21:34:08 2009
@@ -265,6 +265,27 @@
 // only one ping so far?
 CPPUNIT_ASSERT_EQUAL(1,zkServer.pingCount_);
 CPPUNIT_ASSERT(timeMock==zh-last_recv);
+
+// Round 4
+// make sure that a ping is not sent if something is outstanding
+AsyncGetOperationCompletion res1;
+rc=zoo_aget(zh,/x/y/1,0,asyncCompletion,res1);
+CPPUNIT_ASSERT_EQUAL((int)ZOK,rc);
+rc=zookeeper_interest(zh,fd,interest,tv);
+CPPUNIT_ASSERT_EQUAL((int)ZOK,rc);
+timeMock.tick(tv);  
+rc=zookeeper_interest(zh,fd,interest,tv);
+CPPUNIT_ASSERT_EQUAL((int)ZOK,rc);
+rc=zookeeper_process(zh,interest);
+CPPUNIT_ASSERT_EQUAL((int)ZNOTHING,rc);
+rc=zookeeper_interest(zh,fd,interest,tv);
+CPPUNIT_ASSERT_EQUAL((int)ZOK,rc);
+// pseudo-sleep for a short while (10 ms)
+timeMock.millitick(10);
+rc=zookeeper_process(zh,interest);
+CPPUNIT_ASSERT_EQUAL((int)ZNOTHING,rc);
+// only one ping so far?
+CPPUNIT_ASSERT_EQUAL(1,zkServer.pingCount_);
 }
 
 // simulate a watch arriving right before a ping is due
@@ -332,6 +353,7 @@
 
 // queue up a request; keep it pending (as if the server is busy or 
has died)
 AsyncGetOperationCompletion res1;
+zkServer.addOperationResponse(new ZooGetResponse(2,1));
 int rc=zoo_aget(zh,/x/y/1,0,asyncCompletion,res1);
 
 int fd=0;
@@ -344,7 +366,7 @@
 CPPUNIT_ASSERT_EQUAL((int)ZOK,rc);
 // no delay -- the socket is writable
 rc=zookeeper_process(zh,interest);
-CPPUNIT_ASSERT_EQUAL((int)ZNOTHING,rc); // ZNOTHING -- no response yet
+CPPUNIT_ASSERT_EQUAL((int)ZOK,rc); 
 
 // Round 2.
 // what's next?




svn commit: r831371 [2/2] - in /hadoop/zookeeper/trunk: ./ src/java/main/org/apache/zookeeper/server/quorum/ src/java/test/config/ src/java/test/org/apache/zookeeper/test/

2009-10-30 Thread mahadev
Modified: 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/QuorumTest.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/QuorumTest.java?rev=831371r1=831370r2=831371view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/QuorumTest.java 
(original)
+++ 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/QuorumTest.java 
Fri Oct 30 16:19:13 2009
@@ -30,7 +30,7 @@
 import org.apache.zookeeper.ZooKeeper;
 import org.apache.zookeeper.ZooDefs.Ids;
 import org.apache.zookeeper.data.Stat;
-import org.apache.zookeeper.server.quorum.FollowerHandler;
+import org.apache.zookeeper.server.quorum.LearnerHandler;
 import org.apache.zookeeper.server.quorum.Leader;
 import org.junit.Before;
 import org.junit.Test;
@@ -91,6 +91,27 @@
 ct.testClientWithWatcherObj();
 }
 
+@Test
+public void testGetView() {
+ct.assertEquals(5,qb.s1.getView().size());
+ct.assertEquals(5,qb.s2.getView().size());
+ct.assertEquals(5,qb.s3.getView().size());
+ct.assertEquals(5,qb.s4.getView().size());
+ct.assertEquals(5,qb.s5.getView().size());
+}
+
+@Test
+public void testViewContains() {
+// Test view contains self
+ct.assertTrue(qb.s1.viewContains(qb.s1.getId()));
+
+// Test view contains other servers
+ct.assertTrue(qb.s1.viewContains(qb.s2.getId()));
+
+// Test view does not contain non-existant servers
+ct.assertFalse(qb.s1.viewContains(-1L));
+}
+
 volatile int counter = 0;
 volatile int errors = 0;
 @Test
@@ -117,9 +138,9 @@
 }
 }, null);
 }
-ArrayListFollowerHandler fhs = new 
ArrayListFollowerHandler(leader.forwardingFollowers);
-for(FollowerHandler f: fhs) {
-f.sock.shutdownInput();
+ArrayListLearnerHandler fhs = new 
ArrayListLearnerHandler(leader.forwardingFollowers);
+for(LearnerHandler f: fhs) {
+f.getSocket().shutdownInput();
 }
 for(int i = 0; i  5000; i++) {
 zk.setData(/blah/blah, new byte[0], -1, new 
AsyncCallback.StatCallback() {




svn commit: r882739 - in /hadoop/zookeeper/branches/branch-3.1: ./ src/java/main/org/apache/zookeeper/server/quorum/ src/java/test/org/apache/zookeeper/test/

2009-11-20 Thread mahadev
Author: mahadev
Date: Fri Nov 20 22:24:36 2009
New Revision: 882739

URL: http://svn.apache.org/viewvc?rev=882739view=rev
Log:
ZOOKEEPER-582. ZooKeeper can revert to old data when a snapshot is created 
outside of normal processing (ben reed and mahadev via mahadev)

Added:

hadoop/zookeeper/branches/branch-3.1/src/java/test/org/apache/zookeeper/test/QuorumZxidSyncTest.java
Modified:
hadoop/zookeeper/branches/branch-3.1/CHANGES.txt

hadoop/zookeeper/branches/branch-3.1/src/java/main/org/apache/zookeeper/server/quorum/Follower.java

hadoop/zookeeper/branches/branch-3.1/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java

hadoop/zookeeper/branches/branch-3.1/src/java/test/org/apache/zookeeper/test/ClientBase.java

hadoop/zookeeper/branches/branch-3.1/src/java/test/org/apache/zookeeper/test/QuorumBase.java

Modified: hadoop/zookeeper/branches/branch-3.1/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.1/CHANGES.txt?rev=882739r1=882738r2=882739view=diff
==
--- hadoop/zookeeper/branches/branch-3.1/CHANGES.txt (original)
+++ hadoop/zookeeper/branches/branch-3.1/CHANGES.txt Fri Nov 20 22:24:36 2009
@@ -7,6 +7,8 @@
   ZOOKEEPER-562. c client can flood server with pings if tcp send queue
   filled. (ben reed via mahadev)
 
+  ZOOKEEPER-582. ZooKeeper can revert to old data when a snapshot is created
+  outside of normal processing (ben reed and mahadev via mahadev)
 
 Release 3.1.1 - 2009-03-17
 

Modified: 
hadoop/zookeeper/branches/branch-3.1/src/java/main/org/apache/zookeeper/server/quorum/Follower.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.1/src/java/main/org/apache/zookeeper/server/quorum/Follower.java?rev=882739r1=882738r2=882739view=diff
==
--- 
hadoop/zookeeper/branches/branch-3.1/src/java/main/org/apache/zookeeper/server/quorum/Follower.java
 (original)
+++ 
hadoop/zookeeper/branches/branch-3.1/src/java/main/org/apache/zookeeper/server/quorum/Follower.java
 Fri Nov 20 22:24:36 2009
@@ -172,7 +172,16 @@
 writePacket(qp);
 readPacket(qp);
 long newLeaderZxid = qp.getZxid();
-
+
+//check to see if the leader zxid is lower than ours
+//this should never happen but is just a safety check
+long lastLoggedZxid = sentLastZxid;
+if ((newLeaderZxid  32L)  (lastLoggedZxid  32L)) {
+LOG.fatal(Leader epoch  + Long.toHexString(newLeaderZxid 
 32L)
++  is less than our zxid  + 
Long.toHexString(lastLoggedZxid  32L));
+throw new IOException(Error: Epoch of leader is lower);
+}
+
 if (qp.getType() != Leader.NEWLEADER) {
 LOG.error(First packet should have been NEWLEADER);
 throw new IOException(First packet should have been 
NEWLEADER);

Modified: 
hadoop/zookeeper/branches/branch-3.1/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.1/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java?rev=882739r1=882738r2=882739view=diff
==
--- 
hadoop/zookeeper/branches/branch-3.1/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java
 (original)
+++ 
hadoop/zookeeper/branches/branch-3.1/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java
 Fri Nov 20 22:24:36 2009
@@ -34,6 +34,7 @@
 import org.apache.zookeeper.server.NIOServerCnxn;
 import org.apache.zookeeper.server.ZooKeeperServer;
 import org.apache.zookeeper.server.persistence.FileTxnSnapLog;
+import org.apache.zookeeper.server.persistence.Util;
 
 /**
  * This class manages the quorum protocol. There are three states this server
@@ -327,9 +328,35 @@
 new NIOServerCnxn.Factory(clientPort));
 }
 
-public long getLastLoggedZxid(){
-return logFactory.getLastLoggedZxid();
+/**
+ * returns the highest zxid that this host has seen
+ * 
+ * @return the highest zxid for this host
+ */
+public long getLastLoggedZxid() {
+/*
+ * it is possible to have the last zxid with just a snapshot and no log
+ * related to it. one example is during upgrade wherein the there is no
+ * corresponding log to the snapshot. in that case just use the 
snapshot
+ * zxid
+ */
+
+File lastSnapshot = null;
+long maxZxid = -1L;
+long maxLogZxid = logFactory.getLastLoggedZxid();
+try {
+lastSnapshot = logFactory.findMostRecentSnapshot();
+if (lastSnapshot != null) {
+maxZxid = Math.max(Util.getZxidFromName(lastSnapshot.getName

svn commit: r882742 - in /hadoop/zookeeper/branches/branch-3.2: ./ src/java/main/org/apache/zookeeper/server/quorum/ src/java/test/org/apache/zookeeper/test/

2009-11-20 Thread mahadev
Author: mahadev
Date: Fri Nov 20 22:27:29 2009
New Revision: 882742

URL: http://svn.apache.org/viewvc?rev=882742view=rev
Log:
ZOOKEEPER-582. ZooKeeper can revert to old data when a snapshot is created 
outside of normal processing (ben reed and mahadev via mahadev)

Added:

hadoop/zookeeper/branches/branch-3.2/src/java/test/org/apache/zookeeper/test/QuorumZxidSyncTest.java
Modified:
hadoop/zookeeper/branches/branch-3.2/CHANGES.txt

hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/Follower.java

hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java

hadoop/zookeeper/branches/branch-3.2/src/java/test/org/apache/zookeeper/test/ClientBase.java

hadoop/zookeeper/branches/branch-3.2/src/java/test/org/apache/zookeeper/test/QuorumBase.java

Modified: hadoop/zookeeper/branches/branch-3.2/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/CHANGES.txt?rev=882742r1=882741r2=882742view=diff
==
--- hadoop/zookeeper/branches/branch-3.2/CHANGES.txt (original)
+++ hadoop/zookeeper/branches/branch-3.2/CHANGES.txt Fri Nov 20 22:27:29 2009
@@ -28,10 +28,13 @@
   (mahadev via breed)
 
   ZOOKEEPER-585. Update README for zkpython in 3.2.2 (henry robinson via phunt)
-
+  
   ZOOKEEPER-576. docs need to be updated for session moved exception and how
   to handle it (breed via phunt)
 
+  ZOOKEEPER-582. ZooKeeper can revert to old data when a snapshot is created
+  outside of normal processing (ben reed and mahadev via mahadev)
+
 Release 3.2.1 - 2009-08-27
 
 Backward compatible changes:

Modified: 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/Follower.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/Follower.java?rev=882742r1=882741r2=882742view=diff
==
--- 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/Follower.java
 (original)
+++ 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/Follower.java
 Fri Nov 20 22:27:29 2009
@@ -192,7 +192,16 @@
 writePacket(qp, true);
 readPacket(qp);
 long newLeaderZxid = qp.getZxid();
-
+
+//check to see if the leader zxid is lower than ours
+//this should never happen but is just a safety check
+long lastLoggedZxid = sentLastZxid;
+if ((newLeaderZxid  32L)  (lastLoggedZxid  32L)) {
+LOG.fatal(Leader epoch  + Long.toHexString(newLeaderZxid 
 32L)
++  is less than our zxid  + 
Long.toHexString(lastLoggedZxid  32L));
+throw new IOException(Error: Epoch of leader is lower);
+}
+
 if (qp.getType() != Leader.NEWLEADER) {
 LOG.error(First packet should have been NEWLEADER);
 throw new IOException(First packet should have been 
NEWLEADER);

Modified: 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java?rev=882742r1=882741r2=882742view=diff
==
--- 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java
 (original)
+++ 
hadoop/zookeeper/branches/branch-3.2/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java
 Fri Nov 20 22:27:29 2009
@@ -34,6 +34,7 @@
 import org.apache.zookeeper.server.NIOServerCnxn;
 import org.apache.zookeeper.server.ZooKeeperServer;
 import org.apache.zookeeper.server.persistence.FileTxnSnapLog;
+import org.apache.zookeeper.server.persistence.Util;
 import org.apache.zookeeper.server.quorum.flexible.QuorumVerifier;
 import org.apache.zookeeper.server.quorum.flexible.QuorumMaj;
 
@@ -375,9 +376,35 @@
 new NIOServerCnxn.Factory(clientPort), quorumConfig);
 }
 
-public long getLastLoggedZxid(){
-return logFactory.getLastLoggedZxid();
+/**
+ * returns the highest zxid that this host has seen
+ * 
+ * @return the highest zxid for this host
+ */
+public long getLastLoggedZxid() {
+/*
+ * it is possible to have the last zxid with just a snapshot and no log
+ * related to it. one example is during upgrade wherein the there is no
+ * corresponding log to the snapshot. in that case just use the 
snapshot
+ * zxid
+ */
+
+File lastSnapshot = null;
+long maxZxid = -1L;
+long maxLogZxid

svn commit: r886655 - in /hadoop/zookeeper/trunk: CHANGES.txt src/java/main/org/apache/zookeeper/server/quorum/CommitProcessor.java

2009-12-02 Thread mahadev
Author: mahadev
Date: Thu Dec  3 02:12:28 2009
New Revision: 886655

URL: http://svn.apache.org/viewvc?rev=886655view=rev
Log:
ZOOKEEPER-597. ASyncHammerTest is failing intermittently on hudson trunk (take 
3) (phunt via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/CommitProcessor.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=886655r1=886654r2=886655view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Thu Dec  3 02:12:28 2009
@@ -142,6 +142,9 @@
   ZOOKEEPER-597. ASyncHammerTest is failing intermittently on hudson trunk 
(take 2)
   (breed)
 
+  ZOOKEEPER-597. ASyncHammerTest is failing intermittently on hudson trunk
+  (take 3) (phunt 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/server/quorum/CommitProcessor.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/CommitProcessor.java?rev=886655r1=886654r2=886655view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/CommitProcessor.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/CommitProcessor.java
 Thu Dec  3 02:12:28 2009
@@ -142,6 +142,8 @@
 }
 } catch (InterruptedException e) {
 LOG.warn(Interrupted exception while waiting, e);
+} catch (Throwable e) {
+LOG.error(Unexpected exception causing CommitProcessor to exit, 
e);
 }
 LOG.info(CommitProcessor exited loop!);
 }




svn commit: r886960 - in /hadoop/zookeeper/trunk: CHANGES.txt src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java

2009-12-03 Thread mahadev
Author: mahadev
Date: Thu Dec  3 22:30:44 2009
New Revision: 886960

URL: http://svn.apache.org/viewvc?rev=886960view=rev
Log:
ZOOKEEPER-597. ASyncHammerTest is failing intermittently on hudson trunk (take 
4) (breed via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=886960r1=886959r2=886960view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Thu Dec  3 22:30:44 2009
@@ -145,6 +145,9 @@
   ZOOKEEPER-597. ASyncHammerTest is failing intermittently on hudson trunk
   (take 3) (phunt via mahadev)
 
+  ZOOKEEPER-597. ASyncHammerTest is failing intermittently on hudson trunk
+  (take 4) (breed 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/server/NIOServerCnxn.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java?rev=886960r1=886959r2=886960view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
 Thu Dec  3 22:30:44 2009
@@ -71,6 +71,13 @@
 
 private ConnectionBean jmxConnectionBean;
 
+static {
+Thread.setDefaultUncaughtExceptionHandler(new 
Thread.UncaughtExceptionHandler() {
+public void uncaughtException(Thread t, Throwable e) {
+LOG.error(Thread  + t +  died, e);
+}
+});
+}
 
 static public class Factory extends Thread {
 ZooKeeperServer zks;
@@ -937,8 +944,6 @@
 return NIOServerCnxn object with sock =  + sock +  and sk =  + sk;
 }
 
-boolean closed;
-
 /*
  * (non-Javadoc)
  *
@@ -955,12 +960,6 @@
 }
 jmxConnectionBean = null;
 
-synchronized(this) {
-if (closed) {
-return;
-}
-closed = true;
-}
 synchronized (factory.ipMap)
 {
 SetNIOServerCnxn s = 
factory.ipMap.get(sock.socket().getInetAddress());
@@ -1041,14 +1040,6 @@
  */
 synchronized public void sendResponse(ReplyHeader h, Record r, String tag) 
{
 try {
-if (closed) {
-if (LOG.isTraceEnabled()) {
-LOG.trace(send called on closed session 0x
-  + Long.toHexString(sessionId)
-  +  with record  + r);
-}
-return;
-}
 ByteArrayOutputStream baos = new ByteArrayOutputStream();
 // Make space for length
 BinaryOutputArchive bos = BinaryOutputArchive.getArchive(baos);
@@ -1078,7 +1069,7 @@
 }
 }
  } catch(Exception e) {
-LOG.error(Unexpected exception. Destruction averted., e);
+LOG.warn(Unexpected exception. Destruction averted., e);
  }
 }
 




svn commit: r888163 - in /hadoop/zookeeper/trunk: CHANGES.txt src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java

2009-12-07 Thread mahadev
Author: mahadev
Date: Mon Dec  7 22:31:08 2009
New Revision: 888163

URL: http://svn.apache.org/viewvc?rev=888163view=rev
Log:
ZOOKEEPER-611.  hudson build failiure (mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=888163r1=888162r2=888163view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Mon Dec  7 22:31:08 2009
@@ -151,6 +151,8 @@
   ZOOKEEPER-597. ASyncHammerTest is failing intermittently on hudson trunk 
   (take 5) (mahadev)
 
+  ZOOKEEPER-611.  hudson build failiure (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/server/NIOServerCnxn.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java?rev=888163r1=888162r2=888163view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
 Mon Dec  7 22:31:08 2009
@@ -77,17 +77,13 @@
 LOG.error(Thread  + t +  died, e);
 }
 });
-
 /**
  * this is to avoid the jvm bug:
  * NullPointerException in Selector.open()
  * http://bugs.sun.com/view_bug.do?bug_id=6427854
  */
-try {
-   Selector.open().close();
-} catch(IOException ie) {
-   LOG.error(Exception while opening a selector, ie);
-}
+System.setProperty(sun.nio.ch.bugLevel, 
+System.getProperty(sun.nio.ch.bugLevel,));
 }
 
 static public class Factory extends Thread {




svn commit: r888216 - in /hadoop/zookeeper/trunk: CHANGES.txt src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java

2009-12-07 Thread mahadev
Author: mahadev
Date: Tue Dec  8 01:20:42 2009
New Revision: 888216

URL: http://svn.apache.org/viewvc?rev=888216view=rev
Log:
ZOOKEEPER-611. hudson build failure (take 2) (mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=888216r1=888215r2=888216view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Tue Dec  8 01:20:42 2009
@@ -153,6 +153,8 @@
 
   ZOOKEEPER-611.  hudson build failiure (mahadev)
 
+  ZOOKEEPER-611. hudson build failure (take 2) (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/server/NIOServerCnxn.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java?rev=888216r1=888215r2=888216view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
 Tue Dec  8 01:20:42 2009
@@ -71,22 +71,25 @@
 
 private ConnectionBean jmxConnectionBean;
 
-static {
-Thread.setDefaultUncaughtExceptionHandler(new 
Thread.UncaughtExceptionHandler() {
-public void uncaughtException(Thread t, Throwable e) {
-LOG.error(Thread  + t +  died, e);
+static public class Factory extends Thread {
+static {
+Thread.setDefaultUncaughtExceptionHandler(new 
Thread.UncaughtExceptionHandler() {
+public void uncaughtException(Thread t, Throwable e) {
+LOG.error(Thread  + t +  died, e);
+}
+});
+/**
+ * this is to avoid the jvm bug:
+ * NullPointerException in Selector.open()
+ * http://bugs.sun.com/view_bug.do?bug_id=6427854
+ */
+try {
+Selector.open().close();
+} catch(IOException ie) {
+LOG.error(Selector failed to open, ie);
 }
-});
-/**
- * this is to avoid the jvm bug:
- * NullPointerException in Selector.open()
- * http://bugs.sun.com/view_bug.do?bug_id=6427854
- */
-System.setProperty(sun.nio.ch.bugLevel, 
-System.getProperty(sun.nio.ch.bugLevel,));
-}
+}
 
-static public class Factory extends Thread {
 ZooKeeperServer zks;
 
 ServerSocketChannel ss;




svn commit: r888558 - in /hadoop/zookeeper/branches/branch-3.1: CHANGES.txt src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java

2009-12-08 Thread mahadev
Author: mahadev
Date: Tue Dec  8 20:20:46 2009
New Revision: 888558

URL: http://svn.apache.org/viewvc?rev=888558view=rev
Log:
ZOOKEEPER-611. hudson build failiure (mahadev)

Modified:
hadoop/zookeeper/branches/branch-3.1/CHANGES.txt

hadoop/zookeeper/branches/branch-3.1/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java

Modified: hadoop/zookeeper/branches/branch-3.1/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.1/CHANGES.txt?rev=888558r1=888557r2=888558view=diff
==
--- hadoop/zookeeper/branches/branch-3.1/CHANGES.txt (original)
+++ hadoop/zookeeper/branches/branch-3.1/CHANGES.txt Tue Dec  8 20:20:46 2009
@@ -13,6 +13,8 @@
   ZOOKEEPER-597. ZOOKEEPER-597. ASyncHammerTest is failing intermittently on
   hudson trunk. (pat, ben and mahadev)
 
+  ZOOKEEPER-611. hudson build failiure (mahadev)
+
 Release 3.1.1 - 2009-03-17
 
 Backward compatibile changes:

Modified: 
hadoop/zookeeper/branches/branch-3.1/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.1/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java?rev=888558r1=888557r2=888558view=diff
==
--- 
hadoop/zookeeper/branches/branch-3.1/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
 (original)
+++ 
hadoop/zookeeper/branches/branch-3.1/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
 Tue Dec  8 20:20:46 2009
@@ -70,6 +70,24 @@
 private ConnectionBean jmxConnectionBean;
 
 static public class Factory extends Thread {
+static {
+Thread.setDefaultUncaughtExceptionHandler(new 
Thread.UncaughtExceptionHandler() {
+public void uncaughtException(Thread t, Throwable e) {
+LOG.error(Thread  + t +  died, e);
+}
+});
+/**
+ * this is to avoid the jvm bug:
+ * NullPointerException in Selector.open()
+ * http://bugs.sun.com/view_bug.do?bug_id=6427854
+ */
+try {
+Selector.open().close();
+} catch(IOException ie) {
+LOG.error(Selector failed to open, ie);
+}
+}
+
 ZooKeeperServer zks;
 
 ServerSocketChannel ss;




svn commit: r889848 - in /hadoop/zookeeper/trunk: CHANGES.txt src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java src/java/test/org/apache/zookeeper/test/MaxCnxnsTest.java

2009-12-11 Thread mahadev
Author: mahadev
Date: Fri Dec 11 23:03:33 2009
New Revision: 889848

URL: http://svn.apache.org/viewvc?rev=889848view=rev
Log:
ZOOKEEPER-614. Improper synchronisation in getClientCnxnCount (henry via 
mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java

hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/MaxCnxnsTest.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=889848r1=889847r2=889848view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Fri Dec 11 23:03:33 2009
@@ -166,6 +166,9 @@
   ZOOKEEPER-587.  client should log timeout negotiated with server (phunt via
   mahadev)
 
+  ZOOKEEPER-614. Improper synchronisation in getClientCnxnCount (henry 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/server/NIOServerCnxn.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java?rev=889848r1=889847r2=889848view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
 Fri Dec 11 23:03:33 2009
@@ -201,10 +201,15 @@
 return new NIOServerCnxn(zks, sock, sk, this);
 }
 
-private int getClientCnxnCount( InetAddress cl) {
-SetNIOServerCnxn s = ipMap.get(cl);
-if (s == null) return 0;
-return s.size();
+private int getClientCnxnCount(InetAddress cl) {
+// The ipMap lock covers both the map, and its contents
+// (that is, the cnxn sets shouldn't be modified outside of
+// this lock)
+synchronized (ipMap) {
+SetNIOServerCnxn s = ipMap.get(cl);
+if (s == null) return 0;
+return s.size();
+}
 }
 
 public void run() {

Modified: 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/MaxCnxnsTest.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/MaxCnxnsTest.java?rev=889848r1=889847r2=889848view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/MaxCnxnsTest.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/MaxCnxnsTest.java
 Fri Dec 11 23:03:33 2009
@@ -23,81 +23,103 @@
 import java.net.InetSocketAddress;
 import java.nio.ByteBuffer;
 import java.nio.channels.SocketChannel;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.jute.BinaryOutputArchive;
 import org.apache.zookeeper.proto.ConnectRequest;
 
 public class MaxCnxnsTest extends ClientBase {
-
-final private int numCnxns = 5;
+final private int numCnxns = 30;
+AtomicInteger numConnected = new AtomicInteger(0); 
+String host;
+int port;
 
 protected void setUp() throws Exception {
 maxCnxns = numCnxns;
 super.setUp();
 }
 
-/**
- * Verify the ability to limit the number of concurrent connections. 
- * @throws IOException
- * @throws InterruptedException
- */
-public void testMaxCnxns() throws IOException, InterruptedException{
-SocketChannel[] sockets = new SocketChannel[numCnxns+5];
-String split[] = hostPort.split(:);
-String host = split[0];
-int port = Integer.parseInt(split[1]);
-int numConnected = 0;
-
-/*
- * For future unwary socket programmers: although connect 'blocks' it 
- * does not require an accept on the server side to return. Therefore
- * you can not assume that all the sockets are connected at the end of
- * this for loop.
- */
-for (int i=0;isockets.length;++i) {
-  SocketChannel sChannel = SocketChannel.open();
-  sChannel.connect(new InetSocketAddress(host,port));  
-  sockets[i] = sChannel;
+class CnxnThread extends Thread {
+int i;
+SocketChannel socket;
+public CnxnThread(int i) {
+super(CnxnThread-+i);
+this.i = i;
 }
-// Construct a connection request
-ConnectRequest conReq = new ConnectRequest(0, 0,
-1, 0, password.getBytes());
-ByteArrayOutputStream baos = new ByteArrayOutputStream();
-BinaryOutputArchive boa

svn commit: r892001 - in /hadoop/zookeeper/trunk: CHANGES.txt src/contrib/zkpython/src/c/zookeeper.c

2009-12-17 Thread mahadev
Author: mahadev
Date: Thu Dec 17 23:38:33 2009
New Revision: 892001

URL: http://svn.apache.org/viewvc?rev=892001view=rev
Log:
ZOOKEEPER-600. TODO pondering about allocation behavior in zkpython may be 
removed (gustavo via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/src/contrib/zkpython/src/c/zookeeper.c

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=892001r1=892000r2=892001view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Thu Dec 17 23:38:33 2009
@@ -184,6 +184,9 @@
 
   ZOOKEEPER-623. ClientBase in bookkeeper.util requires junit (fpj via breed)
 
+  ZOOKEEPER-600. TODO pondering about allocation behavior in zkpython may be
+  removed (gustavo 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/contrib/zkpython/src/c/zookeeper.c
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/contrib/zkpython/src/c/zookeeper.c?rev=892001r1=892000r2=892001view=diff
==
--- hadoop/zookeeper/trunk/src/contrib/zkpython/src/c/zookeeper.c (original)
+++ hadoop/zookeeper/trunk/src/contrib/zkpython/src/c/zookeeper.c Thu Dec 17 
23:38:33 2009
@@ -224,15 +224,29 @@
 
 PyObject *build_string_vector(const struct String_vector *sv)
 {
-   if (!sv) {
-   return PyList_New(0);
-   }
-  PyObject *ret = PyList_New(sv-count);
-  int i;
-  for (i=0;isv-count;++i) 
+  PyObject *ret;
+  if (!sv)
 {
-  PyObject *s = PyString_FromString(sv-data[i]);
-  PyList_SetItem(ret, i, s);
+  ret = PyList_New(0);
+}
+  else
+{
+  ret = PyList_New(sv-count);
+  if (ret)
+{
+  int i;
+  for (i=0;isv-count;++i) 
+{
+  PyObject *s = PyString_FromString(sv-data[i]);
+  if (!s)
+{
+  Py_DECREF(ret);
+  ret = NULL;
+  break;
+}
+  PyList_SetItem(ret, i, s);
+}
+}
 }
   return ret;
 }
@@ -407,8 +421,14 @@
 return;
   PyObject *callback = pyw-callback;
   gstate = PyGILState_Ensure();
-  PyObject *arglist = Py_BuildValue((i,i,O), pyw-zhandle,rc, 
build_string_vector(strings));
-  if (PyObject_CallObject((PyObject*)callback, arglist) == NULL)
+  PyObject *pystrings = build_string_vector(strings);
+  if (pystrings)
+{
+  PyObject *arglist = Py_BuildValue((i,i,O), pyw-zhandle, rc, 
pystrings);
+  if (arglist == NULL || PyObject_CallObject((PyObject*)callback, arglist) 
== NULL)
+PyErr_Print();
+}
+  else
 PyErr_Print();
   free_pywatcher(pyw);
   PyGILState_Release(gstate);
@@ -774,8 +794,6 @@
 
 static PyObject *pyzoo_get_children(PyObject *self, PyObject *args)
 {
-  // TO DO: Does Python copy the string or the reference? If it's the former
-  // we should free the String_vector
   int zkhid;
   char *path;
   PyObject *watcherfn = Py_None;
@@ -796,13 +814,8 @@
   return NULL;
 }
 
-  PyObject *ret = PyList_New(strings.count);
-  int i;
-  for (i=0;istrings.count;++i) 
-{
-  PyObject *s = PyString_FromString(strings.data[i]);
-  PyList_SetItem(ret, i, s);
-}
+  PyObject *ret = build_string_vector(strings);
+  deallocate_String_vector(strings);
   return ret;
 }
 




svn commit: r901510 - in /hadoop/zookeeper/trunk: CHANGES.txt src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java

2010-01-20 Thread mahadev
Author: mahadev
Date: Thu Jan 21 03:08:47 2010
New Revision: 901510

URL: http://svn.apache.org/viewvc?rev=901510view=rev
Log:
ZOOKEEPER-647. hudson failure in testLeaderShutdown (flavio via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt

hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=901510r1=901509r2=901510view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Thu Jan 21 03:08:47 2010
@@ -202,6 +202,8 @@
   ZOOKEEPER-608. Receipt of ACK from observer should not be logged as ERROR
   (henry via mahadev)
 
+  ZOOKEEPER-647. hudson failure in testLeaderShutdown (flavio 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/server/quorum/QuorumCnxManager.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java?rev=901510r1=901509r2=901510view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
 Thu Jan 21 03:08:47 2010
@@ -560,33 +560,32 @@
 this.finish();
 }
 
-while (running  !shutdown  channel != null) {
+try {
+while (running  !shutdown  channel != null) {
 
-ByteBuffer b = null;
-try {
-ArrayBlockingQueueByteBuffer bq = queueSendMap.get(sid); 
   
-if(bq != null) 
-b = bq.poll(1000, TimeUnit.MILLISECONDS);
-else {
-LOG.error(No queue of incoming messages for server  
+ sid);
-this.finish();
-}
-} catch (InterruptedException e) {
-LOG.warn(Interrupted while waiting for message on queue,
-e);
-continue;
-}
-
-try {
-if(b != null){
-lastMessageSent.put(sid, b);
-send(b);
+ByteBuffer b = null;
+try {
+ArrayBlockingQueueByteBuffer bq = 
queueSendMap.get(sid);
+if(bq != null) 
+b = bq.poll(1000, TimeUnit.MILLISECONDS);
+else {
+LOG.error(No queue of incoming messages for 
server  + sid);
+break;
+}
+
+if(b != null){
+lastMessageSent.put(sid, b);
+send(b);
+}
+} catch (InterruptedException e) {
+LOG.warn(Interrupted while waiting for message on 
queue,
+e);
 }
-} catch (Exception e) {
-LOG.warn(Exception when using channel:  + sid, e);
-this.finish();
 }
+} catch (Exception e) {
+LOG.warn(Exception when using channel:  + sid, e);
 }
+this.finish();
 LOG.warn(Send worker leaving thread);
 }
 }




svn commit: r901951 - in /hadoop/zookeeper/trunk: CHANGES.txt src/java/main/org/apache/zookeeper/ZooKeeperMain.java

2010-01-21 Thread mahadev
Author: mahadev
Date: Fri Jan 22 00:49:22 2010
New Revision: 901951

URL: http://svn.apache.org/viewvc?rev=901951view=rev
Log:
ZOOKEEPER-626. ensure the c/java cli's print xid/sessionid/etc... in hex (pat 
via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeperMain.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=901951r1=901950r2=901951view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Fri Jan 22 00:49:22 2010
@@ -242,6 +242,8 @@
 
   ZOOKEEPER-648. Fix releaseaudit warning count to zero (phunt via henry)
 
+  ZOOKEEPER-626. ensure the c/java cli's print xid/sessionid/etc... in hex 
(pat via mahadev)
+
 NEW FEATURES:
   ZOOKEEPER-539. generate eclipse project via ant target. (phunt via mahadev)
 

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeperMain.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeperMain.java?rev=901951r1=901950r2=901951view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeperMain.java 
(original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeperMain.java 
Fri Jan 22 00:49:22 2010
@@ -127,15 +127,16 @@
 }
 
 private static void printStat(Stat stat) {
-System.err.println(cZxid =  + stat.getCzxid());
+System.err.println(cZxid = 0x + Long.toHexString(stat.getCzxid()));
 System.err.println(ctime =  + new Date(stat.getCtime()).toString());
-System.err.println(mZxid =  + stat.getMzxid());
+System.err.println(mZxid = 0x + Long.toHexString(stat.getMzxid()));
 System.err.println(mtime =  + new Date(stat.getMtime()).toString());
-System.err.println(pZxid =  + stat.getPzxid());
+System.err.println(pZxid = 0x + Long.toHexString(stat.getPzxid()));
 System.err.println(cversion =  + stat.getCversion());
 System.err.println(dataVersion =  + stat.getVersion());
 System.err.println(aclVersion =  + stat.getAversion());
-System.err.println(ephemeralOwner =  + stat.getEphemeralOwner());
+System.err.println(ephemeralOwner = 0x
+   + Long.toHexString(stat.getEphemeralOwner()));
 System.err.println(dataLength =  + stat.getDataLength());
 System.err.println(numChildren =  + stat.getNumChildren());
 }




svn commit: r902320 - in /hadoop/zookeeper/trunk: CHANGES.txt docs/zookeeperAdmin.html docs/zookeeperAdmin.pdf src/docs/src/documentation/content/xdocs/zookeeperAdmin.xml

2010-01-22 Thread mahadev
Author: mahadev
Date: Sat Jan 23 00:31:09 2010
New Revision: 902320

URL: http://svn.apache.org/viewvc?rev=902320view=rev
Log:
ZOOKEEPER-574. the documentation on snapcount in the admin guide has the wrong 
default (phunt via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/docs/zookeeperAdmin.html
hadoop/zookeeper/trunk/docs/zookeeperAdmin.pdf

hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperAdmin.xml

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=902320r1=902319r2=902320view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Sat Jan 23 00:31:09 2010
@@ -204,6 +204,9 @@
 
   ZOOKEEPER-647. hudson failure in testLeaderShutdown (flavio via mahadev)
 
+  ZOOKEEPER-574. the documentation on snapcount in the admin guide has the
+  wrong default (phunt 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/docs/zookeeperAdmin.html
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/docs/zookeeperAdmin.html?rev=902320r1=902319r2=902320view=diff
==
--- hadoop/zookeeper/trunk/docs/zookeeperAdmin.html (original)
+++ hadoop/zookeeper/trunk/docs/zookeeperAdmin.html Sat Jan 23 00:31:09 2010
@@ -1015,15 +1015,11 @@
 /dt
 dd
 p(Java system property: strongzookeeper.snapCount/strong)/p
-pClients can submit requests faster than ZooKeeper can
-  process them, especially if there are a lot of clients. To
-  prevent ZooKeeper from running out of memory due to queued
-  requests, ZooKeeper will throttle clients so that there is no
-  more than globalOutstandingLimit outstanding requests in the
-  system. The default limit is 1,000.ZooKeeper logs transactions
-  to a transaction log. After snapCount transactions are written
-  to a log file a snapshot is started and a new transaction log
-  file is started. The default snapCount is 10,000./p
+pZooKeeper logs transactions to a transaction
+  log. After snapCount transactions are written to a log
+  file a snapshot is started and a new transaction log
+  file is created. The default snapCount is
+  100,000./p
 /dd
 
   

Modified: hadoop/zookeeper/trunk/docs/zookeeperAdmin.pdf
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/docs/zookeeperAdmin.pdf?rev=902320r1=902319r2=902320view=diff
==
Binary files - no diff available.

Modified: 
hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperAdmin.xml
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperAdmin.xml?rev=902320r1=902319r2=902320view=diff
==
--- 
hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperAdmin.xml
 (original)
+++ 
hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperAdmin.xml
 Sat Jan 23 00:31:09 2010
@@ -649,15 +649,11 @@
   para(Java system property: emphasis
   role=boldzookeeper.snapCount/emphasis)/para
 
-  paraClients can submit requests faster than ZooKeeper can
-  process them, especially if there are a lot of clients. To
-  prevent ZooKeeper from running out of memory due to queued
-  requests, ZooKeeper will throttle clients so that there is no
-  more than globalOutstandingLimit outstanding requests in the
-  system. The default limit is 1,000.ZooKeeper logs transactions
-  to a transaction log. After snapCount transactions are written
-  to a log file a snapshot is started and a new transaction log
-  file is started. The default snapCount is 10,000./para
+  paraZooKeeper logs transactions to a transaction
+  log. After snapCount transactions are written to a log
+  file a snapshot is started and a new transaction log
+  file is created. The default snapCount is
+  100,000./para
 /listitem
   /varlistentry
 




svn commit: r902694 - in /hadoop/zookeeper/trunk: CHANGES.txt src/java/test/org/apache/zookeeper/test/SledgeHammer.java

2010-01-24 Thread mahadev
Author: mahadev
Date: Mon Jan 25 03:35:14 2010
New Revision: 902694

URL: http://svn.apache.org/viewvc?rev=902694view=rev
Log:
ZOOKEEPER-656. SledgeHammer test - thread.run() deprecated (kay kay via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt

hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/SledgeHammer.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=902694r1=902693r2=902694view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Mon Jan 25 03:35:14 2010
@@ -207,6 +207,8 @@
   ZOOKEEPER-574. the documentation on snapcount in the admin guide has the
   wrong default (phunt via mahadev)
 
+  ZOOKEEPER-656. SledgeHammer test - thread.run() deprecated (kay kay 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/test/org/apache/zookeeper/test/SledgeHammer.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/SledgeHammer.java?rev=902694r1=902693r2=902694view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/SledgeHammer.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/SledgeHammer.java
 Mon Jan 25 03:35:14 2010
@@ -102,7 +102,7 @@
 }
 SledgeHammer h = new SledgeHammer(args[0], Integer.parseInt(args[1]),
 Integer.parseInt(args[2]));
-h.run();
+h.start();
 System.exit(0);
 }
 




svn commit: r903032 - in /hadoop/zookeeper/trunk: CHANGES.txt src/c/include/zookeeper.h src/c/src/cli.c src/c/src/load_gen.c src/c/src/mt_adaptor.c src/c/src/zk_hashtable.c src/c/src/zk_log.c src/c/sr

2010-01-25 Thread mahadev
Author: mahadev
Date: Tue Jan 26 01:06:33 2010
New Revision: 903032

URL: http://svn.apache.org/viewvc?rev=903032view=rev
Log:
ZOOKEEPER-612. Make Zookeeper C client can be compiled by gcc of early version 
(qian via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/src/c/include/zookeeper.h
hadoop/zookeeper/trunk/src/c/src/cli.c
hadoop/zookeeper/trunk/src/c/src/load_gen.c
hadoop/zookeeper/trunk/src/c/src/mt_adaptor.c
hadoop/zookeeper/trunk/src/c/src/zk_hashtable.c
hadoop/zookeeper/trunk/src/c/src/zk_log.c
hadoop/zookeeper/trunk/src/c/src/zookeeper.c
hadoop/zookeeper/trunk/src/c/tests/TestZookeeperInit.cc

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=903032r1=903031r2=903032view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Tue Jan 26 01:06:33 2010
@@ -251,6 +251,9 @@
 
   ZOOKEEPER-655. StringBuffer - StringBuilder - conversion of references as 
necessary (Kay Kay via henry)
 
+  ZOOKEEPER-612. Make Zookeeper C client can be compiled by gcc of early
+  version (qian via mahadev)
+
 NEW FEATURES:
   ZOOKEEPER-539. generate eclipse project via ant target. (phunt via mahadev)
 

Modified: hadoop/zookeeper/trunk/src/c/include/zookeeper.h
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/include/zookeeper.h?rev=903032r1=903031r2=903032view=diff
==
--- hadoop/zookeeper/trunk/src/c/include/zookeeper.h (original)
+++ hadoop/zookeeper/trunk/src/c/include/zookeeper.h Tue Jan 26 01:06:33 2010
@@ -22,6 +22,7 @@
 #include stdlib.h
 #include sys/time.h
 #include stdio.h
+#include ctype.h
 
 #include zookeeper_version.h
 #include recordio.h

Modified: hadoop/zookeeper/trunk/src/c/src/cli.c
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/src/cli.c?rev=903032r1=903031r2=903032view=diff
==
--- hadoop/zookeeper/trunk/src/c/src/cli.c (original)
+++ hadoop/zookeeper/trunk/src/c/src/cli.c Tue Jan 26 01:06:33 2010
@@ -415,6 +415,9 @@
 fprintf(stderr, Error %d for %s\n, rc, line);
 }
 } else if (startsWith(line, exists )) {
+#ifdef THREADED
+struct Stat stat;
+#endif
 line += 7;
 if (line[0] != '/') {
 fprintf(stderr, Path must start with /, found: %s\n, line);
@@ -423,7 +426,6 @@
 #ifndef THREADED
 rc = zoo_aexists(zh, line, 1, my_stat_completion, strdup(line));
 #else
-struct Stat stat;
 rc = zoo_exists(zh, line, 1, stat);
 #endif
 if (rc) {
@@ -446,8 +448,8 @@
 if (rc)
 fprintf(stderr, od command failed: %d\n, rc);
 } else if (startsWith(line, addauth )) {
-  line += 8;
   char *ptr;
+  line += 8;
   ptr = strchr(line, ' ');
   if (ptr) {
 *ptr = '\0';

Modified: hadoop/zookeeper/trunk/src/c/src/load_gen.c
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/src/load_gen.c?rev=903032r1=903031r2=903032view=diff
==
--- hadoop/zookeeper/trunk/src/c/src/load_gen.c (original)
+++ hadoop/zookeeper/trunk/src/c/src/load_gen.c Tue Jan 26 01:06:33 2010
@@ -90,9 +90,10 @@
 char nodeName[1024];
 int i;
 for(i=0; icount;i++){
+int rc = 0;
 snprintf(nodeName, sizeof(nodeName),%s/%d,root,i);
 incCounter(1);
-int rc=zoo_acreate(zh, nodeName, first, 5, ZOO_OPEN_ACL_UNSAFE, 0,
+rc=zoo_acreate(zh, nodeName, first, 5, ZOO_OPEN_ACL_UNSAFE, 0,
 create_completion, 0);
 if(i%1000==0){
 LOG_INFO((Created %s,nodeName));
@@ -118,9 +119,10 @@
 int i;
 counter=0;
 for(i=0; icount;i++){
+int rc = 0;
 snprintf(nodeName, sizeof(nodeName),%s/%d,root,i);
 incCounter(1);
-int rc=zoo_aset(zh, nodeName, second, 6,-1,write_completion, 0);
+rc=zoo_aset(zh, nodeName, second, 6,-1,write_completion, 0);
 if(rc!=ZOK) return rc;
 }
 }
@@ -145,9 +147,10 @@
 int i;
 counter=0;
 for(i=0; icount;i++){
+int rc = 0;
 snprintf(nodeName, sizeof(nodeName),%s/%d,root,i);
 incCounter(1);
-int rc=zoo_aget(zh, nodeName,0,read_completion, 0);
+rc=zoo_aget(zh, nodeName,0,read_completion, 0);
 if(rc!=ZOK) return rc;
 }
 }
@@ -161,9 +164,10 @@
 int i;
 counter=0;
 for(i=0; icount;i++){
+int rc = 0;
 snprintf(nodeName, sizeof(nodeName),%s/%d,root,i);
 incCounter(1);
-int rc=zoo_adelete(zh, nodeName,-1,delete_completion, 0);
+rc=zoo_adelete(zh, nodeName,-1,delete_completion, 0);
 if(rc!=ZOK) return rc

svn commit: r911713 - in /hadoop/zookeeper/trunk: CHANGES.txt docs/bookkeeperProgrammer.html docs/bookkeeperProgrammer.pdf src/docs/src/documentation/content/xdocs/bookkeeperProgrammer.xml

2010-02-18 Thread mahadev
Author: mahadev
Date: Fri Feb 19 06:30:15 2010
New Revision: 911713

URL: http://svn.apache.org/viewvc?rev=911713view=rev
Log:
ZOOKEEPER-664.  BookKeeper API documentation (flavio via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/docs/bookkeeperProgrammer.html
hadoop/zookeeper/trunk/docs/bookkeeperProgrammer.pdf

hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/bookkeeperProgrammer.xml

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=911713r1=911712r2=911713view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Fri Feb 19 06:30:15 2010
@@ -281,6 +281,8 @@
 
   ZOOKEEPER-665. Add BookKeeper streaming documentation (flavio via mahadev)
 
+  ZOOKEEPER-664.  BookKeeper API documentation (flavio via mahadev)
+
 NEW FEATURES:
   ZOOKEEPER-539. generate eclipse project via ant target. (phunt via mahadev)
 

Modified: hadoop/zookeeper/trunk/docs/bookkeeperProgrammer.html
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/docs/bookkeeperProgrammer.html?rev=911713r1=911712r2=911713view=diff
==
--- hadoop/zookeeper/trunk/docs/bookkeeperProgrammer.html (original)
+++ hadoop/zookeeper/trunk/docs/bookkeeperProgrammer.html Fri Feb 19 06:30:15 
2010
@@ -307,7 +307,7 @@
 
 /p
 p
-There is one BookKeeper constructor:
+There are three BookKeeper constructors:
 /p
 p
 
@@ -315,12 +315,83 @@
public BookKeeper(String servers) 
throws KeeperException, IOException
 /span
-   
+   
 /p
+p
+where:
+/p
+ul
+   
+li
+   
 p 
-where span class=codefrag computeroutputservers/span is a 
comma-separated list of ZooKeeper servers.
+
+span class=codefrag computeroutputservers/span is a comma-separated list 
of ZooKeeper servers.
+   /p
+   
+/li
+
+/ul
+p
+
+span class=codefrag computeroutput
+   public BookKeeper(ZooKeeper zk) 
+   throws InterruptedException, KeeperException
+/span
+   
+/p
+p
+where:
+/p
+ul
+   
+li
+   
+p 
+
+span class=codefrag computeroutputzk/span is a ZooKeeper object. This 
constructor is useful when
+the application also using ZooKeeper and wants to have a single 
instance of ZooKeeper.  
+   /p
+   
+/li
+
+/ul
+p
+
+span class=codefrag computeroutput
+   public BookKeeper(ZooKeeper zk, ClientSocketChannelFactory 
channelFactory) 
+   throws InterruptedException, KeeperException
+/span
+   
+/p
+p
+where:
 /p
-a name=N10064/aa name=bk_createLedger/a
+ul
+   
+li
+   
+p 
+
+span class=codefrag computeroutputzk/span is a ZooKeeper object. This 
constructor is useful when
+the application also using ZooKeeper and wants to have a single 
instance of ZooKeeper.  
+   /p
+   
+/li
+   
+   
+li
+   
+p 
+
+span class=codefrag computeroutputchannelFactory/span is a netty channel 
object 
+(span class=codefrag 
computeroutputorg.jboss.netty.channel.socket/span).  
+   /p
+   
+/li
+
+/ul
+a name=N100A9/aa name=bk_createLedger/a
 h3 class=h4 Creating a ledger. /h3
 p Before writing entries to BookKeeper, it is necessary to create a ledger. 
 With the current BookKeeper API, it is possible to create a ledger both 
synchronously
@@ -335,7 +406,7 @@
 p
 
 span class=codefrag computeroutput
-public LedgerHandle createLedger(int ensSize, int qSize, QMode mode,  byte 
passwd[])
+public LedgerHandle createLedger(int ensSize, int qSize, DigestType type,  
byte passwd[])
 throws KeeperException, InterruptedException, 
 IOException, BKException
 /span
@@ -370,10 +441,7 @@

 p

-span class=codefrag computeroutputmode/span is the ledger mode 
(QMode.GENERIC, QMode.VERIFIABLE).
-   If span class=codefrag computeroutputmode/span is QMode.GENERIC, 
then span class=codefrag computeroutputensSize/span has to
-   be at least em3t+1/em, and span class=codefrag 
computeroutputqSize/span has to be em2t+1/em.
-   emt/em is the maximum number of tolerated bookie failures.  
+span class=codefrag computeroutputtype/span is the type of digest used 
with entries: either MAC or CRC32.  
/p

 /li
@@ -396,7 +464,7 @@
 /p
 p
 As a convenience, we provide a span class=codefrag 
computeroutputcreateLedger/span with default parameters (3,2,VERIFIABLE), 
-and the only input parameter it requires is a password.
+and the only two input parameters it requires are a digest type and a 
password.
 /p
 p

@@ -408,13 +476,11 @@
 span class=codefrag computeroutput
 public void asyncCreateLedger(int ensSize, 
 int qSize, 
-QMode mode

svn commit: r915956 - in /hadoop/zookeeper/trunk: CHANGES.txt docs/zookeeperAdmin.html docs/zookeeperAdmin.pdf src/docs/src/documentation/content/xdocs/zookeeperAdmin.xml

2010-02-24 Thread mahadev
Author: mahadev
Date: Wed Feb 24 20:04:06 2010
New Revision: 915956

URL: http://svn.apache.org/viewvc?rev=915956view=rev
Log:
ZOOKEEPER-485. Need ops documentation that details supervision of ZK server 
processes. (phunt via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/docs/zookeeperAdmin.html
hadoop/zookeeper/trunk/docs/zookeeperAdmin.pdf

hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperAdmin.xml

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=915956r1=915955r2=915956view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Wed Feb 24 20:04:06 2010
@@ -293,6 +293,9 @@
 
   ZOOKEEPER-607. improve bookkeeper overview (flavio via mahadev)
 
+  ZOOKEEPER-485. Need ops documentation that details supervision of ZK server
+  processes. (phunt via mahadev)
+
 NEW FEATURES:
   ZOOKEEPER-539. generate eclipse project via ant target. (phunt via mahadev)
 

Modified: hadoop/zookeeper/trunk/docs/zookeeperAdmin.html
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/docs/zookeeperAdmin.html?rev=915956r1=915955r2=915956view=diff
==
--- hadoop/zookeeper/trunk/docs/zookeeperAdmin.html (original)
+++ hadoop/zookeeper/trunk/docs/zookeeperAdmin.html Wed Feb 24 20:04:06 2010
@@ -263,6 +263,9 @@
 /ul
 /li
 li
+a href=#sc_supervisionSupervision/a
+/li
+li
 a href=#sc_monitoringMonitoring/a
 /li
 li
@@ -673,6 +676,15 @@
 li
   
 p
+a href=#sc_supervisionSupervision/a
+/p
+
+/li
+
+
+li
+  
+p
 a href=#sc_monitoringMonitoring/a
 /p
 
@@ -742,7 +754,7 @@
 /li
   
 /ul
-a name=N101AE/aa name=sc_designing/a
+a name=N101B6/aa name=sc_designing/a
 h3 class=h4Designing a ZooKeeper Deployment/h3
 pThe reliablity of ZooKeeper rests on two basic assumptions./p
 ol
@@ -769,7 +781,7 @@
   to hold true. Some of these are cross-machines considerations,
   and others are things you should consider for each and every
   machine in your deployment./p
-a name=N101CA/aa name=sc_CrossMachineRequirements/a
+a name=N101D2/aa name=sc_CrossMachineRequirements/a
 h4Cross Machine Requirements/h4
 pFor the ZooKeeper service to be active, there must be a
 majority of non-failing machines that can communicate with
@@ -787,7 +799,7 @@
 failure of that switch could cause a correlated failure and
 bring down the service. The same holds true of shared power
 circuits, cooling systems, etc./p
-a name=N101D7/aa name=Single+Machine+Requirements/a
+a name=N101DF/aa name=Single+Machine+Requirements/a
 h4Single Machine Requirements/h4
 pIf ZooKeeper has to contend with other applications for
 access to resourses like storage media, CPU, network, or
@@ -828,20 +840,20 @@
 /li
   
 /ul
-a name=N101F5/aa name=sc_provisioning/a
+a name=N101FD/aa name=sc_provisioning/a
 h3 class=h4Provisioning/h3
 p/p
-a name=N101FE/aa name=sc_strengthsAndLimitations/a
+a name=N10206/aa name=sc_strengthsAndLimitations/a
 h3 class=h4Things to Consider: ZooKeeper Strengths and Limitations/h3
 p/p
-a name=N10207/aa name=sc_administering/a
+a name=N1020F/aa name=sc_administering/a
 h3 class=h4Administering/h3
 p/p
-a name=N10210/aa name=sc_maintenance/a
+a name=N10218/aa name=sc_maintenance/a
 h3 class=h4Maintenance/h3
 pLittle long term maintenance is required for a ZooKeeper
 cluster however you must be aware of the following:/p
-a name=N10219/aa name=Ongoing+Data+Directory+Cleanup/a
+a name=N10221/aa name=Ongoing+Data+Directory+Cleanup/a
 h4Ongoing Data Directory Cleanup/h4
 pThe ZooKeeper a href=#var_datadirData
   Directory/a contains files which are a persistent copy
@@ -871,7 +883,7 @@
 can be run as a cron job on the ZooKeeper server machines to
 clean up the logs daily./p
 pre class=code java -cp zookeeper.jar:log4j.jar:conf 
org.apache.zookeeper.server.PurgeTxnLog lt;dataDirgt; lt;snapDirgt; -n 
lt;countgt;/pre
-a name=N1023A/aa name=Debug+Log+Cleanup+%28log4j%29/a
+a name=N10242/aa name=Debug+Log+Cleanup+%28log4j%29/a
 h4Debug Log Cleanup (log4j)/h4
 pSee the section on a href=#sc_logginglogging/a in this document. It is
 expected that you will setup a rolling file appender using the
@@ -879,10 +891,31 @@
 release tar's conf/log4j.properties provides an example of
 this.
 /p
-a name=N10249/aa name=sc_monitoring/a
+a name=N10251/aa name=sc_supervision/a
+h3 class=h4Supervision/h3
+pYou will want to have a supervisory process that manages
+  each of your ZooKeeper server processes (JVM). The ZK server is
+  designed to be fail fast meaning that it will shutdown
+  (process exit) if an error occurs that it cannot recover
+  from. As a ZooKeeper serving cluster

svn commit: r918752 - in /hadoop/zookeeper/trunk: CHANGES.txt docs/zookeeperAdmin.html docs/zookeeperAdmin.pdf src/docs/src/documentation/content/xdocs/zookeeperAdmin.xml

2010-03-03 Thread mahadev
Author: mahadev
Date: Wed Mar  3 22:57:14 2010
New Revision: 918752

URL: http://svn.apache.org/viewvc?rev=918752view=rev
Log:
ZOOKEEPER-658. update forrest docs - AuthFLE no longer supported (flavio via 
mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/docs/zookeeperAdmin.html
hadoop/zookeeper/trunk/docs/zookeeperAdmin.pdf

hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperAdmin.xml

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=918752r1=918751r2=918752view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Wed Mar  3 22:57:14 2010
@@ -296,6 +296,9 @@
   ZOOKEEPER-485. Need ops documentation that details supervision of ZK server
   processes. (phunt via mahadev)
 
+  ZOOKEEPER-658. update forrest docs - AuthFLE no longer supported (flavio via
+  mahadev)
+
 NEW FEATURES:
   ZOOKEEPER-539. generate eclipse project via ant target. (phunt via mahadev)
 

Modified: hadoop/zookeeper/trunk/docs/zookeeperAdmin.html
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/docs/zookeeperAdmin.html?rev=918752r1=918751r2=918752view=diff
==
--- hadoop/zookeeper/trunk/docs/zookeeperAdmin.html (original)
+++ hadoop/zookeeper/trunk/docs/zookeeperAdmin.html Wed Mar  3 22:57:14 2010
@@ -1099,8 +1099,22 @@
   non-authenticated UDP-based version of fast leader election, 2
   corresponds to the authenticated UDP-based version of fast
   leader election, and 3 corresponds to TCP-based version of
-  fast leader election. Currently, only 0 and 3 are supported, 3 
-  being the default/p
+  fast leader election. Currently, algorithm 3 is the default/p
+div class=note
+div class=labelNote/div
+div class=content
+  
+p The implementations of leader election
+  1 and 2 are currently not supported, and we have the intention
+  of deprecating them in the near future. Implementations 0 and 3 
are 
+  currently supported, and we plan to keep supporting them in the 
near future. 
+  To avoid having to support multiple versions of leader election 
unecessarily, 
+  we may eventually consider deprecating algorithm 0 as well, but 
we will plan
+  according to the needs of the community. 
+  /p
+  
+/div
+/div
 /dd
 
   
@@ -1207,7 +1221,7 @@
 
 /dl
 p/p
-a name=N103B5/aa name=sc_authOptions/a
+a name=N103BA/aa name=sc_authOptions/a
 h4Authentication amp; Authorization Options/h4
 pThe options in this section allow control over
 authentication/authorization performed by the service./p
@@ -1241,7 +1255,7 @@
 /dd
 
 /dl
-a name=N103D8/aa name=Unsafe+Options/a
+a name=N103DD/aa name=Unsafe+Options/a
 h4Unsafe Options/h4
 pThe following options can be useful, but be careful when you use
 them. The risk of each is explained along with the explanation of what
@@ -1286,7 +1300,7 @@
 /dd
 
 /dl
-a name=N1040A/aa name=sc_zkCommands/a
+a name=N1040F/aa name=sc_zkCommands/a
 h3 class=h4ZooKeeper Commands: The Four Letter Words/h3
 pZooKeeper responds to a small set of commands. Each command is
   composed of four letters. You issue the commands to ZooKeeper via telnet
@@ -1407,7 +1421,7 @@
 pre class=code$ echo ruok | nc 127.0.0.1 5111
 imok
 /pre
-a name=N10472/aa name=sc_dataFileManagement/a
+a name=N10477/aa name=sc_dataFileManagement/a
 h3 class=h4Data File Management/h3
 pZooKeeper stores its data in a data directory and its transaction
   log in a transaction log directory. By default these two directories are
@@ -1415,7 +1429,7 @@
   transaction log files in a separate directory than the data files.
   Throughput increases and latency decreases when transaction logs reside
   on a dedicated log devices./p
-a name=N1047B/aa name=The+Data+Directory/a
+a name=N10480/aa name=The+Data+Directory/a
 h4The Data Directory/h4
 pThis directory has two files in it:/p
 ul
@@ -1461,14 +1475,14 @@
 idempotent nature of its updates. By replaying the transaction log
 against fuzzy snapshots ZooKeeper gets the state of the system at the
 end of the log./p
-a name=N104B7/aa name=The+Log+Directory/a
+a name=N104BC/aa name=The+Log+Directory/a
 h4The Log Directory/h4
 pThe Log Directory contains the ZooKeeper transaction logs.
 Before any update takes place, ZooKeeper ensures that the transaction
 that represents the update is written to non-volatile storage. A new
 log file is started each time a snapshot is begun. The log file's
 suffix is the first zxid written to that log./p
-a name=N104C1/aa name=sc_filemanagement/a
+a name

svn commit: r919149 - in /hadoop/zookeeper/trunk: CHANGES.txt build.xml src/contrib/build-contrib.xml src/contrib/build.xml src/recipes/build-recipes.xml

2010-03-04 Thread mahadev
Author: mahadev
Date: Thu Mar  4 20:10:19 2010
New Revision: 919149

URL: http://svn.apache.org/viewvc?rev=919149view=rev
Log:
ZOOKEEPER-640. make build.xml more configurable to ease packaging for linux 
distros (phunt via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/build.xml
hadoop/zookeeper/trunk/src/contrib/build-contrib.xml
hadoop/zookeeper/trunk/src/contrib/build.xml
hadoop/zookeeper/trunk/src/recipes/build-recipes.xml

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=919149r1=919148r2=919149view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Thu Mar  4 20:10:19 2010
@@ -305,6 +305,9 @@
   ZOOKEEPER-658. update forrest docs - AuthFLE no longer supported (flavio via
   mahadev)
 
+  ZOOKEEPER-640. make build.xml more configurable to ease packaging for linux
+  distros (phunt via mahadev)
+
 NEW FEATURES:
   ZOOKEEPER-539. generate eclipse project via ant target. (phunt via mahadev)
 

Modified: hadoop/zookeeper/trunk/build.xml
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/build.xml?rev=919149r1=919148r2=919149view=diff
==
--- hadoop/zookeeper/trunk/build.xml (original)
+++ hadoop/zookeeper/trunk/build.xml Thu Mar  4 20:10:19 2010
@@ -35,7 +35,18 @@
 
 property name=src.dir value=${basedir}/src /
 property name=java.src.dir value=${src.dir}/java/main /
+
 property name=lib.dir value=${src.dir}/java/lib /
+property name=lib.dir.includes value=**/*.jar /
+property name=lib.dir.excludes value=**/excluded/ /
+
+!-- prior to ant 1.7.1 fileset always fails if dir doesn't exist
+ so just point to bin directory and provide settings that exclude
+ everything - user can change as appropriate --
+property name=additional.lib.dir value=bin /
+property name=additional.lib.dir.includes value=**/*.jar /
+property name=additional.lib.dir.excludes value=**/*.jar /
+
 property name=build.dir value=${basedir}/build /
 property name=distribution value=${basedir}/distribution /
 property name=src_generated.dir value=${src.dir}/java/generated /
@@ -156,9 +167,14 @@
 !-- the normal classpath --
 path id=java.classpath
   pathelement location=${build.classes}/
+  !-- allow the user to override (e.g. if there are local versions) --
+  fileset dir=${additional.lib.dir}
+include name=${additional.lib.dir.includes} /
+exclude name=${additional.lib.dir.excludes} /
+  /fileset
   fileset dir=${lib.dir}
-include name=**/*.jar /
-exclude name=**/excluded/ /
+include name=${lib.dir.includes} /
+exclude name=${lib.dir.excludes} /
   /fileset
   fileset dir=${ant.home}/lib
 include name=ant.jar /

Modified: hadoop/zookeeper/trunk/src/contrib/build-contrib.xml
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/contrib/build-contrib.xml?rev=919149r1=919148r2=919149view=diff
==
--- hadoop/zookeeper/trunk/src/contrib/build-contrib.xml (original)
+++ hadoop/zookeeper/trunk/src/contrib/build-contrib.xml Thu Mar  4 20:10:19 
2010
@@ -53,10 +53,28 @@
   target name=check-contrib/
   target name=init-contrib/
 
-  fileset id=lib.jars dir=${root} includes=lib/*.jar/
+  property name=lib.jars.includes value=lib/*.jar /
+  property name=lib.jars.excludes value= /
+
+  !-- prior to ant 1.7.1 fileset always fails if dir doesn't exist
+   so just point to bin directory and provide settings that exclude
+   everything - user can change as appropriate --
+  property name=additional.lib.dir value=${zk.root}/bin /
+  property name=additional.lib.dir.includes value=**/*.jar /
+  property name=additional.lib.dir.excludes value=**/*.jar /
+
+  fileset id=lib.jars dir=${root}
+include name=${lib.jars.includes} /
+exclude name=${lib.jars.excludes} /
+  /fileset
 
   path id=classpath
 pathelement location=${build.classes}/
+!-- allow the user to override (e.g. if there are local versions) --
+fileset dir=${additional.lib.dir}
+  include name=${additional.lib.dir.includes} /
+  exclude name=${additional.lib.dir.excludes} /
+/fileset
 fileset refid=lib.jars/
 pathelement location=${zk.root}/build/classes/
 fileset dir=${ivy.lib}

Modified: hadoop/zookeeper/trunk/src/contrib/build.xml
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/contrib/build.xml?rev=919149r1=919148r2=919149view=diff
==
--- hadoop/zookeeper/trunk/src/contrib/build.xml (original)
+++ hadoop/zookeeper/trunk/src/contrib/build.xml Thu Mar  4 20:10:19 2010
@@ -18,7 +18,15 @@
 --
 
 project

svn commit: r919226 - in /hadoop/zookeeper/trunk: ./ src/java/test/org/apache/zookeeper/server/ src/java/test/org/apache/zookeeper/server/quorum/ src/java/test/org/apache/zookeeper/test/

2010-03-04 Thread mahadev
Author: mahadev
Date: Thu Mar  4 22:55:36 2010
New Revision: 919226

URL: http://svn.apache.org/viewvc?rev=919226view=rev
Log:
ZOOKEEPER-687. LENonterminatetest fails on some machines. (mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt

hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/ZooKeeperServerMainTest.java

hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerMainTest.java

hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/LENonTerminateTest.java

hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ObserverTest.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=919226r1=919225r2=919226view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Thu Mar  4 22:55:36 2010
@@ -240,6 +240,8 @@
   ZOOKEEPER-682. Event is not processed when the watcher is set to watch /
   if chrooted (Scott Wang via mahadev)
 
+  ZOOKEEPER-687. LENonterminatetest fails on some machines. (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/test/org/apache/zookeeper/server/ZooKeeperServerMainTest.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/ZooKeeperServerMainTest.java?rev=919226r1=919225r2=919226view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/ZooKeeperServerMainTest.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/ZooKeeperServerMainTest.java
 Thu Mar  4 22:55:36 2010
@@ -106,11 +106,11 @@
 main.start();
 
 assertTrue(waiting for server being up,
-ClientBase.waitForServerUp(localhost: + CLIENT_PORT,
+ClientBase.waitForServerUp(127.0.0.1: + CLIENT_PORT,
 CONNECTION_TIMEOUT));
 
 
-ZooKeeper zk = new ZooKeeper(localhost: + CLIENT_PORT,
+ZooKeeper zk = new ZooKeeper(127.0.0.1: + CLIENT_PORT,
 ClientBase.CONNECTION_TIMEOUT, this);
 
 zk.create(/foo, foobar.getBytes(), Ids.OPEN_ACL_UNSAFE,
@@ -121,7 +121,7 @@
 main.shutdown();
 
 assertTrue(waiting for server down,
-ClientBase.waitForServerDown(localhost: + CLIENT_PORT,
+ClientBase.waitForServerDown(127.0.0.1: + CLIENT_PORT,
 ClientBase.CONNECTION_TIMEOUT));
 }
 

Modified: 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerMainTest.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerMainTest.java?rev=919226r1=919225r2=919226view=diff
==
--- 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerMainTest.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerMainTest.java
 Thu Mar  4 22:55:36 2010
@@ -75,9 +75,9 @@
 final int CLIENT_PORT_QP2 = PortAssignment.unique();
 
 String quorumCfgSection =
-server.1=localhost: + PortAssignment.unique()
+server.1=127.0.0.1: + PortAssignment.unique()
 + : + PortAssignment.unique()
-+ \nserver.2=localhost: + PortAssignment.unique()
++ \nserver.2=127.0.0.1: + PortAssignment.unique()
 + : + PortAssignment.unique();
 
 MainThread q1 = new MainThread(1, CLIENT_PORT_QP1, quorumCfgSection);
@@ -86,14 +86,14 @@
 q2.start();
 
 assertTrue(waiting for server 1 being up,
-ClientBase.waitForServerUp(localhost: + CLIENT_PORT_QP1,
+ClientBase.waitForServerUp(127.0.0.1: + CLIENT_PORT_QP1,
 CONNECTION_TIMEOUT));
 assertTrue(waiting for server 2 being up,
-ClientBase.waitForServerUp(localhost: + CLIENT_PORT_QP2,
+ClientBase.waitForServerUp(127.0.0.1: + CLIENT_PORT_QP2,
 CONNECTION_TIMEOUT));
 
 
-ZooKeeper zk = new ZooKeeper(localhost: + CLIENT_PORT_QP1,
+ZooKeeper zk = new ZooKeeper(127.0.0.1: + CLIENT_PORT_QP1,
 ClientBase.CONNECTION_TIMEOUT, this);
 
 zk.create(/foo_q1, foobar1.getBytes(), Ids.OPEN_ACL_UNSAFE,
@@ -101,7 +101,7 @@
 assertEquals(new String(zk.getData(/foo_q1, null, null)), foobar1);
 zk.close();
 
-zk = new ZooKeeper(localhost: + CLIENT_PORT_QP2,
+zk = new ZooKeeper(127.0.0.1: + CLIENT_PORT_QP2,
 ClientBase.CONNECTION_TIMEOUT

svn commit: r919270 - in /hadoop/zookeeper/trunk: CHANGES.txt docs/zookeeperAdmin.html docs/zookeeperAdmin.pdf src/docs/src/documentation/content/xdocs/zookeeperAdmin.xml

2010-03-04 Thread mahadev
Author: mahadev
Date: Fri Mar  5 02:27:20 2010
New Revision: 919270

URL: http://svn.apache.org/viewvc?rev=919270view=rev
Log:
ZOOKEEPER-681. Minor doc issue re unset maxClientCnxns (phunt via mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/docs/zookeeperAdmin.html
hadoop/zookeeper/trunk/docs/zookeeperAdmin.pdf

hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperAdmin.xml

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=919270r1=919269r2=919270view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Fri Mar  5 02:27:20 2010
@@ -242,6 +242,8 @@
 
   ZOOKEEPER-687. LENonterminatetest fails on some machines. (mahadev)
 
+  ZOOKEEPER-681. Minor doc issue re unset maxClientCnxns (phunt 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/docs/zookeeperAdmin.html
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/docs/zookeeperAdmin.html?rev=919270r1=919269r2=919270view=diff
==
--- hadoop/zookeeper/trunk/docs/zookeeperAdmin.html (original)
+++ hadoop/zookeeper/trunk/docs/zookeeperAdmin.html Fri Mar  5 02:27:20 2010
@@ -1078,8 +1078,8 @@
   level) that a single client, identified by IP address, may make
   to a single member of the ZooKeeper ensemble. This is used to 
   prevent certain classes of DoS attacks, including file 
-  descriptor exhaustion. Setting this to 0 or omitting it entirely 
-  removes the limit on concurrent connections./p
+  descriptor exhaustion. The default is 10. Setting this to 0 
+  entirely removes the limit on concurrent connections./p
 /dd
 
 /dl

Modified: hadoop/zookeeper/trunk/docs/zookeeperAdmin.pdf
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/docs/zookeeperAdmin.pdf?rev=919270r1=919269r2=919270view=diff
==
Binary files - no diff available.

Modified: 
hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperAdmin.xml
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperAdmin.xml?rev=919270r1=919269r2=919270view=diff
==
--- 
hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperAdmin.xml
 (original)
+++ 
hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperAdmin.xml
 Fri Mar  5 02:27:20 2010
@@ -714,8 +714,8 @@
   level) that a single client, identified by IP address, may make
   to a single member of the ZooKeeper ensemble. This is used to 
   prevent certain classes of DoS attacks, including file 
-  descriptor exhaustion. Setting this to 0 or omitting it entirely 
-  removes the limit on concurrent connections./para
+  descriptor exhaustion. The default is 10. Setting this to 0 
+  entirely removes the limit on concurrent connections./para
 /listitem
/varlistentry
 /variablelist




svn commit: r919280 - in /hadoop/zookeeper/trunk: CHANGES.txt src/contrib/zkpython/README src/contrib/zkpython/src/c/zookeeper.c src/contrib/zkpython/src/test/acl_test.py

2010-03-04 Thread mahadev
Author: mahadev
Date: Fri Mar  5 03:47:38 2010
New Revision: 919280

URL: http://svn.apache.org/viewvc?rev=919280view=rev
Log:
ZOOKEEPER-579. zkpython needs more test coverage for ACL code paths (henry via 
mahadev)

Added:
hadoop/zookeeper/trunk/src/contrib/zkpython/src/test/acl_test.py
Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/src/contrib/zkpython/README
hadoop/zookeeper/trunk/src/contrib/zkpython/src/c/zookeeper.c

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=919280r1=919279r2=919280view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Fri Mar  5 03:47:38 2010
@@ -312,6 +312,9 @@
   ZOOKEEPER-640. make build.xml more configurable to ease packaging for linux
   distros (phunt via mahadev)
 
+  ZOOKEEPER-579. zkpython needs more test coverage for ACL code paths (henry
+  via mahadev)
+
 NEW FEATURES:
   ZOOKEEPER-539. generate eclipse project via ant target. (phunt via mahadev)
 

Modified: hadoop/zookeeper/trunk/src/contrib/zkpython/README
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/contrib/zkpython/README?rev=919280r1=919279r2=919280view=diff
==
--- hadoop/zookeeper/trunk/src/contrib/zkpython/README (original)
+++ hadoop/zookeeper/trunk/src/contrib/zkpython/README Fri Mar  5 03:47:38 2010
@@ -9,7 +9,7 @@
 
 You will need the Python development headers installed to build the module - 
on many package-management systems, these can be found in python-devel.
 
-Python = 2.3 is required. We have tested against 2.3, 2.5 and 2.6. We have 
not tested against 3.x. 
+Python = 2.6 is required. We have tested against 2.6. We have not tested 
against 3.x. 
 
 BUILD AND INSTALL:
 ---

Modified: hadoop/zookeeper/trunk/src/contrib/zkpython/src/c/zookeeper.c
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/contrib/zkpython/src/c/zookeeper.c?rev=919280r1=919279r2=919280view=diff
==
--- hadoop/zookeeper/trunk/src/contrib/zkpython/src/c/zookeeper.c (original)
+++ hadoop/zookeeper/trunk/src/contrib/zkpython/src/c/zookeeper.c Fri Mar  5 
03:47:38 2010
@@ -464,6 +464,24 @@
   PyGILState_Release(gstate);
 }
 
+int check_is_acl(PyObject *o) {
+   int i;
+   if (!PyList_Check(o)) {
+   return 0;
+   }
+   for (i=0;iPyList_Size(o);++i) {
+   if (!PyDict_Check(PyList_GetItem(o,i))) {
+   return 0;
+   }
+   }
+   return 1;
+}
+
+#define CHECK_ACLS(o) if (check_is_acl(o) == 0) {\
+   PyErr_SetString(err_to_exception(ZINVALIDACL), zerror(ZINVALIDACL));\
+   return NULL;\
+ }
+
 ///
 // Asynchronous API
 PyObject *pyzoo_acreate(PyObject *self, PyObject *args)
@@ -475,25 +493,23 @@
   if (!PyArg_ParseTuple(args, iss#O|iO, zkhid, path, value, valuelen, 
pyacls, flags, completion_callback))
 return NULL;
   CHECK_ZHANDLE(zkhid);
-
-  if (pyacls != Py_None)
-parse_acls(acl, pyacls);
+  CHECK_ACLS(pyacls);
+  parse_acls(acl, pyacls);
   int err = zoo_acreate( zhandles[zkhid],
-path,
-value,
-valuelen,
-pyacls == Py_None ? NULL : acl,
-flags,
-string_completion_dispatch,
-completion_callback != Py_None ? 
create_pywatcher(zkhid, completion_callback,0 ) : NULL );
-
+ path,
+ value,
+ valuelen,
+ pyacls == Py_None ? NULL : acl,
+ flags,
+ string_completion_dispatch,
+ completion_callback != Py_None ? 
create_pywatcher(zkhid, completion_callback,0 ) : NULL );
   free_acls(acl);
   if (err != ZOK)
 {
   PyErr_SetString(err_to_exception(err), zerror(err));
   return NULL;
 }
-  return Py_BuildValue(i, err);;
+  return Py_BuildValue(i, err);
 }
 
 PyObject *pyzoo_adelete(PyObject *self, PyObject *args)
@@ -676,7 +692,7 @@
pyacl, completion_callback))
 return NULL;
   CHECK_ZHANDLE(zkhid);
-
+  CHECK_ACLS(pyacl);
   parse_acls( aclv, pyacl );
   int err = zoo_aset_acl( zhandles[zkhid],
  path,
@@ -736,6 +752,7 @@
 return NULL;
   CHECK_ZHANDLE(zkhid);
   struct ACL_vector aclv;
+  CHECK_ACLS(acl);
   parse_acls(aclv,acl);
   zhandle_t *zh = zhandles[zkhid];
   int err = zoo_create(zh, path, values, valuelen, aclv, flags, realbuf, 
maxbuf_len);

Added: hadoop/zookeeper/trunk/src/contrib/zkpython/src/test/acl_test.py
URL: 
http://svn.apache.org/viewvc/hadoop

svn commit: r919640 - in /hadoop/zookeeper/trunk: CHANGES.txt docs/zookeeperProgrammers.html docs/zookeeperProgrammers.pdf src/docs/src/documentation/content/xdocs/zookeeperProgrammers.xml

2010-03-05 Thread mahadev
Author: mahadev
Date: Fri Mar  5 22:03:04 2010
New Revision: 919640

URL: http://svn.apache.org/viewvc?rev=919640view=rev
Log:
ZOOKEEPER-688. explain session expiration better in the docs  faq (phunt via 
mahadev)

Modified:
hadoop/zookeeper/trunk/CHANGES.txt
hadoop/zookeeper/trunk/docs/zookeeperProgrammers.html
hadoop/zookeeper/trunk/docs/zookeeperProgrammers.pdf

hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/zookeeperProgrammers.xml

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=919640r1=919639r2=919640view=diff
==
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Fri Mar  5 22:03:04 2010
@@ -315,6 +315,9 @@
   ZOOKEEPER-579. zkpython needs more test coverage for ACL code paths (henry
   via mahadev)
 
+  ZOOKEEPER-688. explain session expiration better in the docs  faq (phunt
+  via mahadev)
+
 NEW FEATURES:
   ZOOKEEPER-539. generate eclipse project via ant target. (phunt via mahadev)
 

Modified: hadoop/zookeeper/trunk/docs/zookeeperProgrammers.html
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/docs/zookeeperProgrammers.html?rev=919640r1=919639r2=919640view=diff
==
--- hadoop/zookeeper/trunk/docs/zookeeperProgrammers.html (original)
+++ hadoop/zookeeper/trunk/docs/zookeeperProgrammers.html Fri Mar  5 22:03:04 
2010
@@ -829,6 +829,74 @@
 the tickTime (as set in the server configuration) and a maximum of
 20 times the tickTime. The ZooKeeper client API allows access to
 the negotiated timeout./p
+pWhen a client (session) becomes partitioned from the ZK
+serving cluster it will begin searching the list of servers that
+were specified during session creation. Eventually, when
+connectivity between the client and at least one of the servers is
+re-established, the session will either again transition to the
+connected state (if reconnected within the session timeout
+value) or it will transition to the expired state (if
+reconnected after the session timeout). It is not advisable to
+create a new session object (a new ZooKeeper.class or zookeeper
+handle in the c binding) for disconnection. The ZK client library
+will handle reconnect for you. In particular we have heuristics
+built into the client library to handle things like herd effect,
+etc... Only create a new session when you are notified of session
+expiration (mandatory)./p
+pSession expiration is managed by the ZooKeeper cluster
+itself, not by the client. When the ZK client establishes a
+session with the cluster it provides a timeout value detailed
+above. This value is used by the cluster to determine when the
+client's session expires. Expirations happens when the cluster
+does not hear from the client within the specified session timeout
+period (i.e. no heartbeat). At session expiration the cluster will
+delete any/all ephemeral nodes owned by that session and
+immediately notify any/all connected clients of the change (anyone
+watching those znodes). At this point the client of the expired
+session is still disconnected from the cluster, it will not be
+notified of the session expiration until/unless it is able to
+re-establish a connection to the cluster. The client will stay in
+disconnected state until the TCP connection is re-established with
+the cluster, at which point the watcher of the expired session
+will receive the session expired notification./p
+pExample state transitions for an expired session as seen by
+the expired session's watcher:/p
+ol
+  
+li
+p'connected' : session is established and client
+  is communicating with cluster (client/server communication is
+  operating properly)/p
+/li
+  
+li
+p client is partitioned from the
+  cluster/p
+/li
+  
+li
+p'disconnected' : client has lost connectivity
+  with the cluster/p
+/li
+  
+li
+p time elapses, after 'timeout' period the
+  cluster expires the session, nothing is seen by client as it is
+  disconnected from cluster/p
+/li
+  
+li
+p time elapses, the client regains network
+  level connectivity with the cluster/p
+/li
+  
+li
+p'expired' : eventually the client reconnects to
+  the cluster, it is then notified of the
+  expiration/p
+/li
+
+/ol
 pAnother parameter to the ZooKeeper session establishment
 call is the default watcher. Watchers are notified when any state
 change occurs in the client. For example if the client loses
@@ -884,7 +952,7 @@
 /div
 
   
-a name=N101DF/aa name=ch_zkWatches/a
+a name=N10203/aa name=ch_zkWatches/a
 h2 class=h3ZooKeeper Watches/h2
 div class=section
 pAll of the read operations in ZooKeeper - stronggetData

  1   2   >