accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mwa...@apache.org
Subject [accumulo] branch master updated: Removed usage of Instance (#565)
Date Thu, 19 Jul 2018 16:45:07 GMT
This is an automated email from the ASF dual-hosted git repository.

mwalch pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/master by this push:
     new 223e239  Removed usage of Instance (#565)
223e239 is described below

commit 223e239ec8e51a831a753188c290075945132cec
Author: Mike Walch <mwalch@apache.org>
AuthorDate: Thu Jul 19 12:45:04 2018 -0400

    Removed usage of Instance (#565)
---
 .../accumulo/core/client/impl/Namespace.java       |  4 +--
 .../core/client/impl/NamespaceOperationsImpl.java  |  6 ++--
 .../accumulo/core/client/impl/Namespaces.java      | 40 +++++++++++++---------
 .../accumulo/core/client/impl/OfflineIterator.java |  2 +-
 .../apache/accumulo/core/client/impl/Table.java    |  4 +--
 .../core/client/impl/TableOperationsImpl.java      | 10 +++---
 .../apache/accumulo/core/client/impl/Tables.java   | 29 ++++++++--------
 .../java/org/apache/accumulo/core/util/Merge.java  |  4 ++-
 .../org/apache/accumulo/server/cli/ClientOpts.java |  5 +++
 .../server/client/ClientServiceHandler.java        | 37 ++++++++++----------
 .../accumulo/server/log/WalStateManager.java       | 10 +++---
 .../server/replication/ReplicationUtil.java        |  2 +-
 .../server/security/AuditedSecurityOperation.java  |  2 +-
 .../accumulo/server/util/ListVolumesUsed.java      | 12 +++----
 .../accumulo/server/util/TableDiskUsage.java       |  7 ++--
 .../server/util/VerifyTabletAssignments.java       |  2 +-
 .../accumulo/gc/GarbageCollectWriteAheadLogs.java  |  2 +-
 .../apache/accumulo/gc/SimpleGarbageCollector.java |  2 +-
 .../replication/CloseWriteAheadLogReferences.java  |  8 ++---
 .../apache/accumulo/master/FateServiceHandler.java | 36 +++++++------------
 .../java/org/apache/accumulo/master/Master.java    | 10 +++---
 .../master/MasterClientServiceHandler.java         | 16 ++++-----
 .../apache/accumulo/master/TabletGroupWatcher.java |  2 +-
 .../accumulo/master/tableOps/ClonePermissions.java |  2 +-
 .../accumulo/master/tableOps/CloneZookeeper.java   | 11 +++---
 .../master/tableOps/ImportPopulateZookeeper.java   |  4 +--
 .../master/tableOps/PopulateZookeeper.java         |  2 +-
 .../tableOps/PopulateZookeeperWithNamespace.java   |  9 ++---
 .../accumulo/master/tableOps/RenameNamespace.java  |  7 ++--
 .../accumulo/master/tableOps/RenameTable.java      |  6 ++--
 .../org/apache/accumulo/master/tableOps/Utils.java |  9 ++---
 .../monitor/rest/problems/ProblemsResource.java    |  6 ++--
 .../rest/replication/ReplicationResource.java      |  2 +-
 .../monitor/rest/tables/TablesResource.java        |  3 +-
 .../rest/tservers/TabletServerResource.java        |  3 +-
 .../org/apache/accumulo/monitor/view/WebViews.java |  3 +-
 .../org/apache/accumulo/monitor/it/WebViewsIT.java |  2 +-
 .../org/apache/accumulo/tserver/TabletServer.java  |  4 +--
 .../org/apache/accumulo/tserver/log/LogSorter.java | 10 +++---
 .../accumulo/shell/commands/ConfigCommand.java     |  4 +--
 .../apache/accumulo/shell/commands/DUCommand.java  |  6 ++--
 .../shell/commands/DeleteNamespaceCommand.java     |  4 +--
 .../shell/commands/RenameNamespaceCommand.java     |  8 ++---
 .../accumulo/shell/commands/TableOperation.java    |  8 ++---
 .../java/org/apache/accumulo/test/ListTables.java  |  2 +-
 .../java/org/apache/accumulo/test/UnusedWALIT.java | 10 +++---
 .../java/org/apache/accumulo/test/VolumeIT.java    |  2 +-
 .../test/functional/ConfigurableMacBase.java       |  5 +++
 .../functional/TabletStateChangeIteratorIT.java    |  2 +-
 .../accumulo/test/functional/WALSunnyDayIT.java    | 26 +++++++-------
 ...GarbageCollectorCommunicatesWithTServersIT.java |  5 +--
 .../accumulo/test/replication/ReplicationIT.java   | 21 +++++++-----
 .../replication/ReplicationOperationsImplIT.java   |  2 +-
 53 files changed, 219 insertions(+), 221 deletions(-)

diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/Namespace.java b/core/src/main/java/org/apache/accumulo/core/client/impl/Namespace.java
index db5d838..afaeea2 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/Namespace.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/Namespace.java
@@ -18,8 +18,6 @@ package org.apache.accumulo.core.client.impl;
 
 import java.util.concurrent.ExecutionException;
 
-import org.apache.accumulo.core.client.Instance;
-
 import com.google.common.cache.Cache;
 import com.google.common.cache.CacheBuilder;
 
@@ -31,7 +29,7 @@ public class Namespace {
   /**
    * Object representing an internal Namespace ID. This class was created to help with type safety.
    * For help obtaining the value of a namespace ID from Zookeeper, see
-   * {@link Namespaces#getNamespaceId(Instance, String)}
+   * {@link Namespaces#getNamespaceId(ClientContext, String)}
    *
    * Uses an internal cache and private constructor for storing a WeakReference of every
    * Namespace.ID. Therefore, a Namespace.ID can't be instantiated outside this class and is
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java
index ec45d90..c397a0f 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java
@@ -100,7 +100,7 @@ public class NamespaceOperationsImpl extends NamespaceOperationsHelper {
       timer = new OpTimer().start();
     }
 
-    boolean exists = Namespaces.namespaceNameExists(context.getInstance(), namespace);
+    boolean exists = Namespaces.namespaceNameExists(context, namespace);
 
     if (timer != null) {
       timer.stop();
@@ -130,7 +130,7 @@ public class NamespaceOperationsImpl extends NamespaceOperationsHelper {
   public void delete(String namespace) throws AccumuloException, AccumuloSecurityException,
       NamespaceNotFoundException, NamespaceNotEmptyException {
     checkArgument(namespace != null, "namespace is null");
-    Namespace.ID namespaceId = Namespaces.getNamespaceId(context.getInstance(), namespace);
+    Namespace.ID namespaceId = Namespaces.getNamespaceId(context, namespace);
 
     if (namespaceId.equals(Namespace.ID.ACCUMULO) || namespaceId.equals(Namespace.ID.DEFAULT)) {
       Credentials credentials = context.getCredentials();
@@ -139,7 +139,7 @@ public class NamespaceOperationsImpl extends NamespaceOperationsHelper {
           SecurityErrorCode.UNSUPPORTED_OPERATION);
     }
 
-    if (Namespaces.getTableIds(context.getInstance(), namespaceId).size() > 0) {
+    if (Namespaces.getTableIds(context, namespaceId).size() > 0) {
       throw new NamespaceNotEmptyException(namespaceId.canonicalID(), namespace, null);
     }
 
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/Namespaces.java b/core/src/main/java/org/apache/accumulo/core/client/impl/Namespaces.java
index 40e95cf..d2a6f21 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/Namespaces.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/Namespaces.java
@@ -84,27 +84,28 @@ public class Namespaces {
         instance.getZooKeepersSessionTimeOut());
   }
 
-  public static boolean exists(Instance instance, Namespace.ID namespaceId) {
-    ZooCache zc = getZooCache(instance);
-    List<String> namespaceIds = zc.getChildren(ZooUtil.getRoot(instance) + Constants.ZNAMESPACES);
+  public static boolean exists(ClientContext context, Namespace.ID namespaceId) {
+    ZooCache zc = getZooCache(context.getInstance());
+    List<String> namespaceIds = zc
+        .getChildren(ZooUtil.getRoot(context.getInstance()) + Constants.ZNAMESPACES);
     return namespaceIds.contains(namespaceId.canonicalID());
   }
 
-  public static List<Table.ID> getTableIds(Instance instance, Namespace.ID namespaceId)
+  public static List<Table.ID> getTableIds(ClientContext context, Namespace.ID namespaceId)
       throws NamespaceNotFoundException {
-    String namespace = getNamespaceName(instance, namespaceId);
+    String namespace = getNamespaceName(context, namespaceId);
     List<Table.ID> tableIds = new LinkedList<>();
-    for (Entry<String,Table.ID> nameToId : Tables.getNameToIdMap(instance).entrySet())
+    for (Entry<String,Table.ID> nameToId : Tables.getNameToIdMap(context).entrySet())
       if (namespace.equals(Tables.qualify(nameToId.getKey()).getFirst()))
         tableIds.add(nameToId.getValue());
     return tableIds;
   }
 
-  public static List<String> getTableNames(Instance instance, Namespace.ID namespaceId)
+  public static List<String> getTableNames(ClientContext context, Namespace.ID namespaceId)
       throws NamespaceNotFoundException {
-    String namespace = getNamespaceName(instance, namespaceId);
+    String namespace = getNamespaceName(context.getInstance(), namespaceId);
     List<String> names = new LinkedList<>();
-    for (String name : Tables.getNameToIdMap(instance).keySet())
+    for (String name : Tables.getNameToIdMap(context).keySet())
       if (namespace.equals(Tables.qualify(name).getFirst()))
         names.add(name);
     return names;
@@ -129,9 +130,9 @@ public class Namespaces {
   /**
    * Return sorted map with key = ID, value = namespaceName
    */
-  public static SortedMap<Namespace.ID,String> getIdToNameMap(Instance instance) {
+  public static SortedMap<Namespace.ID,String> getIdToNameMap(ClientContext context) {
     SortedMap<Namespace.ID,String> idMap = new TreeMap<>();
-    getAllNamespaces(instance, (id, name) -> idMap.put(Namespace.ID.of(id), name));
+    getAllNamespaces(context.getInstance(), (id, name) -> idMap.put(Namespace.ID.of(id), name));
     return idMap;
   }
 
@@ -147,10 +148,10 @@ public class Namespaces {
   /**
    * Look for namespace ID in ZK. Throw NamespaceNotFoundException if not found.
    */
-  public static Namespace.ID getNamespaceId(Instance instance, String namespaceName)
+  public static Namespace.ID getNamespaceId(ClientContext context, String namespaceName)
       throws NamespaceNotFoundException {
     final ArrayList<Namespace.ID> singleId = new ArrayList<>(1);
-    getAllNamespaces(instance, (id, name) -> {
+    getAllNamespaces(context.getInstance(), (id, name) -> {
       if (name.equals(namespaceName))
         singleId.add(Namespace.ID.of(id));
     });
@@ -163,10 +164,10 @@ public class Namespaces {
   /**
    * Look for namespace ID in ZK. Fail quietly by logging and returning null.
    */
-  public static Namespace.ID lookupNamespaceId(Instance instance, String namespaceName) {
+  public static Namespace.ID lookupNamespaceId(ClientContext context, String namespaceName) {
     Namespace.ID id = null;
     try {
-      id = getNamespaceId(instance, namespaceName);
+      id = getNamespaceId(context, namespaceName);
     } catch (NamespaceNotFoundException e) {
       if (log.isDebugEnabled())
         log.debug("Failed to find namespace ID from name: " + namespaceName, e);
@@ -177,13 +178,18 @@ public class Namespaces {
   /**
    * Return true if namespace name exists
    */
-  public static boolean namespaceNameExists(Instance instance, String namespaceName) {
-    return lookupNamespaceId(instance, namespaceName) != null;
+  public static boolean namespaceNameExists(ClientContext context, String namespaceName) {
+    return lookupNamespaceId(context, namespaceName) != null;
   }
 
   /**
    * Look for namespace name in ZK. Throw NamespaceNotFoundException if not found.
    */
+  public static String getNamespaceName(ClientContext context, Namespace.ID namespaceId)
+      throws NamespaceNotFoundException {
+    return getNamespaceName(context.getInstance(), namespaceId);
+  }
+
   public static String getNamespaceName(Instance instance, Namespace.ID namespaceId)
       throws NamespaceNotFoundException {
     String name;
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineIterator.java b/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineIterator.java
index 2418554..af5626d 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineIterator.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineIterator.java
@@ -334,7 +334,7 @@ class OfflineIterator implements Iterator<Entry<Key,Value>> {
     // TODO share code w/ tablet - ACCUMULO-1303
 
     // possible race condition here, if table is renamed
-    String tableName = Tables.getTableName(conn.getInstance(), tableId);
+    String tableName = Tables.getTableName(context, tableId);
     AccumuloConfiguration acuTableConf = new ConfigurationCopy(
         conn.tableOperations().getProperties(tableName));
 
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/Table.java b/core/src/main/java/org/apache/accumulo/core/client/impl/Table.java
index 23b083b..11c6459 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/Table.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/Table.java
@@ -18,8 +18,6 @@ package org.apache.accumulo.core.client.impl;
 
 import java.util.concurrent.ExecutionException;
 
-import org.apache.accumulo.core.client.Instance;
-
 import com.google.common.cache.Cache;
 import com.google.common.cache.CacheBuilder;
 
@@ -28,7 +26,7 @@ public class Table {
   /**
    * Object representing an internal table ID. This class was created to help with type safety. For
    * help obtaining the value of a table ID from Zookeeper, see
-   * {@link Tables#getTableId(Instance, String)}
+   * {@link Tables#getTableId(ClientContext, String)}
    *
    * Uses an internal cache and private constructor for storing a WeakReference of every Table.ID.
    * Therefore, a Table.ID can't be instantiated outside this class and is accessed by calling
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
index 6ed44a8..1f62817 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
@@ -165,8 +165,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
       timer = new OpTimer().start();
     }
 
-    TreeSet<String> tableNames = new TreeSet<>(
-        Tables.getNameToIdMap(context.getInstance()).keySet());
+    TreeSet<String> tableNames = new TreeSet<>(Tables.getNameToIdMap(context).keySet());
 
     if (timer != null) {
       timer.stop();
@@ -190,7 +189,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
       timer = new OpTimer().start();
     }
 
-    boolean exists = Tables.getNameToIdMap(context.getInstance()).containsKey(tableName);
+    boolean exists = Tables.getNameToIdMap(context).containsKey(tableName);
 
     if (timer != null) {
       timer.stop();
@@ -363,8 +362,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
           throw new NamespaceNotFoundException(null, tableOrNamespaceName,
               "Target namespace does not exist");
         default:
-          String tableInfo = Tables.getPrintableTableInfoFromName(context.getInstance(),
-              tableOrNamespaceName);
+          String tableInfo = Tables.getPrintableTableInfoFromName(context, tableOrNamespaceName);
           throw new AccumuloSecurityException(e.user, e.code, tableInfo, e);
       }
     } catch (ThriftTableOperationException e) {
@@ -1404,7 +1402,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
 
   @Override
   public Map<String,String> tableIdMap() {
-    return Tables.getNameToIdMap(context.getInstance()).entrySet().stream()
+    return Tables.getNameToIdMap(context).entrySet().stream()
         .collect(Collectors.toMap(Entry::getKey, e -> e.getValue().canonicalID(), (v1, v2) -> {
           throw new RuntimeException(String.format("Duplicate key for values %s and %s", v1, v2));
         }, TreeMap::new));
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java b/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java
index 63e9316..94d6067 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java
@@ -59,13 +59,8 @@ public class Tables {
 
   public static Table.ID getTableId(ClientContext context, String tableName)
       throws TableNotFoundException {
-    return getTableId(context.getInstance(), tableName);
-  }
-
-  public static Table.ID getTableId(Instance instance, String tableName)
-      throws TableNotFoundException {
     try {
-      return _getTableId(instance, tableName);
+      return _getTableId(context, tableName);
     } catch (NamespaceNotFoundException e) {
       throw new TableNotFoundException(tableName, e);
     }
@@ -98,17 +93,17 @@ public class Tables {
   /**
    * Lookup table ID in ZK. If not found, clears cache and tries again.
    */
-  public static Table.ID _getTableId(Instance instance, String tableName)
+  public static Table.ID _getTableId(ClientContext context, String tableName)
       throws NamespaceNotFoundException, TableNotFoundException {
-    Table.ID tableId = getNameToIdMap(instance).get(tableName);
+    Table.ID tableId = getNameToIdMap(context).get(tableName);
     if (tableId == null) {
       // maybe the table exist, but the cache was not updated yet... so try to clear the cache and
       // check again
-      clearCache(instance);
-      tableId = getNameToIdMap(instance).get(tableName);
+      clearCache(context.getInstance());
+      tableId = getNameToIdMap(context).get(tableName);
       if (tableId == null) {
         String namespace = qualify(tableName).getFirst();
-        if (Namespaces.getNameToIdMap(instance).containsKey(namespace))
+        if (Namespaces.getNameToIdMap(context.getInstance()).containsKey(namespace))
           throw new TableNotFoundException(null, tableName, null);
         else
           throw new NamespaceNotFoundException(null, namespace, null);
@@ -145,8 +140,12 @@ public class Tables {
     }
   }
 
-  public static Map<String,Table.ID> getNameToIdMap(Instance instance) {
-    return getTableMap(instance).getNameToIdMap();
+  public static Map<String,Table.ID> getNameToIdMap(ClientContext context) {
+    return getTableMap(context.getInstance()).getNameToIdMap();
+  }
+
+  public static Map<Table.ID,String> getIdToNameMap(ClientContext context) {
+    return getIdToNameMap(context.getInstance());
   }
 
   public static Map<Table.ID,String> getIdToNameMap(Instance instance) {
@@ -218,10 +217,10 @@ public class Tables {
         : String.format("%s(ID:%s)", tableName, tableId.canonicalID());
   }
 
-  public static String getPrintableTableInfoFromName(Instance instance, String tableName) {
+  public static String getPrintableTableInfoFromName(ClientContext context, String tableName) {
     Table.ID tableId = null;
     try {
-      tableId = getTableId(instance, tableName);
+      tableId = getTableId(context, tableName);
     } catch (TableNotFoundException e) {
       // handled in the string formatting
     }
diff --git a/core/src/main/java/org/apache/accumulo/core/util/Merge.java b/core/src/main/java/org/apache/accumulo/core/util/Merge.java
index 2431c8f..81bd29b 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/Merge.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/Merge.java
@@ -24,6 +24,7 @@ import java.util.Map.Entry;
 import org.apache.accumulo.core.cli.ClientOnRequiredTable;
 import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.Scanner;
+import org.apache.accumulo.core.client.impl.ClientContext;
 import org.apache.accumulo.core.client.impl.Table;
 import org.apache.accumulo.core.client.impl.Tables;
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
@@ -220,7 +221,8 @@ public class Merge {
     Table.ID tableId;
     Scanner scanner;
     try {
-      tableId = Tables.getTableId(conn.getInstance(), tablename);
+      ClientContext context = new ClientContext(conn.info());
+      tableId = Tables.getTableId(context, tablename);
       scanner = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
     } catch (Exception e) {
       throw new MergeException(e);
diff --git a/server/base/src/main/java/org/apache/accumulo/server/cli/ClientOpts.java b/server/base/src/main/java/org/apache/accumulo/server/cli/ClientOpts.java
index 9d67c4d..d420e9d 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/cli/ClientOpts.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/cli/ClientOpts.java
@@ -19,6 +19,7 @@ package org.apache.accumulo.server.cli;
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.Instance;
+import org.apache.accumulo.core.client.impl.ClientContext;
 import org.apache.accumulo.server.client.HdfsZooInstance;
 
 public class ClientOpts extends org.apache.accumulo.core.cli.ClientOpts {
@@ -26,6 +27,10 @@ public class ClientOpts extends org.apache.accumulo.core.cli.ClientOpts {
     setPrincipal("root");
   }
 
+  public ClientContext getClientContext() {
+    return new ClientContext(getClientInfo());
+  }
+
   @Override
   public Instance getInstance() {
     if (instance == null) {
diff --git a/server/base/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java b/server/base/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java
index 3ca9f6d..a1b9356 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java
@@ -33,6 +33,7 @@ import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.NamespaceNotFoundException;
 import org.apache.accumulo.core.client.TableNotFoundException;
+import org.apache.accumulo.core.client.impl.ClientContext;
 import org.apache.accumulo.core.client.impl.Credentials;
 import org.apache.accumulo.core.client.impl.Namespace;
 import org.apache.accumulo.core.client.impl.Namespaces;
@@ -90,11 +91,11 @@ public class ClientServiceHandler implements ClientService.Iface {
     this.security = AuditedSecurityOperation.getInstance(context);
   }
 
-  public static Table.ID checkTableId(Instance instance, String tableName, TableOperation operation)
-      throws ThriftTableOperationException {
+  public static Table.ID checkTableId(ClientContext context, String tableName,
+      TableOperation operation) throws ThriftTableOperationException {
     TableOperationExceptionType reason = null;
     try {
-      return Tables._getTableId(instance, tableName);
+      return Tables._getTableId(context, tableName);
     } catch (NamespaceNotFoundException e) {
       reason = TableOperationExceptionType.NAMESPACE_NOTFOUND;
     } catch (TableNotFoundException e) {
@@ -103,14 +104,14 @@ public class ClientServiceHandler implements ClientService.Iface {
     throw new ThriftTableOperationException(null, tableName, operation, reason, null);
   }
 
-  public static Namespace.ID checkNamespaceId(Instance instance, String namespaceName,
+  public static Namespace.ID checkNamespaceId(ClientContext context, String namespaceName,
       TableOperation operation) throws ThriftTableOperationException {
-    Namespace.ID namespaceId = Namespaces.lookupNamespaceId(instance, namespaceName);
+    Namespace.ID namespaceId = Namespaces.lookupNamespaceId(context, namespaceName);
     if (namespaceId == null) {
       // maybe the namespace exists, but the cache was not updated yet... so try to clear the cache
       // and check again
-      Tables.clearCache(instance);
-      namespaceId = Namespaces.lookupNamespaceId(instance, namespaceName);
+      Tables.clearCache(context);
+      namespaceId = Namespaces.lookupNamespaceId(context, namespaceName);
       if (namespaceId == null)
         throw new ThriftTableOperationException(null, namespaceName, operation,
             TableOperationExceptionType.NAMESPACE_NOTFOUND, null);
@@ -215,7 +216,7 @@ public class ClientServiceHandler implements ClientService.Iface {
   @Override
   public void grantTablePermission(TInfo tinfo, TCredentials credentials, String user,
       String tableName, byte permission) throws TException {
-    Table.ID tableId = checkTableId(instance, tableName, TableOperation.PERMISSION);
+    Table.ID tableId = checkTableId(context, tableName, TableOperation.PERMISSION);
     Namespace.ID namespaceId;
     try {
       namespaceId = Tables.getNamespaceId(instance, tableId);
@@ -230,7 +231,7 @@ public class ClientServiceHandler implements ClientService.Iface {
   @Override
   public void grantNamespacePermission(TInfo tinfo, TCredentials credentials, String user,
       String ns, byte permission) throws ThriftSecurityException, ThriftTableOperationException {
-    Namespace.ID namespaceId = checkNamespaceId(instance, ns, TableOperation.PERMISSION);
+    Namespace.ID namespaceId = checkNamespaceId(context, ns, TableOperation.PERMISSION);
     security.grantNamespacePermission(credentials, user, namespaceId,
         NamespacePermission.getPermissionById(permission));
   }
@@ -245,7 +246,7 @@ public class ClientServiceHandler implements ClientService.Iface {
   @Override
   public void revokeTablePermission(TInfo tinfo, TCredentials credentials, String user,
       String tableName, byte permission) throws TException {
-    Table.ID tableId = checkTableId(instance, tableName, TableOperation.PERMISSION);
+    Table.ID tableId = checkTableId(context, tableName, TableOperation.PERMISSION);
     Namespace.ID namespaceId;
     try {
       namespaceId = Tables.getNamespaceId(instance, tableId);
@@ -268,7 +269,7 @@ public class ClientServiceHandler implements ClientService.Iface {
   public boolean hasTablePermission(TInfo tinfo, TCredentials credentials, String user,
       String tableName, byte tblPerm)
       throws ThriftSecurityException, ThriftTableOperationException {
-    Table.ID tableId = checkTableId(instance, tableName, TableOperation.PERMISSION);
+    Table.ID tableId = checkTableId(context, tableName, TableOperation.PERMISSION);
     return security.hasTablePermission(credentials, user, tableId,
         TablePermission.getPermissionById(tblPerm));
   }
@@ -276,7 +277,7 @@ public class ClientServiceHandler implements ClientService.Iface {
   @Override
   public boolean hasNamespacePermission(TInfo tinfo, TCredentials credentials, String user,
       String ns, byte perm) throws ThriftSecurityException, ThriftTableOperationException {
-    Namespace.ID namespaceId = checkNamespaceId(instance, ns, TableOperation.PERMISSION);
+    Namespace.ID namespaceId = checkNamespaceId(context, ns, TableOperation.PERMISSION);
     return security.hasNamespacePermission(credentials, user, namespaceId,
         NamespacePermission.getPermissionById(perm));
   }
@@ -284,7 +285,7 @@ public class ClientServiceHandler implements ClientService.Iface {
   @Override
   public void revokeNamespacePermission(TInfo tinfo, TCredentials credentials, String user,
       String ns, byte permission) throws ThriftSecurityException, ThriftTableOperationException {
-    Namespace.ID namespaceId = checkNamespaceId(instance, ns, TableOperation.PERMISSION);
+    Namespace.ID namespaceId = checkNamespaceId(context, ns, TableOperation.PERMISSION);
     security.revokeNamespacePermission(credentials, user, namespaceId,
         NamespacePermission.getPermissionById(permission));
   }
@@ -327,7 +328,7 @@ public class ClientServiceHandler implements ClientService.Iface {
   @Override
   public Map<String,String> getTableConfiguration(TInfo tinfo, TCredentials credentials,
       String tableName) throws TException, ThriftTableOperationException {
-    Table.ID tableId = checkTableId(instance, tableName, null);
+    Table.ID tableId = checkTableId(context, tableName, null);
     AccumuloConfiguration config = context.getServerConfigurationFactory()
         .getTableConfiguration(tableId);
     return conf(credentials, config);
@@ -390,7 +391,7 @@ public class ClientServiceHandler implements ClientService.Iface {
 
     security.authenticateUser(credentials, credentials);
 
-    Table.ID tableId = checkTableId(instance, tableName, null);
+    Table.ID tableId = checkTableId(context, tableName, null);
 
     ClassLoader loader = getClass().getClassLoader();
     Class<?> shouldMatch;
@@ -426,7 +427,7 @@ public class ClientServiceHandler implements ClientService.Iface {
 
     security.authenticateUser(credentials, credentials);
 
-    Namespace.ID namespaceId = checkNamespaceId(instance, ns, null);
+    Namespace.ID namespaceId = checkNamespaceId(context, ns, null);
 
     ClassLoader loader = getClass().getClassLoader();
     Class<?> shouldMatch;
@@ -463,7 +464,7 @@ public class ClientServiceHandler implements ClientService.Iface {
 
       for (String table : tables) {
         // ensure that table table exists
-        Table.ID tableId = checkTableId(instance, table, null);
+        Table.ID tableId = checkTableId(context, table, null);
         tableIds.add(tableId);
         Namespace.ID namespaceId = Tables.getNamespaceId(instance, tableId);
         if (!security.canScan(credentials, tableId, namespaceId))
@@ -492,7 +493,7 @@ public class ClientServiceHandler implements ClientService.Iface {
       String ns) throws ThriftTableOperationException, TException {
     Namespace.ID namespaceId;
     try {
-      namespaceId = Namespaces.getNamespaceId(instance, ns);
+      namespaceId = Namespaces.getNamespaceId(context, ns);
     } catch (NamespaceNotFoundException e) {
       String why = "Could not find namespace while getting configuration.";
       throw new ThriftTableOperationException(null, ns, null,
diff --git a/server/base/src/main/java/org/apache/accumulo/server/log/WalStateManager.java b/server/base/src/main/java/org/apache/accumulo/server/log/WalStateManager.java
index da74826..22703eb 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/log/WalStateManager.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/log/WalStateManager.java
@@ -25,7 +25,7 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.UUID;
 
-import org.apache.accumulo.core.client.Instance;
+import org.apache.accumulo.core.client.impl.ClientContext;
 import org.apache.accumulo.core.util.Pair;
 import org.apache.accumulo.core.zookeeper.ZooUtil;
 import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeExistsPolicy;
@@ -88,18 +88,18 @@ public class WalStateManager {
     UNREFERENCED
   }
 
-  private final Instance instance;
+  private final ClientContext context;
   private final ZooReaderWriter zoo;
 
   private volatile boolean checkedExistance = false;
 
-  public WalStateManager(Instance instance, ZooReaderWriter zoo) {
-    this.instance = instance;
+  public WalStateManager(ClientContext context, ZooReaderWriter zoo) {
+    this.context = context;
     this.zoo = zoo;
   }
 
   private String root() throws WalMarkerException {
-    String root = ZooUtil.getRoot(instance) + ZWALS;
+    String root = ZooUtil.getRoot(context.getInstanceID()) + ZWALS;
 
     try {
       if (!checkedExistance && !zoo.exists(root)) {
diff --git a/server/base/src/main/java/org/apache/accumulo/server/replication/ReplicationUtil.java b/server/base/src/main/java/org/apache/accumulo/server/replication/ReplicationUtil.java
index c019631..82a6ab0 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/replication/ReplicationUtil.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/replication/ReplicationUtil.java
@@ -125,7 +125,7 @@ public class ReplicationUtil {
   public Set<ReplicationTarget> getReplicationTargets() {
     // The total set of configured targets
     final Set<ReplicationTarget> allConfiguredTargets = new HashSet<>();
-    final Map<String,Table.ID> tableNameToId = Tables.getNameToIdMap(context.getInstance());
+    final Map<String,Table.ID> tableNameToId = Tables.getNameToIdMap(context);
 
     for (String table : tableNameToId.keySet()) {
       if (MetadataTable.NAME.equals(table) || RootTable.NAME.equals(table)) {
diff --git a/server/base/src/main/java/org/apache/accumulo/server/security/AuditedSecurityOperation.java b/server/base/src/main/java/org/apache/accumulo/server/security/AuditedSecurityOperation.java
index f585f58..a98212c 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/security/AuditedSecurityOperation.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/security/AuditedSecurityOperation.java
@@ -80,7 +80,7 @@ public class AuditedSecurityOperation extends SecurityOperation {
 
   private String getTableName(Table.ID tableId) {
     try {
-      return Tables.getTableName(context.getInstance(), tableId);
+      return Tables.getTableName(context, tableId);
     } catch (TableNotFoundException e) {
       return "Unknown Table with ID " + tableId;
     }
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/ListVolumesUsed.java b/server/base/src/main/java/org/apache/accumulo/server/util/ListVolumesUsed.java
index 841f805..0f5bf5f 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/ListVolumesUsed.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/ListVolumesUsed.java
@@ -20,7 +20,6 @@ import java.util.ArrayList;
 import java.util.Map.Entry;
 import java.util.TreeSet;
 
-import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.client.impl.ClientContext;
@@ -80,11 +79,11 @@ public class ListVolumesUsed {
 
   }
 
-  private static void listTable(String name, Connector conn) throws Exception {
+  private static void listTable(String name, ClientContext context) throws Exception {
 
     System.out.println("Listing volumes referenced in " + name + " tablets section");
 
-    Scanner scanner = conn.createScanner(name, Authorizations.EMPTY);
+    Scanner scanner = context.getConnector().createScanner(name, Authorizations.EMPTY);
 
     scanner.setRange(MetadataSchema.TabletsSection.getRange());
     scanner.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
@@ -129,7 +128,7 @@ public class ListVolumesUsed {
 
     volumes.clear();
 
-    WalStateManager wals = new WalStateManager(conn.getInstance(), ZooReaderWriter.getInstance());
+    WalStateManager wals = new WalStateManager(context, ZooReaderWriter.getInstance());
     for (Path path : wals.getAllState().keySet()) {
       volumes.add(getLogURI(path.toString()));
     }
@@ -141,12 +140,11 @@ public class ListVolumesUsed {
   }
 
   public static void listVolumes(ClientContext context) throws Exception {
-    Connector conn = context.getConnector();
     listZookeeper();
     System.out.println();
-    listTable(RootTable.NAME, conn);
+    listTable(RootTable.NAME, context);
     System.out.println();
-    listTable(MetadataTable.NAME, conn);
+    listTable(MetadataTable.NAME, context);
   }
 
 }
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/TableDiskUsage.java b/server/base/src/main/java/org/apache/accumulo/server/util/TableDiskUsage.java
index 5edcc7b..7ed7055 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/TableDiskUsage.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/TableDiskUsage.java
@@ -33,6 +33,7 @@ import java.util.TreeSet;
 import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.client.TableNotFoundException;
+import org.apache.accumulo.core.client.impl.ClientContext;
 import org.apache.accumulo.core.client.impl.Table;
 import org.apache.accumulo.core.client.impl.Tables;
 import org.apache.accumulo.core.data.Key;
@@ -216,7 +217,8 @@ public class TableDiskUsage {
       }
     }
 
-    Map<Table.ID,String> reverseTableIdMap = Tables.getIdToNameMap(conn.getInstance());
+    ClientContext context = new ClientContext(conn.info());
+    Map<Table.ID,String> reverseTableIdMap = Tables.getIdToNameMap(context);
 
     TreeMap<TreeSet<String>,Long> usage = new TreeMap<>((o1, o2) -> {
       int len1 = o1.size();
@@ -269,10 +271,11 @@ public class TableDiskUsage {
       Printer printer, boolean humanReadable) throws TableNotFoundException, IOException {
 
     HashSet<Table.ID> tableIds = new HashSet<>();
+    ClientContext context = new ClientContext(conn.info());
 
     // Get table IDs for all tables requested to be 'du'
     for (String tableName : tableNames) {
-      Table.ID tableId = Tables.getTableId(conn.getInstance(), tableName);
+      Table.ID tableId = Tables.getTableId(context, tableName);
       if (tableId == null)
         throw new TableNotFoundException(null, tableName, "Table " + tableName + " not found");
 
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/VerifyTabletAssignments.java b/server/base/src/main/java/org/apache/accumulo/server/util/VerifyTabletAssignments.java
index e039ca8..a133a1e 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/VerifyTabletAssignments.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/VerifyTabletAssignments.java
@@ -91,7 +91,7 @@ public class VerifyTabletAssignments {
 
     TreeMap<KeyExtent,String> tabletLocations = new TreeMap<>();
 
-    Table.ID tableId = Tables.getNameToIdMap(context.getInstance()).get(tableName);
+    Table.ID tableId = Tables.getNameToIdMap(context).get(tableName);
     MetadataServicer.forTableId(context, tableId).getTabletLocations(tabletLocations);
 
     final HashSet<KeyExtent> failures = new HashSet<>();
diff --git a/server/gc/src/main/java/org/apache/accumulo/gc/GarbageCollectWriteAheadLogs.java b/server/gc/src/main/java/org/apache/accumulo/gc/GarbageCollectWriteAheadLogs.java
index c663d9a..4bde774 100644
--- a/server/gc/src/main/java/org/apache/accumulo/gc/GarbageCollectWriteAheadLogs.java
+++ b/server/gc/src/main/java/org/apache/accumulo/gc/GarbageCollectWriteAheadLogs.java
@@ -104,7 +104,7 @@ public class GarbageCollectWriteAheadLogs {
       }
     });
     liveServers.startListeningForTabletServerChanges();
-    this.walMarker = new WalStateManager(context.getInstance(), ZooReaderWriter.getInstance());
+    this.walMarker = new WalStateManager(context, ZooReaderWriter.getInstance());
     this.store = new Iterable<TabletLocationState>() {
       @Override
       public Iterator<TabletLocationState> iterator() {
diff --git a/server/gc/src/main/java/org/apache/accumulo/gc/SimpleGarbageCollector.java b/server/gc/src/main/java/org/apache/accumulo/gc/SimpleGarbageCollector.java
index 6049b42..35b0893 100644
--- a/server/gc/src/main/java/org/apache/accumulo/gc/SimpleGarbageCollector.java
+++ b/server/gc/src/main/java/org/apache/accumulo/gc/SimpleGarbageCollector.java
@@ -317,7 +317,7 @@ public class SimpleGarbageCollector extends AccumuloServerContext implements Ifa
 
     @Override
     public Set<Table.ID> getTableIDs() {
-      return Tables.getIdToNameMap(getInstance()).keySet();
+      return Tables.getIdToNameMap(SimpleGarbageCollector.this).keySet();
     }
 
     @Override
diff --git a/server/gc/src/main/java/org/apache/accumulo/gc/replication/CloseWriteAheadLogReferences.java b/server/gc/src/main/java/org/apache/accumulo/gc/replication/CloseWriteAheadLogReferences.java
index 714324d..3f0eecf 100644
--- a/server/gc/src/main/java/org/apache/accumulo/gc/replication/CloseWriteAheadLogReferences.java
+++ b/server/gc/src/main/java/org/apache/accumulo/gc/replication/CloseWriteAheadLogReferences.java
@@ -104,7 +104,7 @@ public class CloseWriteAheadLogReferences implements Runnable {
     HashSet<String> closed = null;
     try {
       sw.start();
-      closed = getClosedLogs(conn);
+      closed = getClosedLogs();
     } finally {
       sw.stop();
       findWalsSpan.stop();
@@ -129,12 +129,10 @@ public class CloseWriteAheadLogReferences implements Runnable {
   /**
    * Construct the set of referenced WALs from zookeeper
    *
-   * @param conn
-   *          Connector
    * @return The Set of WALs that are referenced in the metadata table
    */
-  protected HashSet<String> getClosedLogs(Connector conn) {
-    WalStateManager wals = new WalStateManager(conn.getInstance(), ZooReaderWriter.getInstance());
+  protected HashSet<String> getClosedLogs() {
+    WalStateManager wals = new WalStateManager(context, ZooReaderWriter.getInstance());
 
     HashSet<String> result = new HashSet<>();
     try {
diff --git a/server/master/src/main/java/org/apache/accumulo/master/FateServiceHandler.java b/server/master/src/main/java/org/apache/accumulo/master/FateServiceHandler.java
index 0baec1f..4b6c68c 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/FateServiceHandler.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/FateServiceHandler.java
@@ -118,8 +118,7 @@ class FateServiceHandler implements FateService.Iface {
             Namespaces.NOT_DEFAULT.and(Namespaces.NOT_ACCUMULO));
         String newName = validateNamespaceArgument(arguments.get(1), tableOp, null);
 
-        Namespace.ID namespaceId = ClientServiceHandler.checkNamespaceId(master.getInstance(),
-            oldName, tableOp);
+        Namespace.ID namespaceId = ClientServiceHandler.checkNamespaceId(master, oldName, tableOp);
         if (!master.security.canRenameNamespace(c, namespaceId, oldName, newName))
           throw new ThriftSecurityException(c.getPrincipal(), SecurityErrorCode.PERMISSION_DENIED);
 
@@ -132,8 +131,8 @@ class FateServiceHandler implements FateService.Iface {
         String namespace = validateNamespaceArgument(arguments.get(0), tableOp,
             Namespaces.NOT_DEFAULT.and(Namespaces.NOT_ACCUMULO));
 
-        Namespace.ID namespaceId = ClientServiceHandler.checkNamespaceId(master.getInstance(),
-            namespace, tableOp);
+        Namespace.ID namespaceId = ClientServiceHandler.checkNamespaceId(master, namespace,
+            tableOp);
         if (!master.security.canDeleteNamespace(c, namespaceId))
           throw new ThriftSecurityException(c.getPrincipal(), SecurityErrorCode.PERMISSION_DENIED);
 
@@ -149,8 +148,7 @@ class FateServiceHandler implements FateService.Iface {
         Namespace.ID namespaceId;
 
         try {
-          namespaceId = Namespaces.getNamespaceId(master.getInstance(),
-              Tables.qualify(tableName).getFirst());
+          namespaceId = Namespaces.getNamespaceId(master, Tables.qualify(tableName).getFirst());
         } catch (NamespaceNotFoundException e) {
           throw new ThriftTableOperationException(null, tableName, tableOp,
               TableOperationExceptionType.NAMESPACE_NOTFOUND, "");
@@ -188,8 +186,7 @@ class FateServiceHandler implements FateService.Iface {
 
             });
 
-        Table.ID tableId = ClientServiceHandler.checkTableId(master.getInstance(), oldTableName,
-            tableOp);
+        Table.ID tableId = ClientServiceHandler.checkTableId(master, oldTableName, tableOp);
         Namespace.ID namespaceId = getNamespaceIdFromTableId(tableOp, tableId);
 
         final boolean canRename;
@@ -221,8 +218,7 @@ class FateServiceHandler implements FateService.Iface {
         String tableName = validateTableNameArgument(arguments.get(1), tableOp, NOT_SYSTEM);
         Namespace.ID namespaceId;
         try {
-          namespaceId = Namespaces.getNamespaceId(master.getInstance(),
-              Tables.qualify(tableName).getFirst());
+          namespaceId = Namespaces.getNamespaceId(master, Tables.qualify(tableName).getFirst());
         } catch (NamespaceNotFoundException e) {
           // shouldn't happen, but possible once cloning between namespaces is supported
           throw new ThriftTableOperationException(null, tableName, tableOp,
@@ -270,8 +266,7 @@ class FateServiceHandler implements FateService.Iface {
         TableOperation tableOp = TableOperation.DELETE;
         String tableName = validateTableNameArgument(arguments.get(0), tableOp, NOT_SYSTEM);
 
-        final Table.ID tableId = ClientServiceHandler.checkTableId(master.getInstance(), tableName,
-            tableOp);
+        final Table.ID tableId = ClientServiceHandler.checkTableId(master, tableName, tableOp);
         Namespace.ID namespaceId = getNamespaceIdFromTableId(tableOp, tableId);
 
         final boolean canDeleteTable;
@@ -336,8 +331,7 @@ class FateServiceHandler implements FateService.Iface {
         Text startRow = ByteBufferUtil.toText(arguments.get(1));
         Text endRow = ByteBufferUtil.toText(arguments.get(2));
 
-        final Table.ID tableId = ClientServiceHandler.checkTableId(master.getInstance(), tableName,
-            tableOp);
+        final Table.ID tableId = ClientServiceHandler.checkTableId(master, tableName, tableOp);
         Namespace.ID namespaceId = getNamespaceIdFromTableId(tableOp, tableId);
 
         final boolean canMerge;
@@ -363,8 +357,7 @@ class FateServiceHandler implements FateService.Iface {
         Text startRow = ByteBufferUtil.toText(arguments.get(1));
         Text endRow = ByteBufferUtil.toText(arguments.get(2));
 
-        final Table.ID tableId = ClientServiceHandler.checkTableId(master.getInstance(), tableName,
-            tableOp);
+        final Table.ID tableId = ClientServiceHandler.checkTableId(master, tableName, tableOp);
         Namespace.ID namespaceId = getNamespaceIdFromTableId(tableOp, tableId);
 
         final boolean canDeleteRange;
@@ -391,8 +384,7 @@ class FateServiceHandler implements FateService.Iface {
         String failDir = ByteBufferUtil.toString(arguments.get(2));
         boolean setTime = Boolean.parseBoolean(ByteBufferUtil.toString(arguments.get(3)));
 
-        final Table.ID tableId = ClientServiceHandler.checkTableId(master.getInstance(), tableName,
-            tableOp);
+        final Table.ID tableId = ClientServiceHandler.checkTableId(master, tableName, tableOp);
         Namespace.ID namespaceId = getNamespaceIdFromTableId(tableOp, tableId);
 
         final boolean canBulkImport;
@@ -466,8 +458,7 @@ class FateServiceHandler implements FateService.Iface {
         String exportDir = ByteBufferUtil.toString(arguments.get(1));
         Namespace.ID namespaceId;
         try {
-          namespaceId = Namespaces.getNamespaceId(master.getInstance(),
-              Tables.qualify(tableName).getFirst());
+          namespaceId = Namespaces.getNamespaceId(master, Tables.qualify(tableName).getFirst());
         } catch (NamespaceNotFoundException e) {
           throw new ThriftTableOperationException(null, tableName, tableOp,
               TableOperationExceptionType.NAMESPACE_NOTFOUND, "");
@@ -494,8 +485,7 @@ class FateServiceHandler implements FateService.Iface {
         String tableName = validateTableNameArgument(arguments.get(0), tableOp, NOT_SYSTEM);
         String exportDir = ByteBufferUtil.toString(arguments.get(1));
 
-        Table.ID tableId = ClientServiceHandler.checkTableId(master.getInstance(), tableName,
-            tableOp);
+        Table.ID tableId = ClientServiceHandler.checkTableId(master, tableName, tableOp);
         Namespace.ID namespaceId = getNamespaceIdFromTableId(tableOp, tableId);
 
         final boolean canExport;
@@ -525,7 +515,7 @@ class FateServiceHandler implements FateService.Iface {
 
         final boolean canBulkImport;
         try {
-          String tableName = Tables.getTableName(master.getInstance(), tableId);
+          String tableName = Tables.getTableName(master, tableId);
           canBulkImport = master.security.canBulkImport(c, tableId, tableName, dir, null,
               namespaceId);
         } catch (ThriftSecurityException e) {
diff --git a/server/master/src/main/java/org/apache/accumulo/master/Master.java b/server/master/src/main/java/org/apache/accumulo/master/Master.java
index 22e1b82..1a4563e 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/Master.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/Master.java
@@ -410,7 +410,7 @@ public class Master extends AccumuloServerContext
           String ns = namespace.getFirst();
           Namespace.ID id = namespace.getSecond();
           log.debug("Upgrade creating namespace \"{}\" (ID: {})", ns, id);
-          if (!Namespaces.exists(getInstance(), id))
+          if (!Namespaces.exists(this, id))
             TableManager.prepareNewNamespaceState(getInstanceID(), id, ns, NodeExistsPolicy.SKIP);
         }
 
@@ -943,7 +943,7 @@ public class Master extends AccumuloServerContext
      */
     private void cleanupOfflineMigrations() {
       TableManager manager = TableManager.getInstance();
-      for (Table.ID tableId : Tables.getIdToNameMap(getInstance()).keySet()) {
+      for (Table.ID tableId : Tables.getIdToNameMap(Master.this).keySet()) {
         TableState state = manager.getTableState(tableId);
         if (TableState.OFFLINE == state) {
           clearMigrations(tableId);
@@ -1652,7 +1652,7 @@ public class Master extends AccumuloServerContext
     }
     TableManager manager = TableManager.getInstance();
 
-    for (Table.ID tableId : Tables.getIdToNameMap(getInstance()).keySet()) {
+    for (Table.ID tableId : Tables.getIdToNameMap(this).keySet()) {
       TableState state = manager.getTableState(tableId);
       if (state != null) {
         if (state == TableState.ONLINE)
@@ -1670,7 +1670,7 @@ public class Master extends AccumuloServerContext
   @Override
   public Collection<MergeInfo> merges() {
     List<MergeInfo> result = new ArrayList<>();
-    for (Table.ID tableId : Tables.getIdToNameMap(getInstance()).keySet()) {
+    for (Table.ID tableId : Tables.getIdToNameMap(this).keySet()) {
       result.add(getMergeInfo(tableId));
     }
     return result;
@@ -1781,7 +1781,7 @@ public class Master extends AccumuloServerContext
 
   public void markDeadServerLogsAsClosed(Map<TServerInstance,List<Path>> logsForDeadServers)
       throws WalMarkerException {
-    WalStateManager mgr = new WalStateManager(getInstance(), ZooReaderWriter.getInstance());
+    WalStateManager mgr = new WalStateManager(this, ZooReaderWriter.getInstance());
     for (Entry<TServerInstance,List<Path>> server : logsForDeadServers.entrySet()) {
       for (Path path : server.getValue()) {
         mgr.closeWal(server.getKey(), path);
diff --git a/server/master/src/main/java/org/apache/accumulo/master/MasterClientServiceHandler.java b/server/master/src/main/java/org/apache/accumulo/master/MasterClientServiceHandler.java
index 7863319..600d61d 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/MasterClientServiceHandler.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/MasterClientServiceHandler.java
@@ -33,13 +33,13 @@ import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.BatchScanner;
 import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.IsolatedScanner;
 import org.apache.accumulo.core.client.RowIterator;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.client.TableNotFoundException;
 import org.apache.accumulo.core.client.admin.DelegationTokenConfig;
 import org.apache.accumulo.core.client.impl.AuthenticationTokenIdentifier;
+import org.apache.accumulo.core.client.impl.ClientContext;
 import org.apache.accumulo.core.client.impl.DelegationTokenConfigSerializer;
 import org.apache.accumulo.core.client.impl.Namespace;
 import org.apache.accumulo.core.client.impl.Table;
@@ -444,7 +444,7 @@ public class MasterClientServiceHandler extends FateServiceHandler
       throws ThriftSecurityException, ThriftTableOperationException {
 
     Namespace.ID namespaceId = null;
-    namespaceId = ClientServiceHandler.checkNamespaceId(master.getInstance(), namespace, op);
+    namespaceId = ClientServiceHandler.checkNamespaceId(master, namespace, op);
 
     if (!master.security.canAlterNamespace(c, namespaceId))
       throw new ThriftSecurityException(c.getPrincipal(), SecurityErrorCode.PERMISSION_DENIED);
@@ -458,7 +458,7 @@ public class MasterClientServiceHandler extends FateServiceHandler
     } catch (KeeperException.NoNodeException e) {
       // race condition... namespace no longer exists? This call will throw an exception if the
       // namespace was deleted:
-      ClientServiceHandler.checkNamespaceId(master.getInstance(), namespace, op);
+      ClientServiceHandler.checkNamespaceId(master, namespace, op);
       log.info("Error altering namespace property", e);
       throw new ThriftTableOperationException(namespaceId.canonicalID(), namespace, op,
           TableOperationExceptionType.OTHER, "Problem altering namespaceproperty");
@@ -471,7 +471,7 @@ public class MasterClientServiceHandler extends FateServiceHandler
 
   private void alterTableProperty(TCredentials c, String tableName, String property, String value,
       TableOperation op) throws ThriftSecurityException, ThriftTableOperationException {
-    final Table.ID tableId = ClientServiceHandler.checkTableId(master.getInstance(), tableName, op);
+    final Table.ID tableId = ClientServiceHandler.checkTableId(master, tableName, op);
     Namespace.ID namespaceId = getNamespaceIdFromTableId(op, tableId);
     if (!master.security.canAlterTable(c, tableId, namespaceId))
       throw new ThriftSecurityException(c.getPrincipal(), SecurityErrorCode.PERMISSION_DENIED);
@@ -485,7 +485,7 @@ public class MasterClientServiceHandler extends FateServiceHandler
     } catch (KeeperException.NoNodeException e) {
       // race condition... table no longer exists? This call will throw an exception if the table
       // was deleted:
-      ClientServiceHandler.checkTableId(master.getInstance(), tableName, op);
+      ClientServiceHandler.checkTableId(master, tableName, op);
       log.info("Error altering table property", e);
       throw new ThriftTableOperationException(tableId.canonicalID(), tableName, op,
           TableOperationExceptionType.OTHER, "Problem altering table property");
@@ -560,7 +560,7 @@ public class MasterClientServiceHandler extends FateServiceHandler
       throw new RuntimeException("Failed to obtain connector", e);
     }
 
-    final Text tableId = new Text(getTableId(master.getInstance(), tableName).getUtf8());
+    final Text tableId = new Text(getTableId(master, tableName).getUtf8());
 
     drainLog.trace("Waiting for {} to be replicated for {}", logsToWatch, tableId);
 
@@ -598,9 +598,9 @@ public class MasterClientServiceHandler extends FateServiceHandler
     }
   }
 
-  protected Table.ID getTableId(Instance instance, String tableName)
+  protected Table.ID getTableId(ClientContext context, String tableName)
       throws ThriftTableOperationException {
-    return ClientServiceHandler.checkTableId(instance, tableName, null);
+    return ClientServiceHandler.checkTableId(context, tableName, null);
   }
 
   /**
diff --git a/server/master/src/main/java/org/apache/accumulo/master/TabletGroupWatcher.java b/server/master/src/main/java/org/apache/accumulo/master/TabletGroupWatcher.java
index 03dec37..3f1bc82 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/TabletGroupWatcher.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/TabletGroupWatcher.java
@@ -148,7 +148,7 @@ abstract class TabletGroupWatcher extends Daemon {
     int[] oldCounts = new int[TabletState.values().length];
     EventCoordinator.Listener eventListener = this.master.nextEvent.getListener();
 
-    WalStateManager wals = new WalStateManager(master.getInstance(), ZooReaderWriter.getInstance());
+    WalStateManager wals = new WalStateManager(master, ZooReaderWriter.getInstance());
 
     while (this.master.stillMaster()) {
       // slow things down a little, otherwise we spam the logs when there are many wake-up events
diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/ClonePermissions.java b/server/master/src/main/java/org/apache/accumulo/master/tableOps/ClonePermissions.java
index 95eb44d..62e0985 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/ClonePermissions.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/ClonePermissions.java
@@ -60,7 +60,7 @@ class ClonePermissions extends MasterRepo {
     // this way concurrent users will not get a spurious pemission denied
     // error
     try {
-      return new CloneZookeeper(cloneInfo);
+      return new CloneZookeeper(cloneInfo, environment);
     } catch (NamespaceNotFoundException e) {
       throw new AcceptableThriftTableOperationException(null, cloneInfo.tableName,
           TableOperation.CLONE, TableOperationExceptionType.NAMESPACE_NOTFOUND,
diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/CloneZookeeper.java b/server/master/src/main/java/org/apache/accumulo/master/tableOps/CloneZookeeper.java
index f991f5b..dcf73ab 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/CloneZookeeper.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/CloneZookeeper.java
@@ -17,13 +17,13 @@
 package org.apache.accumulo.master.tableOps;
 
 import org.apache.accumulo.core.client.NamespaceNotFoundException;
+import org.apache.accumulo.core.client.impl.ClientContext;
 import org.apache.accumulo.core.client.impl.Namespaces;
 import org.apache.accumulo.core.client.impl.Tables;
 import org.apache.accumulo.core.client.impl.thrift.TableOperation;
 import org.apache.accumulo.fate.Repo;
 import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeExistsPolicy;
 import org.apache.accumulo.master.Master;
-import org.apache.accumulo.server.client.HdfsZooInstance;
 import org.apache.accumulo.server.tables.TableManager;
 
 class CloneZookeeper extends MasterRepo {
@@ -32,9 +32,10 @@ class CloneZookeeper extends MasterRepo {
 
   private CloneInfo cloneInfo;
 
-  public CloneZookeeper(CloneInfo cloneInfo) throws NamespaceNotFoundException {
+  public CloneZookeeper(CloneInfo cloneInfo, ClientContext context)
+      throws NamespaceNotFoundException {
     this.cloneInfo = cloneInfo;
-    this.cloneInfo.namespaceId = Namespaces.getNamespaceId(HdfsZooInstance.getInstance(),
+    this.cloneInfo.namespaceId = Namespaces.getNamespaceId(context,
         Tables.qualify(this.cloneInfo.tableName).getFirst());
   }
 
@@ -53,8 +54,8 @@ class CloneZookeeper extends MasterRepo {
     try {
       // write tableName & tableId to zookeeper
 
-      Utils.checkTableDoesNotExist(environment.getInstance(), cloneInfo.tableName,
-          cloneInfo.tableId, TableOperation.CLONE);
+      Utils.checkTableDoesNotExist(environment, cloneInfo.tableName, cloneInfo.tableId,
+          TableOperation.CLONE);
 
       TableManager.getInstance().cloneTable(cloneInfo.srcTableId, cloneInfo.tableId,
           cloneInfo.tableName, cloneInfo.namespaceId, cloneInfo.propertiesToSet,
diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/ImportPopulateZookeeper.java b/server/master/src/main/java/org/apache/accumulo/master/tableOps/ImportPopulateZookeeper.java
index ee5e1fb..dfd5f0c 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/ImportPopulateZookeeper.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/ImportPopulateZookeeper.java
@@ -76,11 +76,11 @@ class ImportPopulateZookeeper extends MasterRepo {
       // write tableName & tableId to zookeeper
       Instance instance = env.getInstance();
 
-      Utils.checkTableDoesNotExist(instance, tableInfo.tableName, tableInfo.tableId,
+      Utils.checkTableDoesNotExist(env, tableInfo.tableName, tableInfo.tableId,
           TableOperation.CREATE);
 
       String namespace = Tables.qualify(tableInfo.tableName).getFirst();
-      Namespace.ID namespaceId = Namespaces.getNamespaceId(instance, namespace);
+      Namespace.ID namespaceId = Namespaces.getNamespaceId(env, namespace);
       TableManager.getInstance().addTable(tableInfo.tableId, namespaceId, tableInfo.tableName,
           NodeExistsPolicy.OVERWRITE);
 
diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/PopulateZookeeper.java b/server/master/src/main/java/org/apache/accumulo/master/tableOps/PopulateZookeeper.java
index 2301d33..1e106b2 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/PopulateZookeeper.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/PopulateZookeeper.java
@@ -51,7 +51,7 @@ class PopulateZookeeper extends MasterRepo {
       // write tableName & tableId to zookeeper
       Instance instance = master.getInstance();
 
-      Utils.checkTableDoesNotExist(instance, tableInfo.tableName, tableInfo.tableId,
+      Utils.checkTableDoesNotExist(master, tableInfo.tableName, tableInfo.tableId,
           TableOperation.CREATE);
 
       TableManager.getInstance().addTable(tableInfo.tableId, tableInfo.namespaceId,
diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/PopulateZookeeperWithNamespace.java b/server/master/src/main/java/org/apache/accumulo/master/tableOps/PopulateZookeeperWithNamespace.java
index 3d1dcc8..94986e3 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/PopulateZookeeperWithNamespace.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/PopulateZookeeperWithNamespace.java
@@ -18,7 +18,6 @@ package org.apache.accumulo.master.tableOps;
 
 import java.util.Map.Entry;
 
-import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.impl.Tables;
 import org.apache.accumulo.core.client.impl.thrift.TableOperation;
 import org.apache.accumulo.fate.Repo;
@@ -48,19 +47,17 @@ class PopulateZookeeperWithNamespace extends MasterRepo {
 
     Utils.tableNameLock.lock();
     try {
-      Instance instance = master.getInstance();
-
-      Utils.checkNamespaceDoesNotExist(instance, namespaceInfo.namespaceName,
+      Utils.checkNamespaceDoesNotExist(master, namespaceInfo.namespaceName,
           namespaceInfo.namespaceId, TableOperation.CREATE);
 
-      TableManager.prepareNewNamespaceState(instance.getInstanceID(), namespaceInfo.namespaceId,
+      TableManager.prepareNewNamespaceState(master.getInstanceID(), namespaceInfo.namespaceId,
           namespaceInfo.namespaceName, NodeExistsPolicy.OVERWRITE);
 
       for (Entry<String,String> entry : namespaceInfo.props.entrySet())
         NamespacePropUtil.setNamespaceProperty(namespaceInfo.namespaceId, entry.getKey(),
             entry.getValue());
 
-      Tables.clearCache(instance);
+      Tables.clearCache(master);
 
       return new FinishCreateNamespace(namespaceInfo);
     } finally {
diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/RenameNamespace.java b/server/master/src/main/java/org/apache/accumulo/master/tableOps/RenameNamespace.java
index f795e9f..eb2b780 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/RenameNamespace.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/RenameNamespace.java
@@ -17,7 +17,6 @@
 package org.apache.accumulo.master.tableOps;
 
 import org.apache.accumulo.core.Constants;
-import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.impl.AcceptableThriftTableOperationException;
 import org.apache.accumulo.core.client.impl.Namespace;
 import org.apache.accumulo.core.client.impl.Tables;
@@ -52,13 +51,11 @@ public class RenameNamespace extends MasterRepo {
   @Override
   public Repo<Master> call(long id, Master master) throws Exception {
 
-    Instance instance = master.getInstance();
-
     IZooReaderWriter zoo = ZooReaderWriter.getInstance();
 
     Utils.tableNameLock.lock();
     try {
-      Utils.checkNamespaceDoesNotExist(instance, newName, namespaceId, TableOperation.RENAME);
+      Utils.checkNamespaceDoesNotExist(master, newName, namespaceId, TableOperation.RENAME);
 
       final String tap = ZooUtil.getRoot(master.getInstanceID()) + Constants.ZNAMESPACES + "/"
           + namespaceId + Constants.ZNAMESPACE_NAME;
@@ -76,7 +73,7 @@ public class RenameNamespace extends MasterRepo {
           return newName.getBytes();
         }
       });
-      Tables.clearCache(instance);
+      Tables.clearCache(master);
     } finally {
       Utils.tableNameLock.unlock();
       Utils.unreserveNamespace(namespaceId, id, true);
diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/RenameTable.java b/server/master/src/main/java/org/apache/accumulo/master/tableOps/RenameTable.java
index 6e2a3bd..03e14cf 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/RenameTable.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/RenameTable.java
@@ -66,8 +66,8 @@ public class RenameTable extends MasterRepo {
     Pair<String,String> qualifiedNewTableName = Tables.qualify(newTableName);
 
     // ensure no attempt is made to rename across namespaces
-    if (newTableName.contains(".") && !namespaceId
-        .equals(Namespaces.getNamespaceId(instance, qualifiedNewTableName.getFirst())))
+    if (newTableName.contains(".")
+        && !namespaceId.equals(Namespaces.getNamespaceId(master, qualifiedNewTableName.getFirst())))
       throw new AcceptableThriftTableOperationException(tableId.canonicalID(), oldTableName,
           TableOperation.RENAME, TableOperationExceptionType.INVALID_NAME,
           "Namespace in new table name does not match the old table name");
@@ -76,7 +76,7 @@ public class RenameTable extends MasterRepo {
 
     Utils.tableNameLock.lock();
     try {
-      Utils.checkTableDoesNotExist(instance, newTableName, tableId, TableOperation.RENAME);
+      Utils.checkTableDoesNotExist(master, newTableName, tableId, TableOperation.RENAME);
 
       final String newName = qualifiedNewTableName.getSecond();
       final String oldName = qualifiedOldTableName.getSecond();
diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/Utils.java b/server/master/src/main/java/org/apache/accumulo/master/tableOps/Utils.java
index 5626978..b8fa377 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/Utils.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/Utils.java
@@ -28,6 +28,7 @@ import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.impl.AbstractId;
 import org.apache.accumulo.core.client.impl.AcceptableThriftTableOperationException;
+import org.apache.accumulo.core.client.impl.ClientContext;
 import org.apache.accumulo.core.client.impl.Namespace;
 import org.apache.accumulo.core.client.impl.Namespaces;
 import org.apache.accumulo.core.client.impl.Table;
@@ -49,10 +50,10 @@ public class Utils {
   private static final byte[] ZERO_BYTE = {'0'};
   private static final Logger log = LoggerFactory.getLogger(Utils.class);
 
-  static void checkTableDoesNotExist(Instance instance, String tableName, Table.ID tableId,
+  static void checkTableDoesNotExist(ClientContext context, String tableName, Table.ID tableId,
       TableOperation operation) throws AcceptableThriftTableOperationException {
 
-    Table.ID id = Tables.getNameToIdMap(instance).get(tableName);
+    Table.ID id = Tables.getNameToIdMap(context).get(tableName);
 
     if (id != null && !id.equals(tableId))
       throw new AcceptableThriftTableOperationException(null, tableName, operation,
@@ -170,11 +171,11 @@ public class Utils {
     return Utils.getLock(tableId, tid, false);
   }
 
-  static void checkNamespaceDoesNotExist(Instance instance, String namespace,
+  static void checkNamespaceDoesNotExist(ClientContext context, String namespace,
       Namespace.ID namespaceId, TableOperation operation)
       throws AcceptableThriftTableOperationException {
 
-    Namespace.ID n = Namespaces.lookupNamespaceId(instance, namespace);
+    Namespace.ID n = Namespaces.lookupNamespaceId(context, namespace);
 
     if (n != null && !n.equals(namespaceId))
       throw new AcceptableThriftTableOperationException(null, namespace, operation,
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/problems/ProblemsResource.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/problems/ProblemsResource.java
index 75b10f8..8bc0495 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/problems/ProblemsResource.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/problems/ProblemsResource.java
@@ -37,7 +37,6 @@ import javax.ws.rs.core.MediaType;
 import org.apache.accumulo.core.client.impl.Table;
 import org.apache.accumulo.core.client.impl.Tables;
 import org.apache.accumulo.monitor.Monitor;
-import org.apache.accumulo.server.client.HdfsZooInstance;
 import org.apache.accumulo.server.problems.ProblemReport;
 import org.apache.accumulo.server.problems.ProblemReports;
 import org.apache.accumulo.server.problems.ProblemType;
@@ -81,8 +80,7 @@ public class ProblemsResource {
           }
         }
 
-        String tableName = Tables.getPrintableTableInfoFromId(HdfsZooInstance.getInstance(),
-            entry.getKey());
+        String tableName = Tables.getPrintableTableInfoFromId(Monitor.getContext(), entry.getKey());
 
         problems.addProblemSummary(new ProblemSummaryInformation(tableName, entry.getKey(),
             readCount, writeCount, loadCount));
@@ -132,7 +130,7 @@ public class ProblemsResource {
         while (iter.hasNext())
           problemReports.add(iter.next());
         for (ProblemReport pr : problemReports) {
-          String tableName = Tables.getPrintableTableInfoFromId(HdfsZooInstance.getInstance(),
+          String tableName = Tables.getPrintableTableInfoFromId(Monitor.getContext(),
               pr.getTableId());
 
           problems.addProblemDetail(
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/replication/ReplicationResource.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/replication/ReplicationResource.java
index 82d2692..852209e 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/replication/ReplicationResource.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/replication/ReplicationResource.java
@@ -112,7 +112,7 @@ public class ReplicationResource {
     // Number of files per target we have to replicate
     Map<ReplicationTarget,Long> targetCounts = new HashMap<>();
 
-    Map<String,Table.ID> tableNameToId = Tables.getNameToIdMap(conn.getInstance());
+    Map<String,Table.ID> tableNameToId = Tables.getNameToIdMap(Monitor.getContext());
     Map<Table.ID,String> tableIdToName = invert(tableNameToId);
 
     for (String table : tops.list()) {
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tables/TablesResource.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tables/TablesResource.java
index 321c62f..b19beae 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tables/TablesResource.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tables/TablesResource.java
@@ -45,7 +45,6 @@ import org.apache.accumulo.core.metadata.RootTable;
 import org.apache.accumulo.monitor.Monitor;
 import org.apache.accumulo.monitor.rest.tservers.TabletServer;
 import org.apache.accumulo.monitor.rest.tservers.TabletServers;
-import org.apache.accumulo.server.client.HdfsZooInstance;
 import org.apache.accumulo.server.master.state.MetaDataTableScanner;
 import org.apache.accumulo.server.master.state.TabletLocationState;
 import org.apache.accumulo.server.tables.TableManager;
@@ -83,7 +82,7 @@ public class TablesResource {
     TableManager tableManager = TableManager.getInstance();
 
     // Add tables to the list
-    for (Map.Entry<String,Table.ID> entry : Tables.getNameToIdMap(HdfsZooInstance.getInstance())
+    for (Map.Entry<String,Table.ID> entry : Tables.getNameToIdMap(Monitor.getContext())
         .entrySet()) {
       String tableName = entry.getKey();
       Table.ID tableId = entry.getValue();
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServerResource.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServerResource.java
index bb5eef3..da4fcc6 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServerResource.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/TabletServerResource.java
@@ -56,7 +56,6 @@ import org.apache.accumulo.core.util.HostAndPort;
 import org.apache.accumulo.core.zookeeper.ZooUtil;
 import org.apache.accumulo.monitor.Monitor;
 import org.apache.accumulo.monitor.rest.master.MasterResource;
-import org.apache.accumulo.server.client.HdfsZooInstance;
 import org.apache.accumulo.server.master.state.DeadServerList;
 import org.apache.accumulo.server.util.ActionStatsUpdator;
 
@@ -326,7 +325,7 @@ public class TabletServerResource {
       String obscuredExtent = Base64.getEncoder().encodeToString(digester.digest());
       String displayExtent = String.format("[%s]", obscuredExtent);
 
-      String tableName = Tables.getPrintableTableInfoFromId(HdfsZooInstance.getInstance(), tableId);
+      String tableName = Tables.getPrintableTableInfoFromId(Monitor.getContext(), tableId);
 
       currentOperations.add(
           new CurrentOperations(tableName, tableId, displayExtent, info.numEntries, info.ingestRate,
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/view/WebViews.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/view/WebViews.java
index 0e7c08d..2bfac79 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/view/WebViews.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/view/WebViews.java
@@ -292,8 +292,7 @@ public class WebViews {
       @PathParam("tableID") @NotNull @Pattern(regexp = ALPHA_NUM_REGEX_TABLE_ID) String tableID)
       throws TableNotFoundException {
 
-    String tableName = Tables.getTableName(Monitor.getContext().getInstance(),
-        Table.ID.of(tableID));
+    String tableName = Tables.getTableName(Monitor.getContext(), Table.ID.of(tableID));
 
     Map<String,Object> model = getModel();
     model.put("title", "Table Status");
diff --git a/server/monitor/src/test/java/org/apache/accumulo/monitor/it/WebViewsIT.java b/server/monitor/src/test/java/org/apache/accumulo/monitor/it/WebViewsIT.java
index 7882d4b..9814a3c 100644
--- a/server/monitor/src/test/java/org/apache/accumulo/monitor/it/WebViewsIT.java
+++ b/server/monitor/src/test/java/org/apache/accumulo/monitor/it/WebViewsIT.java
@@ -109,7 +109,7 @@ public class WebViewsIT extends JerseyTest {
     expect(Monitor.getContext()).andReturn(contextMock).anyTimes();
 
     PowerMock.mockStatic(Tables.class);
-    expect(Tables.getTableName(instanceMock, Table.ID.of("foo"))).andReturn("bar");
+    expect(Tables.getTableName(contextMock, Table.ID.of("foo"))).andReturn("bar");
     PowerMock.replayAll();
     org.easymock.EasyMock.replay(instanceMock, contextMock);
 
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
index 1d416b4..1e56ed8 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
@@ -369,7 +369,7 @@ public class TabletServer extends AccumuloServerContext implements Runnable {
     log.info("Version " + Constants.VERSION);
     log.info("Instance " + getInstanceID());
     this.sessionManager = new SessionManager(aconf);
-    this.logSorter = new LogSorter(instance, fs, aconf);
+    this.logSorter = new LogSorter(this, fs, aconf);
     this.replWorker = new ReplicationWorker(this, fs);
     this.statsKeeper = new TabletStatsKeeper();
     SimpleTimer.getInstance(aconf).schedule(new Runnable() {
@@ -432,7 +432,7 @@ public class TabletServer extends AccumuloServerContext implements Runnable {
         TabletLocator.clearLocators();
       }
     }, jitter(TIME_BETWEEN_LOCATOR_CACHE_CLEARS), jitter(TIME_BETWEEN_LOCATOR_CACHE_CLEARS));
-    walMarker = new WalStateManager(instance, ZooReaderWriter.getInstance());
+    walMarker = new WalStateManager(this, ZooReaderWriter.getInstance());
 
     // Create the secret manager
     setSecretManager(new AuthenticationTokenSecretManager(instance,
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/LogSorter.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/LogSorter.java
index f8f3d49..33d9138 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/LogSorter.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/LogSorter.java
@@ -29,7 +29,7 @@ import java.util.Map.Entry;
 import java.util.concurrent.ThreadPoolExecutor;
 
 import org.apache.accumulo.core.Constants;
-import org.apache.accumulo.core.client.Instance;
+import org.apache.accumulo.core.client.impl.ClientContext;
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.master.thrift.RecoveryStatus;
@@ -217,11 +217,11 @@ public class LogSorter {
   }
 
   ThreadPoolExecutor threadPool;
-  private final Instance instance;
+  private final ClientContext context;
   private double walBlockSize;
 
-  public LogSorter(Instance instance, VolumeManager fs, AccumuloConfiguration conf) {
-    this.instance = instance;
+  public LogSorter(ClientContext context, VolumeManager fs, AccumuloConfiguration conf) {
+    this.context = context;
     this.fs = fs;
     this.conf = conf;
     int threadPoolSize = conf.getCount(Property.TSERV_RECOVERY_MAX_CONCURRENT);
@@ -232,7 +232,7 @@ public class LogSorter {
   public void startWatchingForRecoveryLogs(ThreadPoolExecutor distWorkQThreadPool)
       throws KeeperException, InterruptedException {
     this.threadPool = distWorkQThreadPool;
-    new DistributedWorkQueue(ZooUtil.getRoot(instance) + Constants.ZRECOVERY, conf)
+    new DistributedWorkQueue(ZooUtil.getRoot(context.getInstanceID()) + Constants.ZRECOVERY, conf)
         .startProcessing(new LogProcessor(), this.threadPool);
   }
 
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/ConfigCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/ConfigCommand.java
index 0251112..d6aa017 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/ConfigCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/ConfigCommand.java
@@ -167,8 +167,8 @@ public class ConfigCommand extends Command {
 
       final TreeMap<String,String> namespaceConfig = new TreeMap<>();
       if (tableName != null) {
-        String n = Namespaces.getNamespaceName(shellState.getInstance(), Tables.getNamespaceId(
-            shellState.getInstance(), Tables.getTableId(shellState.getInstance(), tableName)));
+        String n = Namespaces.getNamespaceName(shellState.getContext(), Tables.getNamespaceId(
+            shellState.getInstance(), Tables.getTableId(shellState.getContext(), tableName)));
         for (Entry<String,String> e : shellState.getConnector().namespaceOperations()
             .getProperties(n)) {
           namespaceConfig.put(e.getKey(), e.getValue());
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/DUCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/DUCommand.java
index 31d7ae3..3f83eca 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/DUCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/DUCommand.java
@@ -21,7 +21,6 @@ import java.util.Arrays;
 import java.util.SortedSet;
 import java.util.TreeSet;
 
-import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.NamespaceNotFoundException;
 import org.apache.accumulo.core.client.TableNotFoundException;
 import org.apache.accumulo.core.client.admin.DiskUsage;
@@ -50,10 +49,9 @@ public class DUCommand extends Command {
     }
 
     if (cl.hasOption(optNamespace.getOpt())) {
-      Instance instance = shellState.getInstance();
-      Namespace.ID namespaceId = Namespaces.getNamespaceId(instance,
+      Namespace.ID namespaceId = Namespaces.getNamespaceId(shellState.getContext(),
           cl.getOptionValue(optNamespace.getOpt()));
-      tables.addAll(Namespaces.getTableNames(instance, namespaceId));
+      tables.addAll(Namespaces.getTableNames(shellState.getContext(), namespaceId));
     }
 
     boolean prettyPrint = cl.hasOption(optHumanReadble.getOpt());
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/DeleteNamespaceCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/DeleteNamespaceCommand.java
index feedb2a..ac5a6a6 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/DeleteNamespaceCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/DeleteNamespaceCommand.java
@@ -64,8 +64,8 @@ public class DeleteNamespaceCommand extends Command {
     boolean resetContext = false;
     String currentTable = shellState.getTableName();
 
-    Namespace.ID namespaceId = Namespaces.getNamespaceId(shellState.getInstance(), namespace);
-    List<String> tables = Namespaces.getTableNames(shellState.getInstance(), namespaceId);
+    Namespace.ID namespaceId = Namespaces.getNamespaceId(shellState.getContext(), namespace);
+    List<String> tables = Namespaces.getTableNames(shellState.getContext(), namespaceId);
     resetContext = tables.contains(currentTable);
 
     if (force)
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/RenameNamespaceCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/RenameNamespaceCommand.java
index 94e9409..c8df11c 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/RenameNamespaceCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/RenameNamespaceCommand.java
@@ -45,16 +45,16 @@ public class RenameNamespaceCommand extends Command {
     boolean resetContext = false;
     Table.ID currentTableId = null;
     if (!(shellState.getTableName() == null) && !shellState.getTableName().isEmpty()) {
-      Namespace.ID namespaceId = Namespaces.getNamespaceId(shellState.getInstance(), old);
-      List<Table.ID> tableIds = Namespaces.getTableIds(shellState.getInstance(), namespaceId);
-      currentTableId = Tables.getTableId(shellState.getInstance(), shellState.getTableName());
+      Namespace.ID namespaceId = Namespaces.getNamespaceId(shellState.getContext(), old);
+      List<Table.ID> tableIds = Namespaces.getTableIds(shellState.getContext(), namespaceId);
+      currentTableId = Tables.getTableId(shellState.getContext(), shellState.getTableName());
       resetContext = tableIds.contains(currentTableId);
     }
 
     shellState.getConnector().namespaceOperations().rename(old, newer);
 
     if (resetContext) {
-      shellState.setTableName(Tables.getTableName(shellState.getInstance(), currentTableId));
+      shellState.setTableName(Tables.getTableName(shellState.getContext(), currentTableId));
     }
 
     return 0;
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/TableOperation.java b/shell/src/main/java/org/apache/accumulo/shell/commands/TableOperation.java
index 54c0e0f..0249ba0 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/TableOperation.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/TableOperation.java
@@ -21,7 +21,6 @@ import java.util.Set;
 import java.util.SortedSet;
 import java.util.TreeSet;
 
-import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.TableNotFoundException;
 import org.apache.accumulo.core.client.impl.Namespace;
 import org.apache.accumulo.core.client.impl.Namespaces;
@@ -57,11 +56,10 @@ public abstract class TableOperation extends Command {
     } else if (cl.hasOption(optTableName.getOpt())) {
       tableSet.add(cl.getOptionValue(optTableName.getOpt()));
     } else if (cl.hasOption(optNamespace.getOpt())) {
-      Instance instance = shellState.getInstance();
-      Namespace.ID namespaceId = Namespaces.getNamespaceId(instance,
+      Namespace.ID namespaceId = Namespaces.getNamespaceId(shellState.getContext(),
           cl.getOptionValue(optNamespace.getOpt()));
-      for (Table.ID tableId : Namespaces.getTableIds(instance, namespaceId)) {
-        tableSet.add(Tables.getTableName(instance, tableId));
+      for (Table.ID tableId : Namespaces.getTableIds(shellState.getContext(), namespaceId)) {
+        tableSet.add(Tables.getTableName(shellState.getContext(), tableId));
       }
     } else if (useCommandLine && cl.getArgs().length > 0) {
       for (String tableName : cl.getArgs()) {
diff --git a/test/src/main/java/org/apache/accumulo/test/ListTables.java b/test/src/main/java/org/apache/accumulo/test/ListTables.java
index 4aa1de0..edce280 100644
--- a/test/src/main/java/org/apache/accumulo/test/ListTables.java
+++ b/test/src/main/java/org/apache/accumulo/test/ListTables.java
@@ -29,7 +29,7 @@ public class ListTables {
   public static void main(String[] args) throws Exception {
     ClientOpts opts = new ClientOpts();
     opts.parseArgs(ListTables.class.getName(), args);
-    for (Entry<String,Table.ID> table : Tables.getNameToIdMap(opts.getInstance()).entrySet())
+    for (Entry<String,Table.ID> table : Tables.getNameToIdMap(opts.getClientContext()).entrySet())
       System.out.println(table.getKey() + " => " + table.getValue());
   }
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/UnusedWALIT.java b/test/src/main/java/org/apache/accumulo/test/UnusedWALIT.java
index c03b6dd..609a571 100644
--- a/test/src/main/java/org/apache/accumulo/test/UnusedWALIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/UnusedWALIT.java
@@ -27,6 +27,7 @@ import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.Scanner;
+import org.apache.accumulo.core.client.impl.ClientContext;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Mutation;
@@ -78,6 +79,7 @@ public class UnusedWALIT extends ConfigurableMacBase {
     c.tableOperations().create(bigTable);
     c.tableOperations().create(lilTable);
 
+    ClientContext context = getClientContext();
     Instance i = c.getInstance();
     zk = new ZooReaderWriter(c.info().getZooKeepers(), c.info().getZooKeepersSessionTimeOut(), "");
 
@@ -86,11 +88,11 @@ public class UnusedWALIT extends ConfigurableMacBase {
     scanSomeData(c, bigTable, 0, 10, 0, 10);
     writeSomeData(c, lilTable, 0, 1, 0, 1);
     scanSomeData(c, lilTable, 0, 1, 0, 1);
-    assertEquals(2, getWALCount(i, zk));
+    assertEquals(2, getWALCount(context, zk));
 
     // roll the logs by pushing data into bigTable
     writeSomeData(c, bigTable, 0, 3000, 0, 1000);
-    assertEquals(3, getWALCount(i, zk));
+    assertEquals(3, getWALCount(context, zk));
 
     // put some data in the latest log
     writeSomeData(c, lilTable, 1, 10, 0, 10);
@@ -130,8 +132,8 @@ public class UnusedWALIT extends ConfigurableMacBase {
     }
   }
 
-  private int getWALCount(Instance i, ZooReaderWriter zk) throws Exception {
-    WalStateManager wals = new WalStateManager(i, zk);
+  private int getWALCount(ClientContext context, ZooReaderWriter zk) throws Exception {
+    WalStateManager wals = new WalStateManager(context, zk);
     int result = 0;
     for (Entry<TServerInstance,List<UUID>> entry : wals.getAllMarkers().entrySet()) {
       result += entry.getValue().size();
diff --git a/test/src/main/java/org/apache/accumulo/test/VolumeIT.java b/test/src/main/java/org/apache/accumulo/test/VolumeIT.java
index cc36a30..4591445 100644
--- a/test/src/main/java/org/apache/accumulo/test/VolumeIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/VolumeIT.java
@@ -453,7 +453,7 @@ public class VolumeIT extends ConfigurableMacBase {
         Instance i = conn.getInstance();
         ZooReaderWriter zk = new ZooReaderWriter(conn.info().getZooKeepers(),
             conn.info().getZooKeepersSessionTimeOut(), "");
-        WalStateManager wals = new WalStateManager(i, zk);
+        WalStateManager wals = new WalStateManager(getClientContext(), zk);
         try {
           outer: for (Entry<Path,WalState> entry : wals.getAllState().entrySet()) {
             for (Path path : paths) {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ConfigurableMacBase.java b/test/src/main/java/org/apache/accumulo/test/functional/ConfigurableMacBase.java
index 089ecb0..90ee9c0 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ConfigurableMacBase.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ConfigurableMacBase.java
@@ -29,6 +29,7 @@ import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.ClientInfo;
 import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.impl.ClientContext;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.conf.ClientProperty;
 import org.apache.accumulo.core.conf.Property;
@@ -190,6 +191,10 @@ public class ConfigurableMacBase extends AccumuloITBase {
     return getCluster().getConnector("root", new PasswordToken(ROOT_PASSWORD));
   }
 
+  protected ClientContext getClientContext() {
+    return new ClientContext(getClientInfo());
+  }
+
   protected ClientInfo getClientInfo() {
     return Connector.builder()
         .forInstance(getCluster().getInstanceName(), getCluster().getZooKeepers())
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/TabletStateChangeIteratorIT.java b/test/src/main/java/org/apache/accumulo/test/functional/TabletStateChangeIteratorIT.java
index 861b38b..8cceed1 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/TabletStateChangeIteratorIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/TabletStateChangeIteratorIT.java
@@ -244,7 +244,7 @@ public class TabletStateChangeIteratorIT extends AccumuloClusterHarness {
     @Override
     public Set<Table.ID> onlineTables() {
       ClientContext context = new ClientContext(getClientInfo());
-      Set<Table.ID> onlineTables = Tables.getIdToNameMap(context.getInstance()).keySet();
+      Set<Table.ID> onlineTables = Tables.getIdToNameMap(context).keySet();
       return Sets.filter(onlineTables,
           tableId -> Tables.getTableState(context, tableId) == TableState.ONLINE);
     }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/WALSunnyDayIT.java b/test/src/main/java/org/apache/accumulo/test/functional/WALSunnyDayIT.java
index c5c78a6..c6bd841 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/WALSunnyDayIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/WALSunnyDayIT.java
@@ -42,6 +42,7 @@ import java.util.concurrent.TimeUnit;
 import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.Scanner;
+import org.apache.accumulo.core.client.impl.ClientContext;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.data.Value;
@@ -95,20 +96,21 @@ public class WALSunnyDayIT extends ConfigurableMacBase {
     MiniAccumuloClusterImpl mac = getCluster();
     MiniAccumuloClusterControl control = mac.getClusterControl();
     control.stop(GARBAGE_COLLECTOR);
-    Connector c = getConnector();
+    ClientContext context = getClientContext();
+    Connector c = context.getConnector();
     String tableName = getUniqueNames(1)[0];
     c.tableOperations().create(tableName);
     writeSomeData(c, tableName, 1, 1);
 
     // wal markers are added lazily
-    Map<String,Boolean> wals = getWALsAndAssertCount(c, 2);
+    Map<String,Boolean> wals = getWALsAndAssertCount(context, 2);
     for (Boolean b : wals.values()) {
       assertTrue("logs should be in use", b);
     }
 
     // roll log, get a new next
     writeSomeData(c, tableName, 1001, 50);
-    Map<String,Boolean> walsAfterRoll = getWALsAndAssertCount(c, 3);
+    Map<String,Boolean> walsAfterRoll = getWALsAndAssertCount(context, 3);
     assertTrue("new WALs should be a superset of the old WALs",
         walsAfterRoll.keySet().containsAll(wals.keySet()));
     assertEquals("all WALs should be in use", 3, countTrue(walsAfterRoll.values()));
@@ -119,14 +121,14 @@ public class WALSunnyDayIT extends ConfigurableMacBase {
     }
     sleepUninterruptibly(1, TimeUnit.SECONDS);
     // rolled WAL is no longer in use, but needs to be GC'd
-    Map<String,Boolean> walsAfterflush = getWALsAndAssertCount(c, 3);
+    Map<String,Boolean> walsAfterflush = getWALsAndAssertCount(context, 3);
     assertEquals("inUse should be 2", 2, countTrue(walsAfterflush.values()));
 
     // let the GC run for a little bit
     control.start(GARBAGE_COLLECTOR);
     sleepUninterruptibly(5, TimeUnit.SECONDS);
     // make sure the unused WAL goes away
-    getWALsAndAssertCount(c, 2);
+    getWALsAndAssertCount(context, 2);
     control.stop(GARBAGE_COLLECTOR);
     // restart the tserver, but don't run recovery on all tablets
     control.stop(TABLET_SERVER);
@@ -149,12 +151,12 @@ public class WALSunnyDayIT extends ConfigurableMacBase {
     verifySomeData(c, tableName, 1001 * 50 + 1);
     writeSomeData(c, tableName, 100, 100);
 
-    Map<String,Boolean> walsAfterRestart = getWALsAndAssertCount(c, 4);
+    Map<String,Boolean> walsAfterRestart = getWALsAndAssertCount(context, 4);
     // log.debug("wals after " + walsAfterRestart);
     assertEquals("used WALs after restart should be 4", 4, countTrue(walsAfterRestart.values()));
     control.start(GARBAGE_COLLECTOR);
     sleepUninterruptibly(5, TimeUnit.SECONDS);
-    Map<String,Boolean> walsAfterRestartAndGC = getWALsAndAssertCount(c, 2);
+    Map<String,Boolean> walsAfterRestartAndGC = getWALsAndAssertCount(context, 2);
     assertEquals("logs in use should be 2", 2, countTrue(walsAfterRestartAndGC.values()));
   }
 
@@ -221,7 +223,7 @@ public class WALSunnyDayIT extends ConfigurableMacBase {
   private final int TIMES_TO_COUNT = 20;
   private final int PAUSE_BETWEEN_COUNTS = 100;
 
-  private Map<String,Boolean> getWALsAndAssertCount(Connector c, int expectedCount)
+  private Map<String,Boolean> getWALsAndAssertCount(ClientContext c, int expectedCount)
       throws Exception {
     // see https://issues.apache.org/jira/browse/ACCUMULO-4110. Sometimes this test counts the logs
     // before
@@ -259,11 +261,11 @@ public class WALSunnyDayIT extends ConfigurableMacBase {
     return waitLonger;
   }
 
-  private Map<String,Boolean> _getWals(Connector c) throws Exception {
+  private Map<String,Boolean> _getWals(ClientContext c) throws Exception {
     Map<String,Boolean> result = new HashMap<>();
-    ZooReaderWriter zk = new ZooReaderWriter(c.info().getZooKeepers(),
-        c.info().getZooKeepersSessionTimeOut(), "");
-    WalStateManager wals = new WalStateManager(c.getInstance(), zk);
+    ZooReaderWriter zk = new ZooReaderWriter(c.getClientInfo().getZooKeepers(),
+        c.getClientInfo().getZooKeepersSessionTimeOut(), "");
+    WalStateManager wals = new WalStateManager(c, zk);
     for (Entry<Path,WalState> entry : wals.getAllState().entrySet()) {
       // WALs are in use if they are not unreferenced
       result.put(entry.getKey().toString(), entry.getValue() != WalState.UNREFERENCED);
diff --git a/test/src/main/java/org/apache/accumulo/test/replication/GarbageCollectorCommunicatesWithTServersIT.java b/test/src/main/java/org/apache/accumulo/test/replication/GarbageCollectorCommunicatesWithTServersIT.java
index a1192c2..6efa312 100644
--- a/test/src/main/java/org/apache/accumulo/test/replication/GarbageCollectorCommunicatesWithTServersIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/replication/GarbageCollectorCommunicatesWithTServersIT.java
@@ -100,14 +100,15 @@ public class GarbageCollectorCommunicatesWithTServersIT extends ConfigurableMacB
    * Fetch all of the WALs referenced by tablets in the metadata table for this table
    */
   private Set<String> getWalsForTable(String tableName) throws Exception {
-    final Connector conn = getConnector();
+    final ClientContext context = new ClientContext(getClientInfo());
+    final Connector conn = context.getConnector();
     final String tableId = conn.tableOperations().tableIdMap().get(tableName);
 
     Assert.assertNotNull("Could not determine table ID for " + tableName, tableId);
 
     ZooReaderWriter zk = new ZooReaderWriter(conn.info().getZooKeepers(),
         conn.info().getZooKeepersSessionTimeOut(), "");
-    WalStateManager wals = new WalStateManager(conn.getInstance(), zk);
+    WalStateManager wals = new WalStateManager(context, zk);
 
     Set<String> result = new HashSet<>();
     for (Entry<Path,WalState> entry : wals.getAllState().entrySet()) {
diff --git a/test/src/main/java/org/apache/accumulo/test/replication/ReplicationIT.java b/test/src/main/java/org/apache/accumulo/test/replication/ReplicationIT.java
index 6f01a5f..4b75487 100644
--- a/test/src/main/java/org/apache/accumulo/test/replication/ReplicationIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/replication/ReplicationIT.java
@@ -48,6 +48,7 @@ import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.client.TableNotFoundException;
 import org.apache.accumulo.core.client.TableOfflineException;
 import org.apache.accumulo.core.client.admin.TableOperations;
+import org.apache.accumulo.core.client.impl.ClientContext;
 import org.apache.accumulo.core.client.impl.Table;
 import org.apache.accumulo.core.conf.ClientProperty;
 import org.apache.accumulo.core.conf.Property;
@@ -141,8 +142,9 @@ public class ReplicationIT extends ConfigurableMacBase {
     hadoopCoreSite.set("fs.file.impl", RawLocalFileSystem.class.getName());
   }
 
-  private Multimap<String,Table.ID> getLogs(Connector conn) throws Exception {
+  private Multimap<String,Table.ID> getLogs(ClientContext context) throws Exception {
     // Map of server to tableId
+    Connector conn = context.getConnector();
     Multimap<TServerInstance,String> serverToTableID = HashMultimap.create();
     try (Scanner scanner = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
       scanner.setRange(MetadataSchema.TabletsSection.getRange());
@@ -157,7 +159,7 @@ public class ReplicationIT extends ConfigurableMacBase {
       Multimap<String,Table.ID> logs = HashMultimap.create();
       ZooReaderWriter zk = new ZooReaderWriter(conn.info().getZooKeepers(),
           conn.info().getZooKeepersSessionTimeOut(), "");
-      WalStateManager wals = new WalStateManager(conn.getInstance(), zk);
+      WalStateManager wals = new WalStateManager(context, zk);
       for (Entry<TServerInstance,List<UUID>> entry : wals.getAllMarkers().entrySet()) {
         for (UUID id : entry.getValue()) {
           Pair<WalState,Path> state = wals.state(entry.getKey(), id);
@@ -170,9 +172,10 @@ public class ReplicationIT extends ConfigurableMacBase {
     }
   }
 
-  private Multimap<String,Table.ID> getAllLogs(Connector conn) throws Exception {
-    Multimap<String,Table.ID> logs = getLogs(conn);
-    try (Scanner scanner = conn.createScanner(ReplicationTable.NAME, Authorizations.EMPTY)) {
+  private Multimap<String,Table.ID> getAllLogs(ClientContext context) throws Exception {
+    Multimap<String,Table.ID> logs = getLogs(context);
+    try (Scanner scanner = context.getConnector().createScanner(ReplicationTable.NAME,
+        Authorizations.EMPTY)) {
       StatusSection.limit(scanner);
       Text buff = new Text();
       for (Entry<Key,Value> entry : scanner) {
@@ -344,7 +347,7 @@ public class ReplicationIT extends ConfigurableMacBase {
     ZooReaderWriter zk = new ZooReaderWriter(conn.info().getZooKeepers(),
         conn.info().getZooKeepersSessionTimeOut(), "");
     while (wals.isEmpty() && attempts > 0) {
-      WalStateManager markers = new WalStateManager(i, zk);
+      WalStateManager markers = new WalStateManager(getClientContext(), zk);
       for (Entry<Path,WalState> entry : markers.getAllState().entrySet()) {
         wals.add(entry.getKey().toString());
       }
@@ -529,6 +532,7 @@ public class ReplicationIT extends ConfigurableMacBase {
 
   @Test
   public void replicationEntriesPrecludeWalDeletion() throws Exception {
+    final ClientContext context = getClientContext();
     final Connector conn = getConnector();
     String table1 = "table1", table2 = "table2", table3 = "table3";
     final Multimap<String,Table.ID> logs = HashMultimap.create();
@@ -541,7 +545,7 @@ public class ReplicationIT extends ConfigurableMacBase {
         // when that happens
         while (keepRunning.get()) {
           try {
-            logs.putAll(getAllLogs(conn));
+            logs.putAll(getAllLogs(context));
           } catch (Exception e) {
             log.error("Error getting logs", e);
           }
@@ -1100,6 +1104,7 @@ public class ReplicationIT extends ConfigurableMacBase {
   public void replicationRecordsAreClosedAfterGarbageCollection() throws Exception {
     getCluster().getClusterControl().stop(ServerType.GARBAGE_COLLECTOR);
 
+    final ClientContext context = getClientContext();
     final Connector conn = getConnector();
 
     ReplicationTable.setOnline(conn);
@@ -1117,7 +1122,7 @@ public class ReplicationIT extends ConfigurableMacBase {
         // when that happens
         while (keepRunning.get()) {
           try {
-            metadataWals.addAll(getLogs(conn).keySet());
+            metadataWals.addAll(getLogs(context).keySet());
           } catch (Exception e) {
             log.error("Metadata table doesn't exist");
           }
diff --git a/test/src/main/java/org/apache/accumulo/test/replication/ReplicationOperationsImplIT.java b/test/src/main/java/org/apache/accumulo/test/replication/ReplicationOperationsImplIT.java
index ed1fcdd..e646268 100644
--- a/test/src/main/java/org/apache/accumulo/test/replication/ReplicationOperationsImplIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/replication/ReplicationOperationsImplIT.java
@@ -89,7 +89,7 @@ public class ReplicationOperationsImplIT extends ConfigurableMacBase {
 
     final MasterClientServiceHandler mcsh = new MasterClientServiceHandler(master) {
       @Override
-      protected Table.ID getTableId(Instance inst, String tableName)
+      protected Table.ID getTableId(ClientContext context, String tableName)
           throws ThriftTableOperationException {
         try {
           return Table.ID.of(conn.tableOperations().tableIdMap().get(tableName));


Mime
View raw message