From commits-returnroger49@example.com Tue May 3 00:09:50 2011 Return-Path: <commits-returnroger49@example.com> X-Original-To: roger49@example.com Delivered-To: roger49@example.com Received: from mail.apache.org (hermes.apache.org [83.161.120.155]) by minotaur.apache.org (Postfix) with SMTP id 84F9836B9 for <roger49@example.com>; Tue, 3 May 2011 00:09:50 +0000 (UTC) Received: (qmail 26821 invoked by uid 500); 3 May 2011 00:09:50 -0000 Delivered-To: roger49@example.com Received: (qmail 26782 invoked by uid 500); 3 May 2011 00:09:50 -0000 Mailing-List: contact roger49@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:roger49@example.com> List-Unsubscribe: <mailto:roger49@example.com> List-Post: <mailto:roger49@example.com> List-Id: <commits.zookeeper.apache.org> Reply-To: dev@<zookeeper.apache.org> Delivered-To: mailing list roger49@example.com Received: (qmail 26772 invoked by uid 99); 3 May 2011 00:09:50 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 May 2011 00:09:50 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 May 2011 00:09:49 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id CFB0A2388906; Tue, 3 May 2011 00:09:28 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1098866 - /zookeeper/site/trunk/content/index.textile Date: Tue, 03 May 2011 00:09:28 -0000 To: roger49@example.com From: roger49@example.com X-Mailer: svnmailer-1.0.8 Message-Id: <roger49@example.com> Author: phunt Date: Tue May 3 00:09:28 2011 New Revision: 1098866 URL: http://svn.apache.org/viewvc?rev=1098866&view=rev Log: fixed bad text - zk is no longer a subproject of hadoop Modified: zookeeper/site/trunk/content/index.textile Modified: zookeeper/site/trunk/content/index.textile URL: http://svn.apache.org/viewvc/zookeeper/site/trunk/content/index.textile?rev=1098866&r1=1098865&r2=1098866&view=diff ============================================================================== --- zookeeper/site/trunk/content/index.textile (original) +++ zookeeper/site/trunk/content/index.textile Tue May 3 00:09:28 2011 @@ -35,7 +35,7 @@ Start by installing ZooKeeper on a singl h2. Getting Involved -Apache ZooKeeper is an open source volunteer project under the Apache Software Foundation. It is a subproject of Hadoop. We encourage you to learn about the project and contribute your expertise. Here are some starter links: +Apache ZooKeeper is an open source volunteer project under the Apache Software Foundation. We encourage you to learn about the project and contribute your expertise. Here are some starter links: # See our "How to Contribute to ZooKeeper":https://cwiki.apache.org/confluence/display/ZOOKEEPER/HowToContribute page. # Give us "feedback":https://issues.apache.org/jira/browse/ZOOKEEPER: What can we do better? From commits-returnroger49@example.com Tue May 3 00:10:02 2011 Return-Path: <commits-returnroger49@example.com> X-Original-To: roger49@example.com Delivered-To: roger49@example.com Received: from mail.apache.org (hermes.apache.org [83.161.120.155]) by minotaur.apache.org (Postfix) with SMTP id 23C6236C0 for <roger49@example.com>; Tue, 3 May 2011 00:10:02 +0000 (UTC) Received: (qmail 26902 invoked by uid 500); 3 May 2011 00:10:02 -0000 Delivered-To: roger49@example.com Received: (qmail 26880 invoked by uid 500); 3 May 2011 00:10:02 -0000 Mailing-List: contact roger49@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:roger49@example.com> List-Unsubscribe: <mailto:roger49@example.com> List-Post: <mailto:roger49@example.com> List-Id: <commits.zookeeper.apache.org> Reply-To: dev@<zookeeper.apache.org> Delivered-To: mailing list roger49@example.com Received: (qmail 26872 invoked by uid 99); 3 May 2011 00:10:02 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 May 2011 00:10:02 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 May 2011 00:10:00 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 40C402388A90; Tue, 3 May 2011 00:09:39 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r789090 - /websites/staging/zookeeper/trunk/content/index.html Date: Tue, 03 May 2011 00:09:39 -0000 To: roger49@example.com From: roger49@example.com X-Mailer: svnmailer-1.0.8 Message-Id: <roger49@example.com> X-Virus-Checked: Checked by ClamAV on apache.org Author: buildbot Date: Tue May 3 00:09:38 2011 New Revision: 789090 Log: Staging update by buildbot Modified: websites/staging/zookeeper/trunk/content/index.html Modified: websites/staging/zookeeper/trunk/content/index.html ============================================================================== --- websites/staging/zookeeper/trunk/content/index.html (original) +++ websites/staging/zookeeper/trunk/content/index.html Tue May 3 00:09:38 2011 @@ -74,7 +74,7 @@ <h2>Getting Involved</h2> -<p>Apache ZooKeeper is an open source volunteer project under the Apache Software Foundation. It is a subproject of Hadoop. We encourage you to learn about the project and contribute your expertise. Here are some starter links:</p> +<p>Apache ZooKeeper is an open source volunteer project under the Apache Software Foundation. We encourage you to learn about the project and contribute your expertise. Here are some starter links:</p> <ol> <li>See our <a href="https://cwiki.apache.org/confluence/display/ZOOKEEPER/HowToContribute">How to Contribute to ZooKeeper</a> page.</li> From commits-returnroger49@example.com Tue May 3 00:10:54 2011 Return-Path: <commits-returnroger49@example.com> X-Original-To: roger49@example.com Delivered-To: roger49@example.com Received: from mail.apache.org (hermes.apache.org [83.161.120.155]) by minotaur.apache.org (Postfix) with SMTP id 3BC293729 for <roger49@example.com>; Tue, 3 May 2011 00:10:54 +0000 (UTC) Received: (qmail 30244 invoked by uid 500); 3 May 2011 00:10:54 -0000 Delivered-To: roger49@example.com Received: (qmail 30219 invoked by uid 500); 3 May 2011 00:10:54 -0000 Mailing-List: contact roger49@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:roger49@example.com> List-Unsubscribe: <mailto:roger49@example.com> List-Post: <mailto:roger49@example.com> List-Id: <commits.zookeeper.apache.org> Reply-To: dev@<zookeeper.apache.org> Delivered-To: mailing list roger49@example.com Received: (qmail 30211 invoked by uid 99); 3 May 2011 00:10:54 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 May 2011 00:10:54 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 May 2011 00:10:51 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id CA8F9238897F; Tue, 3 May 2011 00:10:30 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r789092 - in /websites/production/zookeeper: ./ content/index.html Date: Tue, 03 May 2011 00:10:30 -0000 To: roger49@example.com From: roger49@example.com X-Mailer: svnmailer-1.0.8 Message-Id: <roger49@example.com> X-Virus-Checked: Checked by ClamAV on apache.org Author: phunt Date: Tue May 3 00:10:30 2011 New Revision: 789092 Log: Publishing merge to zookeeper site by phunt Modified: websites/production/zookeeper/ (props changed) websites/production/zookeeper/content/index.html Propchange: websites/production/zookeeper/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Tue May 3 00:10:30 2011 @@ -1 +1 @@ -/websites/staging/zookeeper/trunk:779660-788823 +/websites/staging/zookeeper/trunk:779660-789091 Modified: websites/production/zookeeper/content/index.html ============================================================================== --- websites/production/zookeeper/content/index.html (original) +++ websites/production/zookeeper/content/index.html Tue May 3 00:10:30 2011 @@ -74,7 +74,7 @@ <h2>Getting Involved</h2> -<p>Apache ZooKeeper is an open source volunteer project under the Apache Software Foundation. It is a subproject of Hadoop. We encourage you to learn about the project and contribute your expertise. Here are some starter links:</p> +<p>Apache ZooKeeper is an open source volunteer project under the Apache Software Foundation. We encourage you to learn about the project and contribute your expertise. Here are some starter links:</p> <ol> <li>See our <a href="https://cwiki.apache.org/confluence/display/ZOOKEEPER/HowToContribute">How to Contribute to ZooKeeper</a> page.</li> From commits-returnroger49@example.com Tue May 3 17:58:06 2011 Return-Path: <commits-returnroger49@example.com> X-Original-To: roger49@example.com Delivered-To: roger49@example.com Received: from mail.apache.org (hermes.apache.org [83.161.120.155]) by minotaur.apache.org (Postfix) with SMTP id 57E86256E for <roger49@example.com>; Tue, 3 May 2011 17:58:06 +0000 (UTC) Received: (qmail 64301 invoked by uid 500); 3 May 2011 17:58:06 -0000 Delivered-To: roger49@example.com Received: (qmail 64250 invoked by uid 500); 3 May 2011 17:58:05 -0000 Mailing-List: contact roger49@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:roger49@example.com> List-Unsubscribe: <mailto:roger49@example.com> List-Post: <mailto:roger49@example.com> List-Id: <commits.zookeeper.apache.org> Reply-To: dev@<zookeeper.apache.org> Delivered-To: mailing list roger49@example.com Received: (qmail 64242 invoked by uid 99); 3 May 2011 17:58:05 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 May 2011 17:58:05 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 May 2011 17:58:04 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id BB81C23889C5; Tue, 3 May 2011 17:57:44 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1099158 - in /zookeeper/trunk: CHANGES.txt src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java Date: Tue, 03 May 2011 17:57:44 -0000 To: roger49@example.com From: roger49@example.com X-Mailer: svnmailer-1.0.8 Message-Id: <roger49@example.com> Author: michim Date: Tue May 3 17:57:44 2011 New Revision: 1099158 URL: http://svn.apache.org/viewvc?rev=1099158&view=rev Log: ZOOKEEPER-1052. Findbugs warning in QuorumPeer.ResponderThread.run() (fpj via michim) Modified: zookeeper/trunk/CHANGES.txt zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java Modified: zookeeper/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/zookeeper/trunk/CHANGES.txt?rev=1099158&r1=1099157&r2=1099158&view=diff ============================================================================== --- zookeeper/trunk/CHANGES.txt (original) +++ zookeeper/trunk/CHANGES.txt Tue May 3 17:57:44 2011 @@ -278,6 +278,8 @@ IMPROVEMENTS: ZOOKEEPER-874. FileTxnSnapLog.restore does not call listener (diogo via fpj) + ZOOKEEPER-1052. Findbugs warning in QuorumPeer.ResponderThread.run() (fpj via michim) + NEW FEATURES: ZOOKEEPER-729. Java client API to recursively delete a subtree. (Kay Kay via henry) Modified: zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java?rev=1099158&r1=1099157&r2=1099158&view=diff ============================================================================== --- zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java (original) +++ zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java Tue May 3 17:57:44 2011 @@ -313,8 +313,10 @@ public class QuorumPeer extends Thread i } packet.setLength(b.length); } - } catch (Exception e) { - LOG.warn("Unexpected exception in ResponderThread",e); + } catch (RuntimeException e) { + LOG.warn("Unexpected runtime exception in ResponderThread",e); + } catch (IOException e) { + LOG.warn("Unexpected IO exception in ResponderThread",e); } finally { LOG.warn("QuorumPeer responder thread exited"); } From commits-returnroger49@example.com Tue May 3 21:30:19 2011 Return-Path: <commits-returnroger49@example.com> X-Original-To: roger49@example.com Delivered-To: roger49@example.com Received: from mail.apache.org (hermes.apache.org [83.161.120.155]) by minotaur.apache.org (Postfix) with SMTP id 644F02C40 for <roger49@example.com>; Tue, 3 May 2011 21:30:19 +0000 (UTC) Received: (qmail 45077 invoked by uid 500); 3 May 2011 21:30:19 -0000 Delivered-To: roger49@example.com Received: (qmail 45038 invoked by uid 500); 3 May 2011 21:30:19 -0000 Mailing-List: contact roger49@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:roger49@example.com> List-Unsubscribe: <mailto:roger49@example.com> List-Post: <mailto:roger49@example.com> List-Id: <commits.zookeeper.apache.org> Reply-To: dev@<zookeeper.apache.org> Delivered-To: mailing list roger49@example.com Received: (qmail 45030 invoked by uid 99); 3 May 2011 21:30:19 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 May 2011 21:30:19 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 May 2011 21:30:17 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 279C22388901; Tue, 3 May 2011 21:29:56 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1099267 - in /zookeeper/trunk: CHANGES.txt src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java Date: Tue, 03 May 2011 21:29:56 -0000 To: roger49@example.com From: roger49@example.com X-Mailer: svnmailer-1.0.8 Message-Id: <roger49@example.com> X-Virus-Checked: Checked by ClamAV on apache.org Author: mahadev Date: Tue May 3 21:29:55 2011 New Revision: 1099267 URL: http://svn.apache.org/viewvc?rev=1099267&view=rev Log: ZOOKEEPER-1049. Session expire/close flooding renders heartbeats to delay significantly. (chang song via mahadev) Modified: zookeeper/trunk/CHANGES.txt zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java Modified: zookeeper/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/zookeeper/trunk/CHANGES.txt?rev=1099267&r1=1099266&r2=1099267&view=diff ============================================================================== --- zookeeper/trunk/CHANGES.txt (original) +++ zookeeper/trunk/CHANGES.txt Tue May 3 21:29:55 2011 @@ -203,6 +203,9 @@ BUGFIXES: ZOOKEEPER-975. new peer goes in LEADING state even if ensemble is online. (vishal via fpj) + ZOOKEEPER-1049. Session expire/close flooding renders heartbeats to delay significantly. + (chang song via mahadev) + IMPROVEMENTS: ZOOKEEPER-724. Improve junit test integration - log harness information (phunt via mahadev) Modified: zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java?rev=1099267&r1=1099266&r2=1099267&view=diff ============================================================================== --- zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java (original) +++ zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java Tue May 3 21:29:55 2011 @@ -102,7 +102,9 @@ public class NIOServerCnxn extends Serve outstandingLimit = zk.getGlobalOutstandingLimit(); } sock.socket().setTcpNoDelay(true); - sock.socket().setSoLinger(true, 2); + /* set socket linger to false, so that socket close does not + * block */ + sock.socket().setSoLinger(false, -1); InetAddress addr = ((InetSocketAddress) sock.socket() .getRemoteSocketAddress()).getAddress(); authInfo.add(new Id("ip", addr.getHostAddress())); From commits-returnroger49@example.com Wed May 4 06:03:16 2011 Return-Path: <commits-returnroger49@example.com> X-Original-To: roger49@example.com Delivered-To: roger49@example.com Received: from mail.apache.org (hermes.apache.org [83.161.120.155]) by minotaur.apache.org (Postfix) with SMTP id 2E1A2326E for <roger49@example.com>; Wed, 4 May 2011 06:03:16 +0000 (UTC) Received: (qmail 25192 invoked by uid 500); 4 May 2011 06:03:15 -0000 Delivered-To: roger49@example.com Received: (qmail 25146 invoked by uid 500); 4 May 2011 06:03:14 -0000 Mailing-List: contact roger49@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:roger49@example.com> List-Unsubscribe: <mailto:roger49@example.com> List-Post: <mailto:roger49@example.com> List-Id: <commits.zookeeper.apache.org> Reply-To: dev@<zookeeper.apache.org> Delivered-To: mailing list roger49@example.com Received: (qmail 25134 invoked by uid 99); 4 May 2011 06:03:13 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 May 2011 06:03:13 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 May 2011 06:03:10 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 8311623888E4; Wed, 4 May 2011 06:02:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1099329 - in /zookeeper/trunk: CHANGES.txt src/c/configure.ac Date: Wed, 04 May 2011 06:02:49 -0000 To: roger49@example.com From: roger49@example.com X-Mailer: svnmailer-1.0.8 Message-Id: <roger49@example.com> X-Virus-Checked: Checked by ClamAV on apache.org Author: mahadev Date: Wed May 4 06:02:49 2011 New Revision: 1099329 URL: http://svn.apache.org/viewvc?rev=1099329&view=rev Log: ZOOKEEPER-1033. c client should install includes into INCDIR/zookeeper, not INCDIR/c-client-src (Nicholas Harteau via mahadev) Modified: zookeeper/trunk/CHANGES.txt zookeeper/trunk/src/c/configure.ac Modified: zookeeper/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/zookeeper/trunk/CHANGES.txt?rev=1099329&r1=1099328&r2=1099329&view=diff ============================================================================== --- zookeeper/trunk/CHANGES.txt (original) +++ zookeeper/trunk/CHANGES.txt Wed May 4 06:02:49 2011 @@ -205,6 +205,9 @@ BUGFIXES: ZOOKEEPER-1049. Session expire/close flooding renders heartbeats to delay significantly. (chang song via mahadev) + + ZOOKEEPER-1033. c client should install includes into INCDIR/zookeeper, not INCDIR/c-client-src + (Nicholas Harteau via mahadev) IMPROVEMENTS: ZOOKEEPER-724. Improve junit test integration - log harness information Modified: zookeeper/trunk/src/c/configure.ac URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/c/configure.ac?rev=1099329&r1=1099328&r2=1099329&view=diff ============================================================================== --- zookeeper/trunk/src/c/configure.ac (original) +++ zookeeper/trunk/src/c/configure.ac Wed May 4 06:02:49 2011 @@ -3,7 +3,7 @@ AC_PREREQ(2.59) -AC_INIT([zookeeper C client],3.4.0,[roger49@example.com],[c-client-src]) +AC_INIT([zookeeper C client],3.4.0,[roger49@example.com],[zookeeper]) AC_CONFIG_SRCDIR([src/zookeeper.c]) # Save initial CFLAGS and CXXFLAGS values before AC_PROG_CC and AC_PROG_CXX From commits-returnroger49@example.com Mon May 16 17:13:46 2011 Return-Path: <commits-returnroger49@example.com> X-Original-To: roger49@example.com Delivered-To: roger49@example.com Received: from mail.apache.org (hermes.apache.org [83.161.120.155]) by minotaur.apache.org (Postfix) with SMTP id B1DB46CFF for <roger49@example.com>; Mon, 16 May 2011 17:13:46 +0000 (UTC) Received: (qmail 48528 invoked by uid 500); 16 May 2011 17:13:46 -0000 Delivered-To: roger49@example.com Received: (qmail 48496 invoked by uid 500); 16 May 2011 17:13:46 -0000 Mailing-List: contact roger49@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:roger49@example.com> List-Unsubscribe: <mailto:roger49@example.com> List-Post: <mailto:roger49@example.com> List-Id: <commits.zookeeper.apache.org> Reply-To: dev@<zookeeper.apache.org> Delivered-To: mailing list roger49@example.com Received: (qmail 48488 invoked by uid 99); 16 May 2011 17:13:46 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 May 2011 17:13:46 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 May 2011 17:13:45 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id C3A81238890A; Mon, 16 May 2011 17:13:23 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1103798 - in /zookeeper/trunk: CHANGES.txt bin/zkServer.sh conf/zoo_sample.cfg Date: Mon, 16 May 2011 17:13:23 -0000 To: roger49@example.com From: roger49@example.com X-Mailer: svnmailer-1.0.8 Message-Id: <roger49@example.com> Author: mahadev Date: Mon May 16 17:13:23 2011 New Revision: 1103798 URL: http://svn.apache.org/viewvc?rev=1103798&view=rev Log: ZOOKEEPER-1061. Zookeeper stop fails if start called twice. (Ted Dunning via mahadev) Modified: zookeeper/trunk/CHANGES.txt zookeeper/trunk/bin/zkServer.sh zookeeper/trunk/conf/zoo_sample.cfg Modified: zookeeper/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/zookeeper/trunk/CHANGES.txt?rev=1103798&r1=1103797&r2=1103798&view=diff ============================================================================== --- zookeeper/trunk/CHANGES.txt (original) +++ zookeeper/trunk/CHANGES.txt Mon May 16 17:13:23 2011 @@ -209,6 +209,8 @@ BUGFIXES: ZOOKEEPER-1033. c client should install includes into INCDIR/zookeeper, not INCDIR/c-client-src (Nicholas Harteau via mahadev) + ZOOKEEPER-1061. Zookeeper stop fails if start called twice. (Ted Dunning via mahadev) + IMPROVEMENTS: ZOOKEEPER-724. Improve junit test integration - log harness information (phunt via mahadev) Modified: zookeeper/trunk/bin/zkServer.sh URL: http://svn.apache.org/viewvc/zookeeper/trunk/bin/zkServer.sh?rev=1103798&r1=1103797&r2=1103798&view=diff ============================================================================== --- zookeeper/trunk/bin/zkServer.sh (original) +++ zookeeper/trunk/bin/zkServer.sh Mon May 16 17:13:23 2011 @@ -95,11 +95,28 @@ _ZOO_DAEMON_OUT="$ZOO_LOG_DIR/zookeeper. case $1 in start) - echo "Starting zookeeper ... " + echo -n "Starting zookeeper ... " + if [ -f $ZOOPIDFILE ]; then + if kill -0 `cat $ZOOPIDFILE` > /dev/null 2>&1; then + echo $command already running as process `cat $ZOOPIDFILE`. + exit 0 + fi + fi $JAVA "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \ -cp "$CLASSPATH" $JVMFLAGS $ZOOMAIN "$ZOOCFG" > "$_ZOO_DAEMON_OUT" 2>&1 < /dev/null & - /bin/echo -n $! > "$ZOOPIDFILE" - echo STARTED + if [ $? -eq 0 ] + then + if /bin/echo -n $! > "$ZOOPIDFILE" + then + echo STARTED + else + echo FAILED TO WRITE PID + exit 1 + fi + else + echo SERVER DID NOT START + exit 1 + fi ;; start-foreground) $JAVA "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \ @@ -109,15 +126,16 @@ print-cmd) echo "$JAVA -Dzookeeper.log.dir=\"${ZOO_LOG_DIR}\" -Dzookeeper.root.logger=\"${ZOO_LOG4J_PROP}\" -cp \"$CLASSPATH\" $JVMFLAGS $ZOOMAIN \"$ZOOCFG\" > \"$_ZOO_DAEMON_OUT\" 2>&1 < /dev/null" ;; stop) - echo "Stopping zookeeper ... " + echo -n "Stopping zookeeper ... " if [ ! -f "$ZOOPIDFILE" ] then - echo "error: could not find file $ZOOPIDFILE" - exit 1 + echo "error: could not find file $ZOOPIDFILE" + exit 1 else - $KILL -9 $(cat "$ZOOPIDFILE") - rm "$ZOOPIDFILE" - echo STOPPED + $KILL -9 $(cat "$ZOOPIDFILE") + rm "$ZOOPIDFILE" + echo STOPPED + exit 0 fi ;; upgrade) @@ -139,8 +157,10 @@ status) if [ "x$STAT" = "x" ] then echo "Error contacting service. It is probably not running." + exit 1 else echo $STAT + exit 0 fi ;; *) Modified: zookeeper/trunk/conf/zoo_sample.cfg URL: http://svn.apache.org/viewvc/zookeeper/trunk/conf/zoo_sample.cfg?rev=1103798&r1=1103797&r2=1103798&view=diff ============================================================================== --- zookeeper/trunk/conf/zoo_sample.cfg (original) +++ zookeeper/trunk/conf/zoo_sample.cfg Mon May 16 17:13:23 2011 @@ -7,6 +7,8 @@ initLimit=10 # sending a request and getting an acknowledgement syncLimit=5 # the directory where the snapshot is stored. -dataDir=/export/crawlspace/mahadev/zookeeper/server1/data +# do not use /tmp for storage, /tmp here is just +# example sakes. +dataDir=/tmp/zookeeper # the port at which the clients will connect clientPort=2181 From commits-returnroger49@example.com Mon May 16 17:39:25 2011 Return-Path: <commits-returnroger49@example.com> X-Original-To: roger49@example.com Delivered-To: roger49@example.com Received: from mail.apache.org (hermes.apache.org [83.161.120.155]) by minotaur.apache.org (Postfix) with SMTP id 7B9F66CC4 for <roger49@example.com>; Mon, 16 May 2011 17:39:25 +0000 (UTC) Received: (qmail 87366 invoked by uid 500); 16 May 2011 17:39:25 -0000 Delivered-To: roger49@example.com Received: (qmail 87347 invoked by uid 500); 16 May 2011 17:39:25 -0000 Mailing-List: contact roger49@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:roger49@example.com> List-Unsubscribe: <mailto:roger49@example.com> List-Post: <mailto:roger49@example.com> List-Id: <commits.zookeeper.apache.org> Reply-To: dev@<zookeeper.apache.org> Delivered-To: mailing list roger49@example.com Received: (qmail 87339 invoked by uid 99); 16 May 2011 17:39:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 May 2011 17:39:25 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 May 2011 17:39:22 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 873AB23889B1; Mon, 16 May 2011 17:39:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1103811 - in /zookeeper/trunk: CHANGES.txt src/java/main/org/apache/zookeeper/ZooKeeperMain.java src/java/test/org/apache/zookeeper/ZooKeeperTest.java Date: Mon, 16 May 2011 17:39:01 -0000 To: roger49@example.com From: roger49@example.com X-Mailer: svnmailer-1.0.8 Message-Id: <roger49@example.com> X-Virus-Checked: Checked by ClamAV on apache.org Author: mahadev Date: Mon May 16 17:39:01 2011 New Revision: 1103811 URL: http://svn.apache.org/viewvc?rev=1103811&view=rev Log: ZOOKEEPER-1059. stat command isses on non-existing node causes NPE. (Bhallamudi Kamesh via mahadev) Modified: zookeeper/trunk/CHANGES.txt zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeperMain.java zookeeper/trunk/src/java/test/org/apache/zookeeper/ZooKeeperTest.java Modified: zookeeper/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/zookeeper/trunk/CHANGES.txt?rev=1103811&r1=1103810&r2=1103811&view=diff ============================================================================== --- zookeeper/trunk/CHANGES.txt (original) +++ zookeeper/trunk/CHANGES.txt Mon May 16 17:39:01 2011 @@ -211,6 +211,8 @@ BUGFIXES: ZOOKEEPER-1061. Zookeeper stop fails if start called twice. (Ted Dunning via mahadev) + ZOOKEEPER-1059. stat command isses on non-existing node causes NPE. (Bhallamudi Kamesh via mahadev) + IMPROVEMENTS: ZOOKEEPER-724. Improve junit test integration - log harness information (phunt via mahadev) Modified: zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeperMain.java URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeperMain.java?rev=1103811&r1=1103810&r2=1103811&view=diff ============================================================================== --- zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeperMain.java (original) +++ zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeperMain.java Mon May 16 17:39:01 2011 @@ -147,7 +147,7 @@ public class ZooKeeperMain { * A storage class for both command line options and shell commands. * */ - static private class MyCommandOptions { + static class MyCommandOptions { private Map<String,String> options = new HashMap<String,String>(); private List<String> cmdArgs = null; @@ -724,6 +724,9 @@ public class ZooKeeperMain { } else if (cmd.equals("stat") && args.length >= 2) { path = args[1]; stat = zk.exists(path, watch); + if (stat == null) { + throw new KeeperException.NoNodeException(path); + } printStat(stat); } else if (cmd.equals("listquota") && args.length >= 2) { path = args[1]; Modified: zookeeper/trunk/src/java/test/org/apache/zookeeper/ZooKeeperTest.java URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/test/org/apache/zookeeper/ZooKeeperTest.java?rev=1103811&r1=1103810&r2=1103811&view=diff ============================================================================== --- zookeeper/trunk/src/java/test/org/apache/zookeeper/ZooKeeperTest.java (original) +++ zookeeper/trunk/src/java/test/org/apache/zookeeper/ZooKeeperTest.java Mon May 16 17:39:01 2011 @@ -122,4 +122,19 @@ public class ZooKeeperTest extends Clien } Assert.assertEquals(4, ((AtomicInteger) ctx).get()); } + + @Test + public void testStatWhenPathDoesNotExist() throws IOException, + InterruptedException { + final ZooKeeper zk = createClient(); + ZooKeeperMain main = new ZooKeeperMain(zk); + String cmdstring = "stat /invalidPath"; + main.cl.parseCommand(cmdstring); + try { + main.processZKCmd(main.cl); + Assert.fail("As Node does not exist, command should fail by throwing No Node Exception."); + } catch (KeeperException e) { + Assert.assertEquals("KeeperErrorCode = NoNode for /invalidPath", e.getMessage()); + } + } } From commits-returnroger49@example.com Thu May 19 21:24:02 2011 Return-Path: <commits-returnroger49@example.com> X-Original-To: roger49@example.com Delivered-To: roger49@example.com Received: from mail.apache.org (hermes.apache.org [83.161.120.155]) by minotaur.apache.org (Postfix) with SMTP id 4C9124CF8 for <roger49@example.com>; Thu, 19 May 2011 21:24:02 +0000 (UTC) Received: (qmail 83088 invoked by uid 500); 19 May 2011 21:24:02 -0000 Delivered-To: roger49@example.com Received: (qmail 83028 invoked by uid 500); 19 May 2011 21:24:02 -0000 Mailing-List: contact roger49@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:roger49@example.com> List-Unsubscribe: <mailto:roger49@example.com> List-Post: <mailto:roger49@example.com> List-Id: <commits.zookeeper.apache.org> Reply-To: dev@<zookeeper.apache.org> Delivered-To: mailing list roger49@example.com Received: (qmail 83020 invoked by uid 99); 19 May 2011 21:24:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 May 2011 21:24:01 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 May 2011 21:23:59 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 9BF382388A67; Thu, 19 May 2011 21:23:38 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1125118 - /zookeeper/site/trunk/content/credits.textile Date: Thu, 19 May 2011 21:23:38 -0000 To: roger49@example.com From: roger49@example.com X-Mailer: svnmailer-1.0.8 Message-Id: <roger49@example.com> X-Virus-Checked: Checked by ClamAV on apache.org Author: phunt Date: Thu May 19 21:23:37 2011 New Revision: 1125118 URL: http://svn.apache.org/viewvc?rev=1125118&view=rev Log: Added Michi and Camille to the committer roles Modified: zookeeper/site/trunk/content/credits.textile Modified: zookeeper/site/trunk/content/credits.textile URL: http://svn.apache.org/viewvc/zookeeper/site/trunk/content/credits.textile?rev=1125118&r1=1125117&r2=1125118&view=diff ============================================================================== --- zookeeper/site/trunk/content/credits.textile (original) +++ zookeeper/site/trunk/content/credits.textile Thu May 19 21:23:37 2011 @@ -26,10 +26,12 @@ h2(#committers). Committers ZooKeeper's active committers are |username|name|organization|timezone| +|camille|Camille Fournier|Goldman Sachs|-5| |phunt|Patrick Hunt|Cloudera Inc.|-8| |fpj|Flavio Junqueira|Yahoo Inc.|+2| |mahadev|Mahadev Konar|Yahoo Inc.|-8| |akornev|Andrew Kornev||| +|michim|Michi Mutsuzaki|Yahoo Inc.|-8| |breed|Benjamin Reed|Yahoo Inc.|-8| |henry|Henry Robinson|Cloudera Inc.|-8| From commits-returnroger49@example.com Thu May 19 21:24:11 2011 Return-Path: <commits-returnroger49@example.com> X-Original-To: roger49@example.com Delivered-To: roger49@example.com Received: from mail.apache.org (hermes.apache.org [83.161.120.155]) by minotaur.apache.org (Postfix) with SMTP id 0230C4D0C for <roger49@example.com>; Thu, 19 May 2011 21:24:11 +0000 (UTC) Received: (qmail 84045 invoked by uid 500); 19 May 2011 21:24:10 -0000 Delivered-To: roger49@example.com Received: (qmail 84017 invoked by uid 500); 19 May 2011 21:24:10 -0000 Mailing-List: contact roger49@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:roger49@example.com> List-Unsubscribe: <mailto:roger49@example.com> List-Post: <mailto:roger49@example.com> List-Id: <commits.zookeeper.apache.org> Reply-To: dev@<zookeeper.apache.org> Delivered-To: mailing list roger49@example.com Received: (qmail 84009 invoked by uid 99); 19 May 2011 21:24:10 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 May 2011 21:24:10 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 May 2011 21:24:09 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id B9E8823888EA; Thu, 19 May 2011 21:23:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r789807 - /websites/staging/zookeeper/trunk/content/credits.html Date: Thu, 19 May 2011 21:23:49 -0000 To: roger49@example.com From: roger49@example.com X-Mailer: svnmailer-1.0.8 Message-Id: <roger49@example.com> Author: buildbot Date: Thu May 19 21:23:49 2011 New Revision: 789807 Log: Staging update by buildbot Modified: websites/staging/zookeeper/trunk/content/credits.html Modified: websites/staging/zookeeper/trunk/content/credits.html ============================================================================== --- websites/staging/zookeeper/trunk/content/credits.html (original) +++ websites/staging/zookeeper/trunk/content/credits.html Thu May 19 21:23:49 2011 @@ -64,7 +64,7 @@ <p>ZooKeeper&#39;s active committers are</p> -<table><tr><td>username</td><td>name</td><td>organization</td><td>timezone</td></tr><tr><td>phunt</td><td>Patrick Hunt</td><td>Cloudera Inc.</td><td>-8</td></tr><tr><td>fpj</td><td>Flavio Junqueira</td><td>Yahoo Inc.</td><td>+2</td></tr><tr><td>mahadev</td><td>Mahadev Konar</td><td>Yahoo Inc.</td><td>-8</td></tr><tr><td>akornev</td><td colspan="3">Andrew Kornev</td></tr><tr><td>breed</td><td>Benjamin Reed</td><td>Yahoo Inc.</td><td>-8</td></tr><tr><td>henry</td><td>Henry Robinson</td><td>Cloudera Inc.</td><td>-8</td></tr></table> +<table><tr><td>username</td><td>name</td><td>organization</td><td>timezone</td></tr><tr><td>camille</td><td>Camille Fournier</td><td>Goldman Sachs</td><td>-5</td></tr><tr><td>phunt</td><td>Patrick Hunt</td><td>Cloudera Inc.</td><td>-8</td></tr><tr><td>fpj</td><td>Flavio Junqueira</td><td>Yahoo Inc.</td><td>+2</td></tr><tr><td>mahadev</td><td>Mahadev Konar</td><td>Yahoo Inc.</td><td>-8</td></tr><tr><td>akornev</td><td colspan="3">Andrew Kornev</td></tr><tr><td>michim</td><td>Michi Mutsuzaki</td><td>Yahoo Inc.</td><td>-8</td></tr><tr><td>breed</td><td>Benjamin Reed</td><td>Yahoo Inc.</td><td>-8</td></tr><tr><td>henry</td><td>Henry Robinson</td><td>Cloudera Inc.</td><td>-8</td></tr></table> <h2 id="contributors">Contributors</h2> From commits-returnroger49@example.com Thu May 19 21:25:34 2011 Return-Path: <commits-returnroger49@example.com> X-Original-To: roger49@example.com Delivered-To: roger49@example.com Received: from mail.apache.org (hermes.apache.org [83.161.120.155]) by minotaur.apache.org (Postfix) with SMTP id 9611F4DC5 for <roger49@example.com>; Thu, 19 May 2011 21:25:34 +0000 (UTC) Received: (qmail 88201 invoked by uid 500); 19 May 2011 21:25:31 -0000 Delivered-To: roger49@example.com Received: (qmail 88175 invoked by uid 500); 19 May 2011 21:25:31 -0000 Mailing-List: contact roger49@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:roger49@example.com> List-Unsubscribe: <mailto:roger49@example.com> List-Post: <mailto:roger49@example.com> List-Id: <commits.zookeeper.apache.org> Reply-To: dev@<zookeeper.apache.org> Delivered-To: mailing list roger49@example.com Received: (qmail 88096 invoked by uid 99); 19 May 2011 21:25:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 May 2011 21:25:31 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 May 2011 21:25:29 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 4B3DD23888EA; Thu, 19 May 2011 21:25:08 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r789808 - in /websites/production/zookeeper: ./ content/credits.html Date: Thu, 19 May 2011 21:25:08 -0000 To: roger49@example.com From: roger49@example.com X-Mailer: svnmailer-1.0.8 Message-Id: <roger49@example.com> X-Virus-Checked: Checked by ClamAV on apache.org Author: phunt Date: Thu May 19 21:25:07 2011 New Revision: 789808 Log: Publishing merge to zookeeper site by phunt Modified: websites/production/zookeeper/ (props changed) websites/production/zookeeper/content/credits.html Propchange: websites/production/zookeeper/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu May 19 21:25:07 2011 @@ -1 +1 @@ -/websites/staging/zookeeper/trunk:779660-789091 +/websites/staging/zookeeper/trunk:779660-789807 Modified: websites/production/zookeeper/content/credits.html ============================================================================== --- websites/production/zookeeper/content/credits.html (original) +++ websites/production/zookeeper/content/credits.html Thu May 19 21:25:07 2011 @@ -64,7 +64,7 @@ <p>ZooKeeper&#39;s active committers are</p> -<table><tr><td>username</td><td>name</td><td>organization</td><td>timezone</td></tr><tr><td>phunt</td><td>Patrick Hunt</td><td>Cloudera Inc.</td><td>-8</td></tr><tr><td>fpj</td><td>Flavio Junqueira</td><td>Yahoo Inc.</td><td>+2</td></tr><tr><td>mahadev</td><td>Mahadev Konar</td><td>Yahoo Inc.</td><td>-8</td></tr><tr><td>akornev</td><td colspan="3">Andrew Kornev</td></tr><tr><td>breed</td><td>Benjamin Reed</td><td>Yahoo Inc.</td><td>-8</td></tr><tr><td>henry</td><td>Henry Robinson</td><td>Cloudera Inc.</td><td>-8</td></tr></table> +<table><tr><td>username</td><td>name</td><td>organization</td><td>timezone</td></tr><tr><td>camille</td><td>Camille Fournier</td><td>Goldman Sachs</td><td>-5</td></tr><tr><td>phunt</td><td>Patrick Hunt</td><td>Cloudera Inc.</td><td>-8</td></tr><tr><td>fpj</td><td>Flavio Junqueira</td><td>Yahoo Inc.</td><td>+2</td></tr><tr><td>mahadev</td><td>Mahadev Konar</td><td>Yahoo Inc.</td><td>-8</td></tr><tr><td>akornev</td><td colspan="3">Andrew Kornev</td></tr><tr><td>michim</td><td>Michi Mutsuzaki</td><td>Yahoo Inc.</td><td>-8</td></tr><tr><td>breed</td><td>Benjamin Reed</td><td>Yahoo Inc.</td><td>-8</td></tr><tr><td>henry</td><td>Henry Robinson</td><td>Cloudera Inc.</td><td>-8</td></tr></table> <h2 id="contributors">Contributors</h2> From commits-returnroger49@example.com Thu May 19 23:18:19 2011 Return-Path: <commits-returnroger49@example.com> X-Original-To: roger49@example.com Delivered-To: roger49@example.com Received: from mail.apache.org (hermes.apache.org [83.161.120.155]) by minotaur.apache.org (Postfix) with SMTP id 6FEA64AEF for <roger49@example.com>; Thu, 19 May 2011 23:18:19 +0000 (UTC) Received: (qmail 24701 invoked by uid 500); 19 May 2011 23:18:19 -0000 Delivered-To: roger49@example.com Received: (qmail 24674 invoked by uid 500); 19 May 2011 23:18:19 -0000 Mailing-List: contact roger49@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:roger49@example.com> List-Unsubscribe: <mailto:roger49@example.com> List-Post: <mailto:roger49@example.com> List-Id: <commits.zookeeper.apache.org> Reply-To: dev@<zookeeper.apache.org> Delivered-To: mailing list roger49@example.com Received: (qmail 24665 invoked by uid 99); 19 May 2011 23:18:19 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 May 2011 23:18:19 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 May 2011 23:18:12 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id E4AC923888EA; Thu, 19 May 2011 23:17:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1125176 - in /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/apache/zookeeper/test/ Date: Thu, 19 May 2011 23:17:49 -0000 To: roger49@example.com From: roger49@example.com X-Mailer: svnmailer-1.0.8 Message-Id: <roger49@example.com> X-Virus-Checked: Checked by ClamAV on apache.org Author: henry Date: Thu May 19 23:17:48 2011 New Revision: 1125176 URL: http://svn.apache.org/viewvc?rev=1125176&view=rev Log: ZOOKEEPER-784. Server-side functionality for read-only mode (Sergey Doroshenko via henryr) Modified: zookeeper/trunk/CHANGES.txt zookeeper/trunk/src/java/main/org/apache/zookeeper/ClientCnxn.java zookeeper/trunk/src/java/main/org/apache/zookeeper/ClientCnxnSocket.java zookeeper/trunk/src/java/main/org/apache/zookeeper/ClientCnxnSocketNIO.java zookeeper/trunk/src/java/main/org/apache/zookeeper/KeeperException.java zookeeper/trunk/src/java/main/org/apache/zookeeper/Watcher.java zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeperMain.java zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NettyServerCnxn.java zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ServerCnxn.java zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServer.java zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumZooKeeperServer.java zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ClientBase.java zookeeper/trunk/src/java/test/org/apache/zookeeper/test/QuorumBase.java Modified: zookeeper/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/zookeeper/trunk/CHANGES.txt?rev=1125176&r1=1125175&r2=1125176&view=diff ============================================================================== --- zookeeper/trunk/CHANGES.txt (original) +++ zookeeper/trunk/CHANGES.txt Thu May 19 23:17:48 2011 @@ -318,6 +318,8 @@ NEW FEATURES: ZOOKEEPER-1038. Move bookkeeper and hedwig code in subversion (breed) + ZOOKEEPER-784. Server-side functionality for read-only mode (Sergey Doroshenko via henryr) + Release 3.3.0 - 2010-03-24 Non-backward compatible changes: Modified: zookeeper/trunk/src/java/main/org/apache/zookeeper/ClientCnxn.java URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/main/org/apache/zookeeper/ClientCnxn.java?rev=1125176&r1=1125175&r2=1125176&view=diff ============================================================================== --- zookeeper/trunk/src/java/main/org/apache/zookeeper/ClientCnxn.java (original) +++ zookeeper/trunk/src/java/main/org/apache/zookeeper/ClientCnxn.java Thu May 19 23:17:48 2011 @@ -29,6 +29,10 @@ import java.util.Random; import java.util.Set; import java.util.concurrent.CopyOnWriteArraySet; import java.util.concurrent.LinkedBlockingQueue; +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.ConnectException; +import java.net.Socket; import org.apache.jute.BinaryInputArchive; import org.apache.jute.BinaryOutputArchive; @@ -136,6 +140,14 @@ public class ClientCnxn { private byte sessionPasswd[] = new byte[16]; + /** + * If true, the connection is allowed to go to r-o mode. This field's value + * is sent, besides other data, during session creation handshake. If the + * server on the other side of the wire is partitioned it'll accept + * read-only clients only. + */ + private boolean readOnly; + final String chrootPath; final SendThread sendThread; @@ -155,6 +167,21 @@ public class ClientCnxn { */ private final HostProvider hostProvider; + /** + * Is set to true when a connection to a r/w server is established for the + * first time; never changed afterwards. + * <p> + * Is used to handle situations when client without sessionId connects to a + * read-only server. Such client receives "fake" sessionId from read-only + * server, but this sessionId is invalid for other servers. So when such + * client finds a r/w server, it sends 0 instead of fake sessionId during + * connection handshake and establishes new, valid session. + * <p> + * If this field is false (which implies we haven't seen r/w server before) + * then non-zero sessionId is fake, otherwise it is valid. + */ + volatile boolean seenRwServerBefore = false; + public long getSessionId() { return sessionId; } @@ -215,8 +242,18 @@ public class ClientCnxn { WatchRegistration watchRegistration; - Packet(RequestHeader requestHeader, ReplyHeader replyHeader, Record request, - Record response, WatchRegistration watchRegistration) { + /** Convenience ctor */ + Packet(RequestHeader requestHeader, ReplyHeader replyHeader, + Record request, Record response, + WatchRegistration watchRegistration) { + this(requestHeader, replyHeader, request, response, + watchRegistration, false); + } + + Packet(RequestHeader requestHeader, ReplyHeader replyHeader, + Record request, Record response, + WatchRegistration watchRegistration, boolean readOnly) { + this.requestHeader = requestHeader; this.replyHeader = replyHeader; this.request = request; @@ -231,6 +268,8 @@ public class ClientCnxn { } if (request instanceof ConnectRequest) { request.serialize(boa, "connect"); + // append "am-I-allowed-to-be-readonly" flag + boa.writeBool(readOnly, "readOnly"); } else if (request != null) { request.serialize(boa, "request"); } @@ -278,12 +317,16 @@ public class ClientCnxn { * @param watcher watcher for this connection * @param clientCnxnSocket * the socket implementation used (e.g. NIO/Netty) + * @param canBeReadOnly + * whether the connection is allowed to go to read-only + * mode in case of partitioning * @throws IOException */ public ClientCnxn(String chrootPath, HostProvider hostProvider, int sessionTimeout, ZooKeeper zooKeeper, - ClientWatchManager watcher, ClientCnxnSocket clientCnxnSocket) + ClientWatchManager watcher, ClientCnxnSocket clientCnxnSocket, boolean canBeReadOnly) throws IOException { - this(chrootPath, hostProvider, sessionTimeout, zooKeeper, watcher, clientCnxnSocket, 0, new byte[16]); + this(chrootPath, hostProvider, sessionTimeout, zooKeeper, watcher, + clientCnxnSocket, 0, new byte[16], canBeReadOnly); } /** @@ -303,11 +346,14 @@ public class ClientCnxn { * the socket implementation used (e.g. NIO/Netty) * @param sessionId session id if re-establishing session * @param sessionPasswd session passwd if re-establishing session + * @param canBeReadOnly + * whether the connection is allowed to go to read-only + * mode in case of partitioning * @throws IOException */ public ClientCnxn(String chrootPath, HostProvider hostProvider, int sessionTimeout, ZooKeeper zooKeeper, ClientWatchManager watcher, ClientCnxnSocket clientCnxnSocket, - long sessionId, byte[] sessionPasswd) { + long sessionId, byte[] sessionPasswd, boolean canBeReadOnly) { this.zooKeeper = zooKeeper; this.watcher = watcher; this.sessionId = sessionId; @@ -318,6 +364,7 @@ public class ClientCnxn { connectTimeout = sessionTimeout / hostProvider.size(); readTimeout = sessionTimeout * 2 / 3; + readOnly = canBeReadOnly; sendThread = new SendThread(clientCnxnSocket); eventThread = new EventThread(); @@ -614,6 +661,14 @@ public class ClientCnxn { super(msg); } } + + private static class RWServerFoundException extends IOException { + private static final long serialVersionUID = 90431199887158758L; + + public RWServerFoundException(String msg) { + super(msg); + } + } public static final int packetLen = Integer.getInteger("jute.maxbuffer", 4096 * 1024); @@ -757,10 +812,12 @@ public class ClientCnxn { void primeConnection() throws IOException { LOG.info("Socket connection established to " - + clientCnxnSocket.getRemoteSocketAddress() + ", initiating session"); + + clientCnxnSocket.getRemoteSocketAddress() + + ", initiating session"); isFirstConnect = false; + long sessId = (seenRwServerBefore) ? sessionId : 0; ConnectRequest conReq = new ConnectRequest(0, lastZxid, - sessionTimeout, sessionId, sessionPasswd); + sessionTimeout, sessId, sessionPasswd); synchronized (outgoingQueue) { // We add backwards since we are pushing into the front // Only send if there's a pending watch @@ -786,8 +843,8 @@ public class ClientCnxn { OpCode.auth), null, new AuthPacket(0, id.scheme, id.data), null, null)); } - outgoingQueue.addFirst((new Packet(null, null, conReq, null, - null))); + outgoingQueue.addFirst(new Packet(null, null, conReq, + null, null, readOnly)); } clientCnxnSocket.enableReadWriteOnly(); if (LOG.isDebugEnabled()) { @@ -802,16 +859,31 @@ public class ClientCnxn { queuePacket(h, null, null, null, null, null, null, null, null); } + private InetSocketAddress rwServerAddress = null; + + private final static int minPingRwTimeout = 100; + + private final static int maxPingRwTimeout = 60000; + + private int pingRwTimeout = minPingRwTimeout; + private void startConnect() throws IOException { if(!isFirstConnect){ try { Thread.sleep(r.nextInt(1000)); - } catch (InterruptedException e1) { - LOG.warn("Unexpected exception", e1); + } catch (InterruptedException e) { + LOG.warn("Unexpected exception", e); } } state = States.CONNECTING; - InetSocketAddress addr = hostProvider.next(1000); + + InetSocketAddress addr; + if (rwServerAddress != null) { + addr = rwServerAddress; + rwServerAddress = null; + } else { + addr = hostProvider.next(1000); + } LOG.info("Opening socket connection to server " + addr); @@ -830,6 +902,7 @@ public class ClientCnxn { clientCnxnSocket.updateNow(); clientCnxnSocket.updateLastSendAndHeard(); int to; + long lastPingRwServer = System.currentTimeMillis(); while (state.isAlive()) { try { if (!clientCnxnSocket.isConnected()) { @@ -841,7 +914,7 @@ public class ClientCnxn { clientCnxnSocket.updateLastSendAndHeard(); } - if (state == States.CONNECTED) { + if (state.isConnected()) { to = readTimeout - clientCnxnSocket.getIdleRecv(); } else { to = connectTimeout - clientCnxnSocket.getIdleRecv(); @@ -854,7 +927,7 @@ public class ClientCnxn { + " for sessionid 0x" + Long.toHexString(sessionId)); } - if (state == States.CONNECTED) { + if (state.isConnected()) { int timeToNextPing = readTimeout / 2 - clientCnxnSocket.getIdleSend(); if (timeToNextPing <= 0) { @@ -868,6 +941,20 @@ public class ClientCnxn { } } + // If we are in read-only mode, seek for read/write server + if (state == States.CONNECTEDREADONLY) { + long now = System.currentTimeMillis(); + int idlePingRwServer = (int) (now - lastPingRwServer); + if (idlePingRwServer >= pingRwTimeout) { + lastPingRwServer = now; + idlePingRwServer = 0; + pingRwTimeout = + Math.min(2*pingRwTimeout, maxPingRwTimeout); + pingRwServer(); + } + to = Math.min(to, pingRwTimeout - idlePingRwServer); + } + clientCnxnSocket.doTransport(to, pendingQueue, outgoingQueue); } catch (Exception e) { @@ -887,6 +974,8 @@ public class ClientCnxn { LOG.info(e.getMessage() + RETRY_CONN_MSG); } else if (e instanceof EndOfStreamException) { LOG.info(e.getMessage() + RETRY_CONN_MSG); + } else if (e instanceof RWServerFoundException) { + LOG.info(e.getMessage()); } else { LOG.warn( "Session 0x" @@ -918,6 +1007,43 @@ public class ClientCnxn { "SendThread exitedloop."); } + private void pingRwServer() throws RWServerFoundException { + String result = null; + InetSocketAddress addr = hostProvider.next(0); + LOG.info("Checking server " + addr + " for being r/w." + + " Timeout " + pingRwTimeout); + + try { + Socket sock = new Socket(addr.getHostName(), addr.getPort()); + sock.setSoLinger(false, -1); + sock.setSoTimeout(1000); + sock.setTcpNoDelay(true); + sock.getOutputStream().write("isro".getBytes()); + sock.getOutputStream().flush(); + sock.shutdownOutput(); + BufferedReader br = new BufferedReader( + new InputStreamReader(sock.getInputStream())); + result = br.readLine(); + sock.close(); + br.close(); + } catch (ConnectException e) { + // ignore, this just means server is not up + } catch (IOException e) { + // some unexpected error, warn about it + LOG.warn("Exception while seeking for r/w server " + + e.getMessage(), e); + } + + if ("rw".equals(result)) { + pingRwTimeout = minPingRwTimeout; + // save the found address so that it's used during the next + // connection attempt + rwServerAddress = addr; + throw new RWServerFoundException("Majority server found at " + + addr.getHostName() + ":" + addr.getPort()); + } + } + private void cleanup() { clientCnxnSocket.cleanup(); synchronized (pendingQueue) { @@ -941,10 +1067,11 @@ public class ClientCnxn { * @param _negotiatedSessionTimeout * @param _sessionId * @param _sessionPasswd + * @param isRO * @throws IOException */ void onConnected(int _negotiatedSessionTimeout, long _sessionId, - byte[] _sessionPasswd) throws IOException { + byte[] _sessionPasswd, boolean isRO) throws IOException { negotiatedSessionTimeout = _negotiatedSessionTimeout; if (negotiatedSessionTimeout <= 0) { state = States.CLOSED; @@ -957,19 +1084,27 @@ public class ClientCnxn { "Unable to reconnect to ZooKeeper service, session 0x" + Long.toHexString(sessionId) + " has expired"); } + if (!readOnly && isRO) { + LOG.error("Read/write client got connected to read-only server"); + } readTimeout = negotiatedSessionTimeout * 2 / 3; connectTimeout = negotiatedSessionTimeout / hostProvider.size(); hostProvider.onConnected(); sessionId = _sessionId; sessionPasswd = _sessionPasswd; - state = States.CONNECTED; + state = (isRO) ? + States.CONNECTEDREADONLY : States.CONNECTED; + seenRwServerBefore |= !isRO; LOG.info("Session establishment complete on server " - + clientCnxnSocket.getRemoteSocketAddress() + ", sessionid = 0x" - + Long.toHexString(sessionId) + ", negotiated timeout = " - + negotiatedSessionTimeout); + + clientCnxnSocket.getRemoteSocketAddress() + + ", sessionid = 0x" + Long.toHexString(sessionId) + + ", negotiated timeout = " + negotiatedSessionTimeout + + (isRO ? " (READ-ONLY mode)" : "")); + KeeperState eventState = (isRO) ? + KeeperState.ConnectedReadOnly : KeeperState.SyncConnected; eventThread.queueEvent(new WatchedEvent( Watcher.Event.EventType.None, - Watcher.Event.KeeperState.SyncConnected, null)); + eventState, null)); } void close() { Modified: zookeeper/trunk/src/java/main/org/apache/zookeeper/ClientCnxnSocket.java URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/main/org/apache/zookeeper/ClientCnxnSocket.java?rev=1125176&r1=1125175&r2=1125176&view=diff ============================================================================== --- zookeeper/trunk/src/java/main/org/apache/zookeeper/ClientCnxnSocket.java (original) +++ zookeeper/trunk/src/java/main/org/apache/zookeeper/ClientCnxnSocket.java Thu May 19 23:17:48 2011 @@ -128,9 +128,20 @@ abstract class ClientCnxnSocket { BinaryInputArchive bbia = BinaryInputArchive.getArchive(bbis); ConnectResponse conRsp = new ConnectResponse(); conRsp.deserialize(bbia, "connect"); + + // read "is read-only" flag + boolean isRO = false; + try { + isRO = bbia.readBool("readOnly"); + } catch (IOException e) { + // this is ok -- just a packet from an old server which + // doesn't contain readOnly field + LOG.warn("Connected to an old server; r-o mode will be unavailable"); + } + this.sessionId = conRsp.getSessionId(); sendThread.onConnected(conRsp.getTimeOut(), this.sessionId, - conRsp.getPasswd()); + conRsp.getPasswd(), isRO); } abstract boolean isConnected(); Modified: zookeeper/trunk/src/java/main/org/apache/zookeeper/ClientCnxnSocketNIO.java URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/main/org/apache/zookeeper/ClientCnxnSocketNIO.java?rev=1125176&r1=1125175&r2=1125176&view=diff ============================================================================== --- zookeeper/trunk/src/java/main/org/apache/zookeeper/ClientCnxnSocketNIO.java (original) +++ zookeeper/trunk/src/java/main/org/apache/zookeeper/ClientCnxnSocketNIO.java Thu May 19 23:17:48 2011 @@ -273,7 +273,7 @@ public class ClientCnxnSocketNIO extends } } } - if (sendThread.getZkState() == States.CONNECTED) { + if (sendThread.getZkState().isConnected()) { if (outgoingQueue.size() > 0) { enableWrite(); } else { Modified: zookeeper/trunk/src/java/main/org/apache/zookeeper/KeeperException.java URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/main/org/apache/zookeeper/KeeperException.java?rev=1125176&r1=1125175&r2=1125176&view=diff ============================================================================== --- zookeeper/trunk/src/java/main/org/apache/zookeeper/KeeperException.java (original) +++ zookeeper/trunk/src/java/main/org/apache/zookeeper/KeeperException.java Thu May 19 23:17:48 2011 @@ -120,6 +120,8 @@ public abstract class KeeperException ex return new InvalidCallbackException(); case SESSIONMOVED: return new SessionMovedException(); + case NOTREADONLY: + return new NotReadOnlyException(); case OK: default: @@ -332,7 +334,9 @@ public abstract class KeeperException ex /** Client authentication failed */ AUTHFAILED (AuthFailed), /** Session moved to another server, so operation is ignored */ - SESSIONMOVED (-118); + SESSIONMOVED (-118), + /** State-changing request is passed to read-only server */ + NOTREADONLY (-119); private static final Map<Integer,Code> lookup = new HashMap<Integer,Code>(); @@ -407,6 +411,8 @@ public abstract class KeeperException ex return "Invalid callback"; case SESSIONMOVED: return "Session moved"; + case NOTREADONLY: + return "Not a read-only call"; default: return "Unknown error " + code; } @@ -643,6 +649,15 @@ public abstract class KeeperException ex } /** + * @see Code#NOTREADONLY + */ + public static class NotReadOnlyException extends KeeperException { + public NotReadOnlyException() { + super(Code.NOTREADONLY); + } + } + + /** * @see Code#SYSTEMERROR */ public static class SystemErrorException extends KeeperException { Modified: zookeeper/trunk/src/java/main/org/apache/zookeeper/Watcher.java URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/main/org/apache/zookeeper/Watcher.java?rev=1125176&r1=1125175&r2=1125176&view=diff ============================================================================== --- zookeeper/trunk/src/java/main/org/apache/zookeeper/Watcher.java (original) +++ zookeeper/trunk/src/java/main/org/apache/zookeeper/Watcher.java Thu May 19 23:17:48 2011 @@ -54,17 +54,26 @@ public interface Watcher { * creation). */ SyncConnected (3), + /** + * Auth failed state + */ + AuthFailed (4), + + /** + * The client is connected to a read-only server, that is the + * server which is not currently connected to the majority. + * The only operations allowed after receiving this state is + * read operations. + * This state is generated for read-only clients only since + * read/write clients aren't allowed to connect to r/o servers. + */ + ConnectedReadOnly (5), + /** The serving cluster has expired this session. The ZooKeeper * client connection (the session) is no longer valid. You must * create a new client connection (instantiate a new ZooKeeper * instance) if you with to access the ensemble. */ - Expired (-112), - - /** - * Auth failed state - * - */ - AuthFailed(4); + Expired (-112); private final int intValue; // Integer representation of value // for sending over wire @@ -84,6 +93,7 @@ public interface Watcher { case 1: return KeeperState.NoSyncConnected; case 3: return KeeperState.SyncConnected; case 4: return KeeperState.AuthFailed; + case 5: return KeeperState.ConnectedReadOnly; case -112: return KeeperState.Expired; default: Modified: zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java?rev=1125176&r1=1125175&r2=1125176&view=diff ============================================================================== --- zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java (original) +++ zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java Thu May 19 23:17:48 2011 @@ -321,11 +321,21 @@ public class ZooKeeper { } public enum States { - CONNECTING, ASSOCIATING, CONNECTED, CLOSED, AUTH_FAILED; + CONNECTING, ASSOCIATING, CONNECTED, CONNECTEDREADONLY, + CLOSED, AUTH_FAILED; public boolean isAlive() { return this != CLOSED && this != AUTH_FAILED; } + + /** + * Returns whether we are connected to a server (which + * could possibly be read-only, if this client is allowed + * to go to read-only mode) + * */ + public boolean isConnected() { + return this == CONNECTED || this == CONNECTEDREADONLY; + } } protected final ClientCnxn cnxn; @@ -376,6 +386,64 @@ public class ZooKeeper { public ZooKeeper(String connectString, int sessionTimeout, Watcher watcher) throws IOException { + this(connectString, sessionTimeout, watcher, false); + } + + /** + * To create a ZooKeeper client object, the application needs to pass a + * connection string containing a comma separated list of host:port pairs, + * each corresponding to a ZooKeeper server. + * <p> + * Session establishment is asynchronous. This constructor will initiate + * connection to the server and return immediately - potentially (usually) + * before the session is fully established. The watcher argument specifies + * the watcher that will be notified of any changes in state. This + * notification can come at any point before or after the constructor call + * has returned. + * <p> + * The instantiated ZooKeeper client object will pick an arbitrary server + * from the connectString and attempt to connect to it. If establishment of + * the connection fails, another server in the connect string will be tried + * (the order is non-deterministic, as we random shuffle the list), until a + * connection is established. The client will continue attempts until the + * session is explicitly closed. + * <p> + * Added in 3.2.0: An optional "chroot" suffix may also be appended to the + * connection string. This will run the client commands while interpreting + * all paths relative to this root (similar to the unix chroot command). + * + * @param connectString + * comma separated host:port pairs, each corresponding to a zk + * server. e.g. "83.161.120.155:3000,83.161.120.155:3001,83.161.120.155:3002" If + * the optional chroot suffix is used the example would look + * like: "83.161.120.155:3000,83.161.120.155:3001,83.161.120.155:3002/app/a" + * where the client would be rooted at "/app/a" and all paths + * would be relative to this root - ie getting/setting/etc... + * "/foo/bar" would result in operations being run on + * "/app/a/foo/bar" (from the server perspective). + * @param sessionTimeout + * session timeout in milliseconds + * @param watcher + * a watcher object which will be notified of state changes, may + * also be notified for node events + * @param canBeReadOnly + * (added in 3.4) whether the created client is allowed to go to + * read-only mode in case of partitioning. Read-only mode + * basically means that if the client can't find any majority + * servers but there's partitioned server it could reach, it + * connects to one in read-only mode, i.e. read requests are + * allowed while write requests are not. It continues seeking for + * majority in the background. + * + * @throws IOException + * in cases of network failure + * @throws IllegalArgumentException + * if an invalid chroot path is specified + */ + public ZooKeeper(String connectString, int sessionTimeout, Watcher watcher, + boolean canBeReadOnly) + throws IOException + { LOG.info("Initiating client connection, connectString=" + connectString + " sessionTimeout=" + sessionTimeout + " watcher=" + watcher); @@ -387,7 +455,7 @@ public class ZooKeeper { connectStringParser.getServerAddresses()); cnxn = new ClientCnxn(connectStringParser.getChrootPath(), hostProvider, sessionTimeout, this, watchManager, - getClientCnxnSocket()); + getClientCnxnSocket(), canBeReadOnly); cnxn.start(); } @@ -447,6 +515,72 @@ public class ZooKeeper { long sessionId, byte[] sessionPasswd) throws IOException { + this(connectString, sessionTimeout, watcher, sessionId, sessionPasswd, false); + } + + /** + * To create a ZooKeeper client object, the application needs to pass a + * connection string containing a comma separated list of host:port pairs, + * each corresponding to a ZooKeeper server. + * <p> + * Session establishment is asynchronous. This constructor will initiate + * connection to the server and return immediately - potentially (usually) + * before the session is fully established. The watcher argument specifies + * the watcher that will be notified of any changes in state. This + * notification can come at any point before or after the constructor call + * has returned. + * <p> + * The instantiated ZooKeeper client object will pick an arbitrary server + * from the connectString and attempt to connect to it. If establishment of + * the connection fails, another server in the connect string will be tried + * (the order is non-deterministic, as we random shuffle the list), until a + * connection is established. The client will continue attempts until the + * session is explicitly closed (or the session is expired by the server). + * <p> + * Added in 3.2.0: An optional "chroot" suffix may also be appended to the + * connection string. This will run the client commands while interpreting + * all paths relative to this root (similar to the unix chroot command). + * <p> + * Use {@link #getSessionId} and {@link #getSessionPasswd} on an established + * client connection, these values must be passed as sessionId and + * sessionPasswd respectively if reconnecting. Otherwise, if not + * reconnecting, use the other constructor which does not require these + * parameters. + * + * @param connectString + * comma separated host:port pairs, each corresponding to a zk + * server. e.g. "83.161.120.155:3000,83.161.120.155:3001,83.161.120.155:3002" + * If the optional chroot suffix is used the example would look + * like: "83.161.120.155:3000,83.161.120.155:3001,83.161.120.155:3002/app/a" + * where the client would be rooted at "/app/a" and all paths + * would be relative to this root - ie getting/setting/etc... + * "/foo/bar" would result in operations being run on + * "/app/a/foo/bar" (from the server perspective). + * @param sessionTimeout + * session timeout in milliseconds + * @param watcher + * a watcher object which will be notified of state changes, may + * also be notified for node events + * @param sessionId + * specific session id to use if reconnecting + * @param sessionPasswd + * password for this session + * @param canBeReadOnly + * (added in 3.4) whether the created client is allowed to go to + * read-only mode in case of partitioning. Read-only mode + * basically means that if the client can't find any majority + * servers but there's partitioned server it could reach, it + * connects to one in read-only mode, i.e. read requests are + * allowed while write requests are not. It continues seeking for + * majority in the background. + * + * @throws IOException in cases of network failure + * @throws IllegalArgumentException if an invalid chroot path is specified + */ + public ZooKeeper(String connectString, int sessionTimeout, Watcher watcher, + long sessionId, byte[] sessionPasswd, boolean canBeReadOnly) + throws IOException + { LOG.info("Initiating client connection, connectString=" + connectString + " sessionTimeout=" + sessionTimeout + " watcher=" + watcher @@ -462,7 +596,8 @@ public class ZooKeeper { connectStringParser.getServerAddresses()); cnxn = new ClientCnxn(connectStringParser.getChrootPath(), hostProvider, sessionTimeout, this, watchManager, - getClientCnxnSocket(), sessionId, sessionPasswd); + getClientCnxnSocket(), sessionId, sessionPasswd, canBeReadOnly); + cnxn.seenRwServerBefore = true; // since user has provided sessionId cnxn.start(); } @@ -1591,7 +1726,7 @@ public class ZooKeeper { public String toString() { States state = getState(); return ("State:" + state.toString() - + (state == States.CONNECTED ? + + (state.isConnected() ? " Timeout:" + getSessionTimeout() + " " : " ") + cnxn); Modified: zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeperMain.java URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeperMain.java?rev=1125176&r1=1125175&r2=1125176&view=diff ============================================================================== --- zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeperMain.java (original) +++ zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeperMain.java Thu May 19 23:17:48 2011 @@ -195,6 +195,8 @@ public class ZooKeeperMain { options.put("server", it.next()); } else if (opt.equals("-timeout")) { options.put("timeout", it.next()); + } else if (opt.equals("-r")) { + options.put("readonly", "true"); } } catch (NoSuchElementException e){ System.err.println("Error: no argument found for option " @@ -260,9 +262,10 @@ public class ZooKeeperMain { zk.close(); } host = newHost; + boolean readOnly = cl.getOption("readonly") != null; zk = new ZooKeeper(host, Integer.parseInt(cl.getOption("timeout")), - new MyWatcher()); + new MyWatcher(), readOnly); } public static void main(String args[]) @@ -592,6 +595,8 @@ public class ZooKeeperMain { System.err.println("Node already exists: " + e.getPath()); } catch (KeeperException.NotEmptyException e) { System.err.println("Node not empty: " + e.getPath()); + } catch (KeeperException.NotReadOnlyException e) { + System.err.println("Not a read-only call: " + e.getPath()); } return false; } Modified: zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java?rev=1125176&r1=1125175&r2=1125176&view=diff ============================================================================== --- zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java (original) +++ zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java Thu May 19 23:17:48 2011 @@ -50,7 +50,7 @@ import org.apache.zookeeper.proto.Reques import org.apache.zookeeper.proto.WatcherEvent; import org.apache.zookeeper.server.quorum.Leader; import org.apache.zookeeper.server.quorum.LeaderZooKeeperServer; - +import org.apache.zookeeper.server.quorum.ReadOnlyZooKeeperServer; import com.sun.management.UnixOperatingSystemMXBean; /** @@ -644,6 +644,10 @@ public class NIOServerCnxn extends Serve else { pw.print("Zookeeper version: "); pw.println(Version.getFullVersion()); + if (zkServer instanceof ReadOnlyZooKeeperServer) { + pw.println("READ-ONLY mode; serving only " + + "read-only clients"); + } if (len == statCmd) { LOG.info("Stat command output"); pw.println("Clients:"); @@ -780,6 +784,23 @@ public class NIOServerCnxn extends Serve } + private class IsroCommand extends CommandThread { + + public IsroCommand(PrintWriter pw) { + super(pw); + } + + @Override + public void commandRun() { + if (zkServer == null) { + pw.print("null"); + } else if (zkServer instanceof ReadOnlyZooKeeperServer) { + pw.print("ro"); + } else { + pw.print("rw"); + } + } + } /** Return if four letter word found and responded to, otw false **/ private boolean checkFourLetterWord(final SelectionKey k, final int len) @@ -870,6 +891,10 @@ public class NIOServerCnxn extends Serve MonitorCommand mntr = new MonitorCommand(pwriter); mntr.start(); return true; + } else if (len == isroCmd) { + IsroCommand isro = new IsroCommand(pwriter); + isro.start(); + return true; } return false; } Modified: zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NettyServerCnxn.java URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NettyServerCnxn.java?rev=1125176&r1=1125175&r2=1125176&view=diff ============================================================================== --- zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NettyServerCnxn.java (original) +++ zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NettyServerCnxn.java Thu May 19 23:17:48 2011 @@ -24,7 +24,6 @@ import java.io.BufferedWriter; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.PrintWriter; -import java.io.StringWriter; import java.io.Writer; import java.lang.management.ManagementFactory; import java.lang.management.OperatingSystemMXBean; @@ -49,6 +48,7 @@ import org.apache.zookeeper.proto.ReplyH import org.apache.zookeeper.proto.WatcherEvent; import org.apache.zookeeper.server.quorum.Leader; import org.apache.zookeeper.server.quorum.LeaderZooKeeperServer; +import org.apache.zookeeper.server.quorum.ReadOnlyZooKeeperServer; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; @@ -457,6 +457,10 @@ public class NettyServerCnxn extends Ser else { pw.print("Zookeeper version: "); pw.println(Version.getFullVersion()); + if (zkServer instanceof ReadOnlyZooKeeperServer) { + pw.println("READ-ONLY mode; serving only " + + "read-only clients"); + } if (len == statCmd) { LOG.info("Stat command output"); pw.println("Clients:"); @@ -591,6 +595,23 @@ public class NettyServerCnxn extends Ser } + private class IsroCommand extends CommandThread { + + public IsroCommand(PrintWriter pw) { + super(pw); + } + + @Override + public void commandRun() { + if (zkServer == null) { + pw.print("null"); + } else if (zkServer instanceof ReadOnlyZooKeeperServer) { + pw.print("ro"); + } else { + pw.print("rw"); + } + } + } /** Return if four letter word found and responded to, otw false **/ private boolean checkFourLetterWord(final Channel channel, @@ -663,6 +684,10 @@ public class NettyServerCnxn extends Ser MonitorCommand mntr = new MonitorCommand(pwriter); mntr.start(); return true; + } else if (len == isroCmd) { + IsroCommand isro = new IsroCommand(pwriter); + isro.start(); + return true; } return false; } Modified: zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ServerCnxn.java URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ServerCnxn.java?rev=1125176&r1=1125175&r2=1125176&view=diff ============================================================================== --- zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ServerCnxn.java (original) +++ zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ServerCnxn.java Thu May 19 23:17:48 2011 @@ -48,11 +48,18 @@ public abstract class ServerCnxn impleme protected ArrayList<Id> authInfo = new ArrayList<Id>(); + /** + * If the client is of old version, we don't send r-o mode info to it. + * The reason is that if we would, old C client doesn't read it, which + * results in TCP RST packet, i.e. "connection reset by peer". + */ + boolean isOldClient = true; + abstract int getSessionTimeout(); abstract void close(); - abstract void sendResponse(ReplyHeader h, Record r, String tag) + public abstract void sendResponse(ReplyHeader h, Record r, String tag) throws IOException; /* notify the client the session is closing and close/cleanup socket */ @@ -209,6 +216,13 @@ public abstract class ServerCnxn impleme protected final static int mntrCmd = ByteBuffer.wrap("mntr".getBytes()) .getInt(); + /* + * See <a href="{@docRoot}/../../../docs/zookeeperAdmin.html#sc_zkCommands"> + * Zk Admin</a>. this link is for all the commands. + */ + protected final static int isroCmd
{'source': 'Apache Software Foundation Public Mail Archives'}