You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ec...@apache.org on 2013/11/19 18:37:06 UTC

[1/7] git commit: ACCUMULO-1901 treat the gc start/stop like the redundant masters

Updated Branches:
  refs/heads/master 4ba658750 -> c7f4398bc


ACCUMULO-1901 treat the gc start/stop like the redundant masters


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/4976a935
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/4976a935
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/4976a935

Branch: refs/heads/master
Commit: 4976a935f2566ee648d20c3bc5381bc22edc51ec
Parents: 32b6b65
Author: Eric Newton <er...@gmail.com>
Authored: Tue Nov 19 10:52:29 2013 -0500
Committer: Eric Newton <er...@gmail.com>
Committed: Tue Nov 19 10:52:29 2013 -0500

----------------------------------------------------------------------
 bin/start-here.sh | 2 +-
 bin/stop-all.sh   | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/4976a935/bin/start-here.sh
----------------------------------------------------------------------
diff --git a/bin/start-here.sh b/bin/start-here.sh
index 22c8a04..9bc44d8 100755
--- a/bin/start-here.sh
+++ b/bin/start-here.sh
@@ -47,7 +47,7 @@ done
 
 for host in $HOSTS
 do
-    if [ ${host} = ${GC} ]
+    if grep -q "^${host}\$" $ACCUMULO_CONF_DIR/slaves
     then
 	${bin}/start-server.sh $GC gc "garbage collector"
 	break

http://git-wip-us.apache.org/repos/asf/accumulo/blob/4976a935/bin/stop-all.sh
----------------------------------------------------------------------
diff --git a/bin/stop-all.sh b/bin/stop-all.sh
index a717e42..4afc36a 100755
--- a/bin/stop-all.sh
+++ b/bin/stop-all.sh
@@ -42,7 +42,10 @@ do
       ${bin}/stop-server.sh $master "$ACCUMULO_HOME/.*/accumulo-start.*.jar" master $signal
    done
 
-   ${bin}/stop-server.sh $GC "$ACCUMULO_HOME/.*/accumulo-start.*.jar" gc $signal
+   for gc in `grep -v '^#' "$ACCUMULO_CONF_DIR/gc"`
+   do
+      ${bin}/stop-server.sh $gc "$ACCUMULO_HOME/.*/accumulo-start.*.jar" gc $signal
+   done
 
    ${bin}/stop-server.sh $MONITOR "$ACCUMULO_HOME/.*/accumulo-start.*.jar" monitor $signal
 


[7/7] git commit: Merge branch '1.6.0-SNAPSHOT'

Posted by ec...@apache.org.
Merge branch '1.6.0-SNAPSHOT'


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/c7f4398b
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/c7f4398b
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/c7f4398b

Branch: refs/heads/master
Commit: c7f4398bc0baaed6b83c7303b46a4e4333d0f088
Parents: 4ba6587 3199c2a
Author: Eric Newton <er...@gmail.com>
Authored: Tue Nov 19 12:37:19 2013 -0500
Committer: Eric Newton <er...@gmail.com>
Committed: Tue Nov 19 12:37:19 2013 -0500

----------------------------------------------------------------------
 .../java/org/apache/accumulo/core/client/ZooKeeperInstance.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------



[2/7] git commit: ACCUMULO-1901 treat the gc start/stop like the redundant masters

Posted by ec...@apache.org.
ACCUMULO-1901 treat the gc start/stop like the redundant masters


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/ffb26a25
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/ffb26a25
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/ffb26a25

Branch: refs/heads/master
Commit: ffb26a25ffc94d28a9e1de93054ed5a8590cb943
Parents: 4976a93
Author: Eric Newton <er...@gmail.com>
Authored: Tue Nov 19 11:01:46 2013 -0500
Committer: Eric Newton <er...@gmail.com>
Committed: Tue Nov 19 11:01:46 2013 -0500

----------------------------------------------------------------------
 bin/config.sh     | 5 -----
 bin/start-here.sh | 4 ++--
 2 files changed, 2 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/ffb26a25/bin/config.sh
