Return-Path: X-Original-To: apmail-accumulo-dev-archive@www.apache.org Delivered-To: apmail-accumulo-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 977AD10DDD for ; Fri, 27 Dec 2013 22:02:39 +0000 (UTC) Received: (qmail 87070 invoked by uid 500); 27 Dec 2013 22:02:39 -0000 Delivered-To: apmail-accumulo-dev-archive@accumulo.apache.org Received: (qmail 87032 invoked by uid 500); 27 Dec 2013 22:02:39 -0000 Mailing-List: contact dev-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list dev@accumulo.apache.org Received: (qmail 87023 invoked by uid 99); 27 Dec 2013 22:02:39 -0000 Received: from reviews-vm.apache.org (HELO reviews.apache.org) (140.211.11.40) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Dec 2013 22:02:39 +0000 Received: from reviews.apache.org (localhost [127.0.0.1]) by reviews.apache.org (Postfix) with ESMTP id 865C51D410A; Fri, 27 Dec 2013 22:02:37 +0000 (UTC) Content-Type: multipart/alternative; boundary="===============3273625230119261638==" MIME-Version: 1.0 Subject: Re: Review Request 16485: ACCUMULO-2103 - Better ZooSession management From: "Bill Havanki" To: "Bill Havanki" , "accumulo" Date: Fri, 27 Dec 2013 22:02:37 -0000 Message-ID: <20131227220237.32283.8859@reviews.apache.org> X-ReviewBoard-URL: https://reviews.apache.org Auto-Submitted: auto-generated Sender: "Bill Havanki" X-ReviewGroup: accumulo X-ReviewRequest-URL: https://reviews.apache.org/r/16485/ X-Sender: "Bill Havanki" References: <20131227194349.32283.37277@reviews.apache.org> In-Reply-To: <20131227194349.32283.37277@reviews.apache.org> Reply-To: "Bill Havanki" X-ReviewRequest-Repository: accumulo --===============3273625230119261638== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/16485/#review30924 ----------------------------------------------------------- Note to reviewers: After chatting with Mike, this may be pushed to 1.7/2.0. - Bill Havanki On Dec. 27, 2013, 2:43 p.m., Bill Havanki wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/16485/ > ----------------------------------------------------------- > > (Updated Dec. 27, 2013, 2:43 p.m.) > > > Review request for accumulo. > > > Bugs: ACCUMULO-2103 > https://issues.apache.org/jira/browse/ACCUMULO-2103 > > > Repository: accumulo > > > Description > ------- > > This is the work on ZooSession to better support closure of ZK connections under ACCUMULO-2026 and/or future work. Here's a tour. > > First, the logic in ZooSession to connect to ZooKeeper was moved to a new ZooKeeperFactory class. This also makes it possible to mock the logic for unit tests, or swap in newer / better implementations later. The factory will throw a new ZooKeeperFactoryException (unchecked) for most problems, but does throw InterruptedException when appropriate (instead of eating it). Otherwise, the logic is the same. > > Before this, ZooSession was a set of static methods oriented around connecting to ZooKeeper. With this set of commits, ZooSession objects are used, each of which contains a ZooKeeper connection object as well as its key (formed and used as before). > > The ZooSession class still uses a static map of known sessions, so that the same connection may be reused by several clients. The map now also remembers the watcher object associated with the connection (possibly a prior oversight), and a reference count. Whenever a new connection is established or it is reused, the reference count is increased. When a session is closed, the reference count is decreased, and the connection itself is only closed when the reference count is depleted. Cleanup of closed session objects occurs as it did before, lazily upon request of a new one (see the removeIfClosed method). > > The getSession methods are deprecated since they return the actual ZK connection objects instead of sessions. In their place are open methods. The deprecated methods do not participate in reference counting. > > ZooSession now includes a clear method for simply wiping out its session tracking and a forceCloseAll method for forcibly closing all known connections. These methods are useful for ensuring that connections are wiped clean, so that it isn't necessary to hunt down and close all sessions before, say, a process exits. > > ZooReader was modified to remember the session that it is using (with its reference to the ZK connection) instead of continuously asking ZooSession for it. When a ZooReader is closed, it closes its session instead of closing the ZK connection itself; this allows the reference counting to work. > > This set of commits adds a unit test for ZooSession. ZooSession is defined to implement Closeable, but ZooReader is not. > > > Diffs > ----- > > src/core/pom.xml 77a4a72b3d32283e82d7a9d3b1b6b4690520c88e > src/core/src/main/java/org/apache/accumulo/core/zookeeper/ZooCache.java cbb39182e93c568363a58d7e3344b9b85337cfc0 > src/core/src/main/java/org/apache/accumulo/core/zookeeper/ZooKeeperFactory.java PRE-CREATION > src/core/src/main/java/org/apache/accumulo/core/zookeeper/ZooKeeperFactoryException.java PRE-CREATION > src/core/src/main/java/org/apache/accumulo/core/zookeeper/ZooReader.java aabc0f223bf2c6187e915b9a1e9569d714bce852 > src/core/src/main/java/org/apache/accumulo/core/zookeeper/ZooSession.java b3db26f107139c1e2854a545e3f1f11de1b28b02 > src/core/src/test/java/org/apache/accumulo/core/zookeeper/ZooSessionTest.java PRE-CREATION > > Diff: https://reviews.apache.org/r/16485/diff/ > > > Testing > ------- > > Unit tests; functional tests; continuous ingest. > > > Thanks, > > Bill Havanki > > --===============3273625230119261638==--