----------------------------------------------------------------------
diff --git a/bin/config.sh b/bin/config.sh
index 2d9e6fe..5836b46 100755
--- a/bin/config.sh
+++ b/bin/config.sh
@@ -26,7 +26,6 @@
 # 
 # Values always set by script.
 #  MALLOC_ARENA_MAX   To work around a memory management bug (see ACCUMULO-847)
-#  GC                 Machine to run GC daemon on.  Used by start-here.sh script
 #  MONITOR            Machine to run monitor daemon on. Used by start-here.sh script
 #  SSH                Default ssh parameters used to start daemons
 
@@ -121,11 +120,7 @@ then
     fi
 fi
 MASTER1=`grep -v '^#' "$ACCUMULO_CONF_DIR/masters" | head -1`
-GC=$MASTER1
 MONITOR=$MASTER1
-if [ -f "$ACCUMULO_CONF_DIR/gc" ]; then
-    GC=`grep -v '^#' "$ACCUMULO_CONF_DIR/gc" | head -1`
-fi
 if [ -f "$ACCUMULO_CONF_DIR/monitor" ]; then
     MONITOR=`grep -v '^#' "$ACCUMULO_CONF_DIR/monitor" | head -1`
 fi

http://git-wip-us.apache.org/repos/asf/accumulo/blob/ffb26a25/bin/start-here.sh
----------------------------------------------------------------------
diff --git a/bin/start-here.sh b/bin/start-here.sh
index 9bc44d8..990fb1c 100755
--- a/bin/start-here.sh
+++ b/bin/start-here.sh
@@ -47,9 +47,9 @@ done
 
 for host in $HOSTS
 do
-    if grep -q "^${host}\$" $ACCUMULO_CONF_DIR/slaves
+    if grep -q "^${host}\$" $ACCUMULO_CONF_DIR/gc
     then
-	${bin}/start-server.sh $GC gc "garbage collector"
+	${bin}/start-server.sh $host gc "garbage collector"
 	break
     fi
 done


[3/7] git commit: ACCUMULO-1901 treat the gc start/stop like the redundant masters

Posted by ec...@apache.org.
ACCUMULO-1901 treat the gc start/stop like the redundant masters


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/d8b4ba94
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/d8b4ba94
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/d8b4ba94

Branch: refs/heads/master
Commit: d8b4ba9424d5cb7b2f1260f63386b2c7f478b306
Parents: ffb26a2
Author: Eric Newton <er...@gmail.com>
Authored: Tue Nov 19 11:27:35 2013 -0500
Committer: Eric Newton <er...@gmail.com>
Committed: Tue Nov 19 11:27:35 2013 -0500

----------------------------------------------------------------------
 bin/start-all.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/d8b4ba94/bin/start-all.sh
----------------------------------------------------------------------
diff --git a/bin/start-all.sh b/bin/start-all.sh
index 5bee329..278e7b9 100755
--- a/bin/start-all.sh
+++ b/bin/start-all.sh
@@ -52,7 +52,10 @@ do
     ${bin}/start-server.sh $master master
 done
 
-${bin}/start-server.sh $GC gc "garbage collector"
+for gc in `grep -v '^#' "$ACCUMULO_CONF_DIR/gc"`
+do
+    ${bin}/start-server.sh $gc gc "garbage collector"
+done
 
 ${bin}/start-server.sh $MONITOR monitor 
 


[6/7] git commit: Merge branch '1.5.1-SNAPSHOT' into 1.6.0-SNAPSHOT

Posted by ec...@apache.org.
Merge branch '1.5.1-SNAPSHOT' into 1.6.0-SNAPSHOT


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/3199c2a1
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/3199c2a1
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/3199c2a1

Branch: refs/heads/master
Commit: 3199c2a11fa07879cbec1fc853f1fd8c81e55702
Parents: 3875de3 487eec3
Author: Eric Newton <er...@gmail.com>
Authored: Tue Nov 19 12:35:04 2013 -0500
Committer: Eric Newton <er...@gmail.com>
Committed: Tue Nov 19 12:35:04 2013 -0500

----------------------------------------------------------------------
 .../java/org/apache/accumulo/core/client/ZooKeeperInstance.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/3199c2a1/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
----------------------------------------------------------------------


[4/7] git commit: ACCUMULO-1889 mark ZKI as closed once close() is called.

Posted by ec...@apache.org.
ACCUMULO-1889 mark ZKI as closed once close() is called.

Once a given ZKI has .close() called, mark that instance closed regardless of outstanding client count.

Signed-off-by: Eric Newton <er...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/ada41803
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/ada41803
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/ada41803

Branch: refs/heads/master
Commit: ada4180379d46297c1531cf8065de5030d12953d
Parents: d8b4ba9
Author: Sean Busbey <bu...@clouderagovt.com>
Authored: Wed Nov 13 10:58:15 2013 -0600
Committer: Eric Newton <er...@gmail.com>
Committed: Tue Nov 19 12:30:24 2013 -0500

----------------------------------------------------------------------
 .../java/org/apache/accumulo/core/client/ZooKeeperInstance.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/ada41803/src/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
----------------------------------------------------------------------
diff --git a/src/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java b/src/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
index 1dae711..069d217 100644
--- a/src/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
+++ b/src/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
@@ -306,8 +306,8 @@ public class ZooKeeperInstance implements Instance {
         clientInstances.incrementAndGet();
         throw new AccumuloException("Issues closing ZooKeeper.");
       }
-      closed = true;
     }
+    closed = true;
   }
 
   @Override


[5/7] git commit: ACCUMULO-1901 treat the gc start/stop like the redundant masters

Posted by ec...@apache.org.
ACCUMULO-1901 treat the gc start/stop like the redundant masters


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/487eec38
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/487eec38
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/487eec38

Branch: refs/heads/master
Commit: 487eec38f41429c61aca2699b44c349c1836bc7d
Parents: 6f07d7a ada4180
Author: Eric Newton <er...@gmail.com>
Authored: Tue Nov 19 12:34:40 2013 -0500
Committer: Eric Newton <er...@gmail.com>
Committed: Tue Nov 19 12:34:40 2013 -0500

----------------------------------------------------------------------
 .../java/org/apache/accumulo/core/client/ZooKeeperInstance.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/487eec38/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
----------------------------------------------------------------------
diff --cc core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
index 87f3a78,0000000..c260947
mode 100644,000000..100644
--- a/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
@@@ -1,352 -1,0 +1,352 @@@
 +/*
 + * 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.accumulo.core.client;
 +
 +import java.io.FileNotFoundException;
 +import java.io.IOException;
 +import java.nio.ByteBuffer;
 +import java.util.Collections;
 +import java.util.List;
 +import java.util.UUID;
 +import java.util.concurrent.atomic.AtomicInteger;
 +
 +import org.apache.accumulo.core.Constants;
 +import org.apache.accumulo.core.client.impl.ConnectorImpl;
 +import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
 +import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 +import org.apache.accumulo.core.conf.AccumuloConfiguration;
 +import org.apache.accumulo.core.conf.Property;
 +import org.apache.accumulo.core.file.FileUtil;
 +import org.apache.accumulo.core.security.CredentialHelper;
 +import org.apache.accumulo.core.security.thrift.TCredentials;
 +import org.apache.accumulo.core.util.ArgumentChecker;
 +import org.apache.accumulo.core.util.ByteBufferUtil;
 +import org.apache.accumulo.core.util.CachedConfiguration;
 +import org.apache.accumulo.core.util.OpTimer;
 +import org.apache.accumulo.core.util.TextUtil;
 +import org.apache.accumulo.core.util.ThriftUtil;
 +import org.apache.accumulo.core.zookeeper.ZooUtil;
 +import org.apache.accumulo.fate.zookeeper.ZooCache;
 +import org.apache.hadoop.fs.FileStatus;
 +import org.apache.hadoop.fs.FileSystem;
 +import org.apache.hadoop.fs.Path;
 +import org.apache.hadoop.io.Text;
 +import org.apache.log4j.Level;
 +import org.apache.log4j.Logger;
 +
 +/**
 + * <p>
 + * An implementation of instance that looks in zookeeper to find information needed to connect to an instance of accumulo.
 + * 
 + * <p>
 + * The advantage of using zookeeper to obtain information about accumulo is that zookeeper is highly available, very responsive, and supports caching.
 + * 
 + * <p>
 + * Because it is possible for multiple instances of accumulo to share a single set of zookeeper servers, all constructors require an accumulo instance name.
 + * 
 + * If you do not know the instance names then run accumulo org.apache.accumulo.server.util.ListInstances on an accumulo server.
 + * 
 + */
 +
 +public class ZooKeeperInstance implements Instance {
 +
 +  private static final Logger log = Logger.getLogger(ZooKeeperInstance.class);
 +
 +  private String instanceId = null;
 +  private String instanceName = null;
 +
 +  private final ZooCache zooCache;
 +
 +  private final String zooKeepers;
 +
 +  private final int zooKeepersSessionTimeOut;
 +
 +  private volatile boolean closed = false;
 +
 +  /**
 +   * 
 +   * @param instanceName
 +   *          The name of specific accumulo instance. This is set at initialization time.
 +   * @param zooKeepers
 +   *          A comma separated list of zoo keeper server locations. Each location can contain an optional port, of the format host:port.
 +   */
 +
 +  public ZooKeeperInstance(String instanceName, String zooKeepers) {
 +    this(instanceName, zooKeepers, (int) AccumuloConfiguration.getDefaultConfiguration().getTimeInMillis(Property.INSTANCE_ZK_TIMEOUT));
 +  }
 +
 +  /**
 +   * 
 +   * @param instanceName
 +   *          The name of specific accumulo instance. This is set at initialization time.
 +   * @param zooKeepers
 +   *          A comma separated list of zoo keeper server locations. Each location can contain an optional port, of the format host:port.
 +   * @param sessionTimeout
 +   *          zoo keeper session time out in milliseconds.
 +   */
 +
 +  public ZooKeeperInstance(String instanceName, String zooKeepers, int sessionTimeout) {
 +    ArgumentChecker.notNull(instanceName, zooKeepers);
 +    this.instanceName = instanceName;
 +    this.zooKeepers = zooKeepers;
 +    this.zooKeepersSessionTimeOut = sessionTimeout;
 +    zooCache = ZooCache.getInstance(zooKeepers, sessionTimeout);
 +    getInstanceID();
 +    clientInstances.incrementAndGet();
 +  }
 +
 +  /**
 +   * 
 +   * @param instanceId
 +   *          The UUID that identifies the accumulo instance you want to connect to.
 +   * @param zooKeepers
 +   *          A comma separated list of zoo keeper server locations. Each location can contain an optional port, of the format host:port.
 +   */
 +
 +  public ZooKeeperInstance(UUID instanceId, String zooKeepers) {
 +    this(instanceId, zooKeepers, (int) AccumuloConfiguration.getDefaultConfiguration().getTimeInMillis(Property.INSTANCE_ZK_TIMEOUT));
 +  }
 +
 +  /**
 +   * 
 +   * @param instanceId
 +   *          The UUID that identifies the accumulo instance you want to connect to.
 +   * @param zooKeepers
 +   *          A comma separated list of zoo keeper server locations. Each location can contain an optional port, of the format host:port.
 +   * @param sessionTimeout
 +   *          zoo keeper session time out in milliseconds.
 +   */
 +
 +  public ZooKeeperInstance(UUID instanceId, String zooKeepers, int sessionTimeout) {
 +    ArgumentChecker.notNull(instanceId, zooKeepers);
 +    this.instanceId = instanceId.toString();
 +    this.zooKeepers = zooKeepers;
 +    this.zooKeepersSessionTimeOut = sessionTimeout;
 +    zooCache = ZooCache.getInstance(zooKeepers, sessionTimeout);
 +    clientInstances.incrementAndGet();
 +  }
 +
 +  @Override
 +  public String getInstanceID() {
 +    if (closed)
 +      throw new RuntimeException("ZooKeeperInstance has been closed.");
 +    if (instanceId == null) {
 +      // want the instance id to be stable for the life of this instance object,
 +      // so only get it once
 +      String instanceNamePath = Constants.ZROOT + Constants.ZINSTANCES + "/" + instanceName;
 +      byte[] iidb = zooCache.get(instanceNamePath);
 +      if (iidb == null) {
 +        throw new RuntimeException("Instance name " + instanceName
 +            + " does not exist in zookeeper.  Run \"accumulo org.apache.accumulo.server.util.ListInstances\" to see a list.");
 +      }
 +      instanceId = new String(iidb);
 +    }
 +
 +    if (zooCache.get(Constants.ZROOT + "/" + instanceId) == null) {
 +      if (instanceName == null)
 +        throw new RuntimeException("Instance id " + instanceId + " does not exist in zookeeper");
 +      throw new RuntimeException("Instance id " + instanceId + " pointed to by the name " + instanceName + " does not exist in zookeeper");
 +    }
 +
 +    return instanceId;
 +  }
 +
 +  @Override
 +  public List<String> getMasterLocations() {
 +    if (closed)
 +      throw new RuntimeException("ZooKeeperInstance has been closed.");
 +    String masterLocPath = ZooUtil.getRoot(this) + Constants.ZMASTER_LOCK;
 +
 +    OpTimer opTimer = new OpTimer(log, Level.TRACE).start("Looking up master location in zoocache.");
 +    byte[] loc = ZooUtil.getLockData(zooCache, masterLocPath);
 +    opTimer.stop("Found master at " + (loc == null ? null : new String(loc)) + " in %DURATION%");
 +
 +    if (loc == null) {
 +      return Collections.emptyList();
 +    }
 +
 +    return Collections.singletonList(new String(loc));
 +  }
 +
 +  @Override
 +  public String getRootTabletLocation() {
 +    if (closed)
 +      throw new RuntimeException("ZooKeeperInstance has been closed.");
 +    String zRootLocPath = ZooUtil.getRoot(this) + Constants.ZROOT_TABLET_LOCATION;
 +
 +    OpTimer opTimer = new OpTimer(log, Level.TRACE).start("Looking up root tablet location in zookeeper.");
 +    byte[] loc = zooCache.get(zRootLocPath);
 +    opTimer.stop("Found root tablet at " + (loc == null ? null : new String(loc)) + " in %DURATION%");
 +
 +    if (loc == null) {
 +      return null;
 +    }
 +
 +    return new String(loc).split("\\|")[0];
 +  }
 +
 +  @Override
 +  public String getInstanceName() {
 +    if (closed)
 +      throw new RuntimeException("ZooKeeperInstance has been closed.");
 +    if (instanceName == null)
 +      instanceName = lookupInstanceName(zooCache, UUID.fromString(getInstanceID()));
 +
 +    return instanceName;
 +  }
 +
 +  @Override
 +  public String getZooKeepers() {
 +    return zooKeepers;
 +  }
 +
 +  @Override
 +  public int getZooKeepersSessionTimeOut() {
 +    return zooKeepersSessionTimeOut;
 +  }
 +
 +  @Override
 +  @Deprecated
 +  public Connector getConnector(String user, CharSequence pass) throws AccumuloException, AccumuloSecurityException {
 +    return getConnector(user, TextUtil.getBytes(new Text(pass.toString())));
 +  }
 +
 +  @Override
 +  @Deprecated
 +  public Connector getConnector(String user, ByteBuffer pass) throws AccumuloException, AccumuloSecurityException {
 +    return getConnector(user, ByteBufferUtil.toBytes(pass));
 +  }
 +
 +  @Override
 +  public Connector getConnector(String principal, AuthenticationToken token) throws AccumuloException, AccumuloSecurityException {
 +    return getConnector(CredentialHelper.create(principal, token, getInstanceID()));
 +  }
 +  
 +  @SuppressWarnings("deprecation")
 +  private Connector getConnector(TCredentials credential) throws AccumuloException, AccumuloSecurityException {
 +    return new ConnectorImpl(this, credential);
 +  }
 +  
 +  @Override
 +  @Deprecated
 +  public Connector getConnector(String principal, byte[] pass) throws AccumuloException, AccumuloSecurityException {
 +    if (closed) {
 +      throw new RuntimeException("ZooKeeperInstance has been closed.");
 +    } else {
 +      return getConnector(principal, new PasswordToken(pass));
 +    }
 +  }
 +
 +  private AccumuloConfiguration conf = null;
 +
 +  @Override
 +  public AccumuloConfiguration getConfiguration() {
 +    if (conf == null)
 +      conf = AccumuloConfiguration.getDefaultConfiguration();
 +    return conf;
 +  }
 +
 +  @Override
 +  public void setConfiguration(AccumuloConfiguration conf) {
 +    this.conf = conf;
 +  }
 +
 +  /**
 +   * @deprecated Use {@link #lookupInstanceName(org.apache.accumulo.fate.zookeeper.ZooCache, UUID)} instead
 +   */
 +  @Deprecated
 +  public static String lookupInstanceName(org.apache.accumulo.core.zookeeper.ZooCache zooCache, UUID instanceId) {
 +    return lookupInstanceName((ZooCache) zooCache, instanceId);
 +  }
 +  
 +  /**
 +   * Given a zooCache and instanceId, look up the instance name.
 +   * 
 +   * @param zooCache
 +   * @param instanceId
 +   * @return the instance name
 +   */
 +  public static String lookupInstanceName(ZooCache zooCache, UUID instanceId) {
 +    ArgumentChecker.notNull(zooCache, instanceId);
 +    for (String name : zooCache.getChildren(Constants.ZROOT + Constants.ZINSTANCES)) {
 +      String instanceNamePath = Constants.ZROOT + Constants.ZINSTANCES + "/" + name;
 +      UUID iid = UUID.fromString(new String(zooCache.get(instanceNamePath)));
 +      if (iid.equals(instanceId)) {
 +        return name;
 +      }
 +    }
 +    return null;
 +  }
 +  
 +  /**
 +   * To be moved to server code. Only lives here to support certain client side utilities to minimize command-line options.
 +   */
 +  @Deprecated
 +  public static String getInstanceIDFromHdfs(Path instanceDirectory) {
 +    try {
 +      FileSystem fs = FileUtil.getFileSystem(CachedConfiguration.getInstance(), AccumuloConfiguration.getSiteConfiguration());
 +      FileStatus[] files = null;
 +      try {
 +        files = fs.listStatus(instanceDirectory);
 +      } catch (FileNotFoundException ex) {
 +        // ignored
 +      }
 +      log.debug("Trying to read instance id from " + instanceDirectory);
 +      if (files == null || files.length == 0) {
 +        log.error("unable obtain instance id at " + instanceDirectory);
 +        throw new RuntimeException("Accumulo not initialized, there is no instance id at " + instanceDirectory);
 +      } else if (files.length != 1) {
 +        log.error("multiple potential instances in " + instanceDirectory);
 +        throw new RuntimeException("Accumulo found multiple possible instance ids in " + instanceDirectory);
 +      } else {
 +        String result = files[0].getPath().getName();
 +        return result;
 +      }
 +    } catch (IOException e) {
 +      throw new RuntimeException("Accumulo not initialized, there is no instance id at " + instanceDirectory, e);
 +    }
 +  }
 +  
 +  @Deprecated
 +  @Override
 +  public Connector getConnector(org.apache.accumulo.core.security.thrift.AuthInfo auth) throws AccumuloException, AccumuloSecurityException {
 +    return getConnector(auth.user, auth.password);
 +  }
 +
 +  static private final AtomicInteger clientInstances = new AtomicInteger(0);
 +
 +  @Override
 +  public synchronized void close() throws AccumuloException {
 +    if (!closed && clientInstances.decrementAndGet() == 0) {
 +      try {
 +        zooCache.close();
 +        ThriftUtil.close();
 +      } catch (InterruptedException e) {
 +        clientInstances.incrementAndGet();
 +        throw new AccumuloException("Issues closing ZooKeeper.");
 +      }
-       closed = true;
 +    }
++    closed = true;
 +  }
 +
 +  @Override
 +  public void finalize() {
 +    // This method intentionally left blank. Users need to explicitly close Instances if they want things cleaned up nicely.
 +    if (!closed)
 +      log.warn("ZooKeeperInstance being cleaned up without being closed. Please remember to call close() before dereferencing to clean up threads.");
 +  }
 +}