hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@apache.org
Subject [3/3] git commit: HBASE-11826 Split each tableOrRegionName admin methods into two targetted methods (Carter and Enis)
Date Wed, 03 Sep 2014 21:39:45 GMT
HBASE-11826 Split each tableOrRegionName admin methods into two targetted methods (Carter and Enis)


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

Branch: refs/heads/master
Commit: 1a6eea335f16f92e24834369cd98ea01a60b2db7
Parents: 11ba6ac
Author: Enis Soztutar <enis@apache.org>
Authored: Wed Sep 3 14:39:35 2014 -0700
Committer: Enis Soztutar <enis@apache.org>
Committed: Wed Sep 3 14:39:35 2014 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/client/Admin.java   | 127 ++--
 .../apache/hadoop/hbase/client/HBaseAdmin.java  | 670 +++++++++++--------
 .../hadoop/hbase/IntegrationTestBase.java       |   2 +-
 .../hadoop/hbase/IntegrationTestIngest.java     |  13 +-
 .../IntegrationTestIngestWithEncryption.java    |  12 +-
 .../hbase/IntegrationTestRegionReplicaPerf.java |   7 +-
 .../hbase/chaos/actions/AddColumnAction.java    |   6 +-
 .../chaos/actions/ChangeBloomFilterAction.java  |   8 +-
 .../chaos/actions/ChangeCompressionAction.java  |  10 +-
 .../chaos/actions/ChangeEncodingAction.java     |   6 +-
 .../chaos/actions/ChangeVersionsAction.java     |  10 +-
 .../CompactRandomRegionOfTableAction.java       |  12 +-
 .../hbase/chaos/actions/CompactTableAction.java |  17 +-
 .../actions/FlushRandomRegionOfTableAction.java |  10 +-
 .../hbase/chaos/actions/FlushTableAction.java   |  10 +-
 ...MergeRandomAdjacentRegionsOfTableAction.java |   8 +-
 .../actions/MoveRandomRegionOfTableAction.java  |   8 +-
 .../chaos/actions/MoveRegionsOfTableAction.java |   7 +-
 .../hbase/chaos/actions/RemoveColumnAction.java |  10 +-
 .../chaos/actions/SnapshotTableAction.java      |   7 +-
 .../actions/SplitRandomRegionOfTableAction.java |  10 +-
 .../hbase/chaos/factories/MonkeyFactory.java    |   5 +-
 .../mapreduce/IntegrationTestBulkLoad.java      |  23 +-
 ...IntegrationTestTableSnapshotInputFormat.java |  10 +-
 .../hadoop/hbase/mttr/IntegrationTestMTTR.java  |   3 +-
 .../test/IntegrationTestBigLinkedList.java      |   4 +-
 .../test/IntegrationTestLoadAndVerify.java      |  10 +-
 ...stTimeBoundedRequestsWithRegionReplicas.java |   5 +-
 ...tionTestWithCellVisibilityLoadAndVerify.java |  16 +-
 .../trace/IntegrationTestSendTraceRequests.java |   9 +-
 .../org/apache/hadoop/hbase/TestNamespace.java  |   3 +-
 .../apache/hadoop/hbase/client/TestAdmin.java   |   7 +-
 .../hadoop/hbase/client/TestFromClientSide.java |   2 +-
 .../hbase/client/TestReplicaWithCluster.java    |   2 +-
 .../client/TestSnapshotCloneIndependence.java   |   3 +-
 .../hbase/client/TestTableSnapshotScanner.java  |   2 +-
 .../TestRegionObserverInterface.java            |  17 +-
 .../TestRegionObserverScannerOpenHook.java      |  15 +-
 .../hbase/io/encoding/TestPrefixTree.java       |   2 +-
 .../TableSnapshotInputFormatTestBase.java       |   3 +-
 .../hbase/master/TestAssignmentListener.java    |  10 +-
 .../master/TestDistributedLogSplitting.java     |  12 +-
 .../apache/hadoop/hbase/master/TestMaster.java  |   2 +-
 .../hbase/master/TestTableLockManager.java      |   9 +-
 .../regionserver/TestEncryptionKeyRotation.java |   4 +-
 .../TestEncryptionRandomKeying.java             |   2 +-
 .../TestEndToEndSplitTransaction.java           |   7 +-
 .../TestRegionMergeTransactionOnCluster.java    |   2 +-
 .../regionserver/TestRegionServerMetrics.java   |   2 +-
 .../hadoop/hbase/regionserver/TestTags.java     |  39 +-
 .../hbase/regionserver/wal/TestLogRolling.java  |  21 +-
 .../hadoop/hbase/rest/TestTableResource.java    |   7 +-
 .../security/access/TestTablePermissions.java   |   7 +-
 .../TestVisibilityLabelsWithDeletes.java        | 167 +++--
 .../TestVisibilityWithCheckAuths.java           |  15 +-
 .../apache/hadoop/hbase/util/TestHBaseFsck.java |  43 +-
 .../hbase/util/TestHBaseFsckEncryption.java     |   2 +-
 57 files changed, 798 insertions(+), 664 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/1a6eea33/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java
index 2c9b5a3..0fe2ff3 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java
@@ -482,102 +482,102 @@ public interface Admin extends Abortable, Closeable {
   List<HRegionInfo> getOnlineRegions(final ServerName sn) throws IOException;
 
   /**
-   * Flush a table or an individual region. Synchronous operation.
+   * Flush a table. Synchronous operation.
    *
-   * @param tableNameOrRegionName table or region to flush
+   * @param tableName table to flush
    * @throws IOException if a remote or network exception occurs
    * @throws InterruptedException
    */
-  void flush(final String tableNameOrRegionName) throws IOException, InterruptedException;
+  void flush(final TableName tableName) throws IOException, InterruptedException;
 
   /**
-   * Flush a table or an individual region. Synchronous operation.
+   * Flush an individual region. Synchronous operation.
    *
-   * @param tableNameOrRegionName table or region to flush
+   * @param regionName region to flush
    * @throws IOException if a remote or network exception occurs
    * @throws InterruptedException
    */
-  void flush(final byte[] tableNameOrRegionName) throws IOException, InterruptedException;
+  void flushRegion(final byte[] regionName) throws IOException, InterruptedException;
 
   /**
-   * Compact a table or an individual region. Asynchronous operation.
+   * Compact a table. Asynchronous operation.
    *
-   * @param tableNameOrRegionName table or region to compact
+   * @param tableName table to compact
    * @throws IOException if a remote or network exception occurs
    * @throws InterruptedException
    */
-  void compact(final String tableNameOrRegionName) throws IOException, InterruptedException;
+  void compact(final TableName tableName) throws IOException, InterruptedException;
 
   /**
-   * Compact a table or an individual region. Asynchronous operation.
+   * Compact an individual region. Asynchronous operation.
    *
-   * @param tableNameOrRegionName table or region to compact
+   * @param regionName region to compact
    * @throws IOException if a remote or network exception occurs
    * @throws InterruptedException
    */
-  void compact(final byte[] tableNameOrRegionName) throws IOException, InterruptedException;
+  void compactRegion(final byte[] regionName) throws IOException, InterruptedException;
 
   /**
-   * Compact a column family within a table or region. Asynchronous operation.
+   * Compact a column family within a table. Asynchronous operation.
    *
-   * @param tableOrRegionName table or region to compact
-   * @param columnFamily column family within a table or region
+   * @param tableName table to compact
+   * @param columnFamily column family within a table
    * @throws IOException if a remote or network exception occurs
    * @throws InterruptedException
    */
-  void compact(String tableOrRegionName, String columnFamily)
-      throws IOException, InterruptedException;
+  void compact(final TableName tableName, final byte[] columnFamily)
+    throws IOException, InterruptedException;
 
   /**
-   * Compact a column family within a table or region. Asynchronous operation.
+   * Compact a column family within a region. Asynchronous operation.
    *
-   * @param tableNameOrRegionName table or region to compact
-   * @param columnFamily column family within a table or region
+   * @param regionName region to compact
+   * @param columnFamily column family within a region
    * @throws IOException if a remote or network exception occurs
    * @throws InterruptedException
    */
-  void compact(final byte[] tableNameOrRegionName, final byte[] columnFamily)
-      throws IOException, InterruptedException;
+  void compactRegion(final byte[] regionName, final byte[] columnFamily)
+    throws IOException, InterruptedException;
 
   /**
-   * Major compact a table or an individual region. Asynchronous operation.
+   * Major compact a table. Asynchronous operation.
    *
-   * @param tableNameOrRegionName table or region to major compact
+   * @param tableName table to major compact
    * @throws IOException if a remote or network exception occurs
    * @throws InterruptedException
    */
-  void majorCompact(final String tableNameOrRegionName) throws IOException, InterruptedException;
+  void majorCompact(TableName tableName) throws IOException, InterruptedException;
 
   /**
    * Major compact a table or an individual region. Asynchronous operation.
    *
-   * @param tableNameOrRegionName table or region to major compact
+   * @param regionName region to major compact
    * @throws IOException if a remote or network exception occurs
    * @throws InterruptedException
    */
-  void majorCompact(final byte[] tableNameOrRegionName) throws IOException, InterruptedException;
+  void majorCompactRegion(final byte[] regionName) throws IOException, InterruptedException;
 
   /**
-   * Major compact a column family within a table or region. Asynchronous operation.
+   * Major compact a column family within a table. Asynchronous operation.
    *
-   * @param tableNameOrRegionName table or region to major compact
-   * @param columnFamily column family within a table or region
+   * @param tableName table to major compact
+   * @param columnFamily column family within a table
    * @throws IOException if a remote or network exception occurs
    * @throws InterruptedException
    */
-  void majorCompact(final String tableNameOrRegionName, final String columnFamily)
-      throws IOException, InterruptedException;
+  void majorCompact(TableName tableName, final byte[] columnFamily)
+    throws IOException, InterruptedException;
 
   /**
-   * Major compact a column family within a table or region. Asynchronous operation.
+   * Major compact a column family within region. Asynchronous operation.
    *
-   * @param tableNameOrRegionName table or region to major compact
-   * @param columnFamily column family within a table or region
+   * @param regionName egion to major compact
+   * @param columnFamily column family within a region
    * @throws IOException if a remote or network exception occurs
    * @throws InterruptedException
    */
-  void majorCompact(final byte[] tableNameOrRegionName, final byte[] columnFamily)
-      throws IOException, InterruptedException;
+  void majorCompactRegion(final byte[] regionName, final byte[] columnFamily)
+    throws IOException, InterruptedException;
 
   /**
    * Move the region <code>r</code> to <code>dest</code>.
@@ -692,37 +692,44 @@ public interface Admin extends Abortable, Closeable {
       final boolean forcible) throws IOException;
 
   /**
-   * Split a table or an individual region. Asynchronous operation.
+   * Split a table. Asynchronous operation.
    *
-   * @param tableNameOrRegionName table or region to split
+   * @param tableName table to split
    * @throws IOException if a remote or network exception occurs
    * @throws InterruptedException
    */
-  void split(final String tableNameOrRegionName) throws IOException, InterruptedException;
+  void split(final TableName tableName) throws IOException, InterruptedException;
 
   /**
-   * Split a table or an individual region.  Implicitly finds an optimal split point.  Asynchronous
-   * operation.
+   * Split an individual region. Asynchronous operation.
    *
-   * @param tableNameOrRegionName table to region to split
+   * @param regionName region to split
    * @throws IOException if a remote or network exception occurs
    * @throws InterruptedException
    */
-  void split(final byte[] tableNameOrRegionName) throws IOException, InterruptedException;
+  void splitRegion(final byte[] regionName) throws IOException, InterruptedException;
 
-  void split(final String tableNameOrRegionName, final String splitPoint)
-      throws IOException, InterruptedException;
+  /**
+   * Split a table. Asynchronous operation.
+   *
+   * @param tableName table to split
+   * @param splitPoint the explicit position to split on
+   * @throws IOException if a remote or network exception occurs
+   * @throws InterruptedException interrupt exception occurred
+   */
+  void split(final TableName tableName, final byte[] splitPoint)
+    throws IOException, InterruptedException;
 
   /**
-   * Split a table or an individual region. Asynchronous operation.
+   * Split an individual region. Asynchronous operation.
    *
-   * @param tableNameOrRegionName table to region to split
+   * @param regionName region to split
    * @param splitPoint the explicit position to split on
    * @throws IOException if a remote or network exception occurs
    * @throws InterruptedException interrupt exception occurred
    */
-  void split(final byte[] tableNameOrRegionName, final byte[] splitPoint)
-      throws IOException, InterruptedException;
+  void splitRegion(final byte[] regionName, final byte[] splitPoint)
+    throws IOException, InterruptedException;
 
   /**
    * Modify an existing table, more IRB friendly version. Asynchronous operation.  This means that
@@ -880,28 +887,28 @@ public interface Admin extends Abortable, Closeable {
   String[] getMasterCoprocessors();
 
   /**
-   * Get the current compaction state of a table or region. It could be in a major compaction, a
-   * minor compaction, both, or none.
+   * Get the current compaction state of a table. It could be in a major compaction, a minor
+   * compaction, both, or none.
    *
-   * @param tableNameOrRegionName table or region to major compact
+   * @param tableName table to examine
    * @return the current compaction state
    * @throws IOException if a remote or network exception occurs
    * @throws InterruptedException
    */
-  AdminProtos.GetRegionInfoResponse.CompactionState getCompactionState(
-      final String tableNameOrRegionName) throws IOException, InterruptedException;
+  AdminProtos.GetRegionInfoResponse.CompactionState getCompactionState(final TableName tableName)
+    throws IOException, InterruptedException;
 
   /**
-   * Get the current compaction state of a table or region. It could be in a major compaction, a
-   * minor compaction, both, or none.
+   * Get the current compaction state of region. It could be in a major compaction, a minor
+   * compaction, both, or none.
    *
-   * @param tableNameOrRegionName table or region to major compact
+   * @param regionName region to examine
    * @return the current compaction state
    * @throws IOException if a remote or network exception occurs
    * @throws InterruptedException
    */
-  AdminProtos.GetRegionInfoResponse.CompactionState getCompactionState(
-      final byte[] tableNameOrRegionName) throws IOException, InterruptedException;
+  AdminProtos.GetRegionInfoResponse.CompactionState getCompactionStateForRegion(
+    final byte[] regionName) throws IOException, InterruptedException;
 
   /**
    * Take a snapshot for the given table. If the table is enabled, a FLUSH-type snapshot will be

http://git-wip-us.apache.org/repos/asf/hbase/blob/1a6eea33/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
index 5d25c0b..b659e87 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
@@ -269,6 +269,7 @@ public class HBaseAdmin implements Admin {
    * @return True if table exists already.
    * @throws IOException
    */
+  @Override
   public boolean tableExists(final TableName tableName) throws IOException {
     return MetaTableAccessor.tableExists(connection, tableName);
   }
@@ -1466,47 +1467,56 @@ public class HBaseAdmin implements Admin {
   }
 
   /**
-   * Flush a table or an individual region.
-   * Synchronous operation.
-   *
-   * @param tableNameOrRegionName table or region to flush
-   * @throws IOException if a remote or network exception occurs
-   * @throws InterruptedException
+   * {@inheritDoc}
    */
   @Override
+  public void flush(final TableName tableName) throws IOException, InterruptedException {
+    checkTableExists(tableName);
+    if (isTableDisabled(tableName)) {
+      LOG.info("Table is disabled: " + tableName.getNameAsString());
+      return;
+    }
+    execProcedure("flush-table-proc", tableName.getNameAsString(),
+      new HashMap<String, String>());
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public void flushRegion(final byte[] regionName) throws IOException, InterruptedException {
+    Pair<HRegionInfo, ServerName> regionServerPair = getRegion(regionName);
+    if (regionServerPair == null) {
+      throw new IllegalArgumentException("Unknown regionname: " + Bytes.toStringBinary(regionName));
+    }
+    if (regionServerPair.getSecond() == null) {
+      throw new NoServerForRegionException(Bytes.toStringBinary(regionName));
+    }
+    flush(regionServerPair.getSecond(), regionServerPair.getFirst());
+  }
+
+  /**
+   * @deprecated Use {@link #flush(org.apache.hadoop.hbase.TableName)} or {@link #flushRegion
+   * (byte[])} instead.
+   */
+  @Deprecated
   public void flush(final String tableNameOrRegionName)
   throws IOException, InterruptedException {
     flush(Bytes.toBytes(tableNameOrRegionName));
   }
 
   /**
-   * Flush a table or an individual region.
-   * Synchronous operation.
-   *
-   * @param tableNameOrRegionName table or region to flush
-   * @throws IOException if a remote or network exception occurs
-   * @throws InterruptedException
+   * @deprecated Use {@link #flush(org.apache.hadoop.hbase.TableName)} or {@link #flushRegion
+   * (byte[])} instead.
    */
-  @Override
+  @Deprecated
   public void flush(final byte[] tableNameOrRegionName)
   throws IOException, InterruptedException {
-    Pair<HRegionInfo, ServerName> regionServerPair
-      = getRegion(tableNameOrRegionName);
-    if (regionServerPair != null) {
-      if (regionServerPair.getSecond() == null) {
-        throw new NoServerForRegionException(Bytes.toStringBinary(tableNameOrRegionName));
-      } else {
-        flush(regionServerPair.getSecond(), regionServerPair.getFirst());
-      }
-    } else {
-      final TableName tableName = checkTableExists(
-          TableName.valueOf(tableNameOrRegionName));
-      if (isTableDisabled(tableName)) {
-        LOG.info("Table is disabled: " + tableName.getNameAsString());
-        return;
-      }
-      execProcedure("flush-table-proc", tableName.getNameAsString(),
-        new HashMap<String, String>());
+    try {
+      flushRegion(tableNameOrRegionName);
+    } catch (IllegalArgumentException e) {
+      // Unknown region.  Try table.
+      flush(TableName.valueOf(tableNameOrRegionName));
     }
   }
 
@@ -1523,164 +1533,205 @@ public class HBaseAdmin implements Admin {
   }
 
   /**
-   * Compact a table or an individual region.
-   * Asynchronous operation.
-   *
-   * @param tableNameOrRegionName table or region to compact
-   * @throws IOException if a remote or network exception occurs
-   * @throws InterruptedException
+   * {@inheritDoc}
    */
   @Override
+  public void compact(final TableName tableName)
+    throws IOException, InterruptedException {
+    compact(tableName, null, false);
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public void compactRegion(final byte[] regionName)
+    throws IOException, InterruptedException {
+    compactRegion(regionName, null, false);
+  }
+
+  /**
+   * @deprecated Use {@link #compact(org.apache.hadoop.hbase.TableName)} or {@link #compactRegion
+   * (byte[])} instead.
+   */
+  @Deprecated
   public void compact(final String tableNameOrRegionName)
   throws IOException, InterruptedException {
     compact(Bytes.toBytes(tableNameOrRegionName));
   }
 
   /**
-   * Compact a table or an individual region.
-   * Asynchronous operation.
-   *
-   * @param tableNameOrRegionName table or region to compact
-   * @throws IOException if a remote or network exception occurs
-   * @throws InterruptedException
+   * @deprecated Use {@link #compact(org.apache.hadoop.hbase.TableName)} or {@link #compactRegion
+   * (byte[])} instead.
    */
-  @Override
+  @Deprecated
   public void compact(final byte[] tableNameOrRegionName)
   throws IOException, InterruptedException {
-    compact(tableNameOrRegionName, null, false);
+    try {
+      compactRegion(tableNameOrRegionName, null, false);
+    } catch (IllegalArgumentException e) {
+      compact(TableName.valueOf(tableNameOrRegionName), null, false);
+    }
   }
 
   /**
-   * Compact a column family within a table or region.
-   * Asynchronous operation.
-   *
-   * @param tableOrRegionName table or region to compact
-   * @param columnFamily column family within a table or region
-   * @throws IOException if a remote or network exception occurs
-   * @throws InterruptedException
+   * {@inheritDoc}
    */
   @Override
+  public void compact(final TableName tableName, final byte[] columnFamily)
+    throws IOException, InterruptedException {
+    compact(tableName, columnFamily, false);
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public void compactRegion(final byte[] regionName, final byte[] columnFamily)
+    throws IOException, InterruptedException {
+    compactRegion(regionName, columnFamily, false);
+  }
+
+  /**
+   * @deprecated Use {@link #compact(org.apache.hadoop.hbase.TableName)} or {@link #compactRegion
+   * (byte[], byte[])} instead.
+   */
+  @Deprecated
   public void compact(String tableOrRegionName, String columnFamily)
     throws IOException,  InterruptedException {
     compact(Bytes.toBytes(tableOrRegionName), Bytes.toBytes(columnFamily));
   }
 
   /**
-   * Compact a column family within a table or region.
-   * Asynchronous operation.
-   *
-   * @param tableNameOrRegionName table or region to compact
-   * @param columnFamily column family within a table or region
-   * @throws IOException if a remote or network exception occurs
-   * @throws InterruptedException
+   * @deprecated Use {@link #compact(org.apache.hadoop.hbase.TableName)} or {@link #compactRegion
+   * (byte[], byte[])} instead.
    */
-  @Override
+  @Deprecated
   public void compact(final byte[] tableNameOrRegionName, final byte[] columnFamily)
   throws IOException, InterruptedException {
-    compact(tableNameOrRegionName, columnFamily, false);
+    try {
+      compactRegion(tableNameOrRegionName, columnFamily, false);
+    } catch (IllegalArgumentException e) {
+      // Bad region, try table
+      compact(TableName.valueOf(tableNameOrRegionName), columnFamily, false);
+    }
   }
 
   /**
-   * Major compact a table or an individual region.
-   * Asynchronous operation.
-   *
-   * @param tableNameOrRegionName table or region to major compact
-   * @throws IOException if a remote or network exception occurs
-   * @throws InterruptedException
+   * {@inheritDoc}
+   */
+  @Override
+  public void majorCompact(final TableName tableName)
+  throws IOException, InterruptedException {
+    compact(tableName, null, true);
+  }
+
+  /**
+   * {@inheritDoc}
    */
   @Override
+  public void majorCompactRegion(final byte[] regionName)
+  throws IOException, InterruptedException {
+    compactRegion(regionName, null, true);
+  }
+
+  /**
+   * @deprecated Use {@link #majorCompact(org.apache.hadoop.hbase.TableName)} or {@link
+   * #majorCompactRegion(byte[])} instead.
+   */
+  @Deprecated
   public void majorCompact(final String tableNameOrRegionName)
   throws IOException, InterruptedException {
     majorCompact(Bytes.toBytes(tableNameOrRegionName));
   }
 
   /**
-   * Major compact a table or an individual region.
-   * Asynchronous operation.
-   *
-   * @param tableNameOrRegionName table or region to major compact
-   * @throws IOException if a remote or network exception occurs
-   * @throws InterruptedException
+   * @deprecated Use {@link #majorCompact(org.apache.hadoop.hbase.TableName)} or {@link
+   * #majorCompactRegion(byte[])} instead.
    */
-  @Override
+  @Deprecated
   public void majorCompact(final byte[] tableNameOrRegionName)
   throws IOException, InterruptedException {
-    compact(tableNameOrRegionName, null, true);
+    try {
+      compactRegion(tableNameOrRegionName, null, true);
+    } catch (IllegalArgumentException e) {
+      // Invalid region, try table
+      compact(TableName.valueOf(tableNameOrRegionName), null, true);
+    }
   }
 
   /**
-   * Major compact a column family within a table or region.
-   * Asynchronous operation.
-   *
-   * @param tableNameOrRegionName table or region to major compact
-   * @param columnFamily column family within a table or region
-   * @throws IOException if a remote or network exception occurs
-   * @throws InterruptedException
+   * {@inheritDoc}
    */
   @Override
-  public void majorCompact(final String tableNameOrRegionName,
-    final String columnFamily) throws IOException, InterruptedException {
-    majorCompact(Bytes.toBytes(tableNameOrRegionName),
-      Bytes.toBytes(columnFamily));
+  public void majorCompact(final TableName tableName, final byte[] columnFamily)
+  throws IOException, InterruptedException {
+    compact(tableName, columnFamily, true);
   }
 
   /**
-   * Major compact a column family within a table or region.
-   * Asynchronous operation.
-   *
-   * @param tableNameOrRegionName table or region to major compact
-   * @param columnFamily column family within a table or region
-   * @throws IOException if a remote or network exception occurs
-   * @throws InterruptedException
+   * {@inheritDoc}
    */
   @Override
-  public void majorCompact(final byte[] tableNameOrRegionName,
-    final byte[] columnFamily) throws IOException, InterruptedException {
-    compact(tableNameOrRegionName, columnFamily, true);
+  public void majorCompactRegion(final byte[] regionName, final byte[] columnFamily)
+  throws IOException, InterruptedException {
+    compactRegion(regionName, columnFamily, true);
   }
 
   /**
-   * Compact a table or an individual region.
+   * @deprecated Use {@link #majorCompact(org.apache.hadoop.hbase.TableName,
+   * byte[])} or {@link #majorCompactRegion(byte[], byte[])} instead.
+   */
+  @Deprecated
+  public void majorCompact(final String tableNameOrRegionName, final String columnFamily)
+  throws IOException, InterruptedException {
+    majorCompact(Bytes.toBytes(tableNameOrRegionName), Bytes.toBytes(columnFamily));
+  }
+
+  /**
+   * @deprecated Use {@link #majorCompact(org.apache.hadoop.hbase.TableName,
+   * byte[])} or {@link #majorCompactRegion(byte[], byte[])} instead.
+   */
+  @Deprecated
+  public void majorCompact(final byte[] tableNameOrRegionName, final byte[] columnFamily)
+  throws IOException, InterruptedException {
+    try {
+      compactRegion(tableNameOrRegionName, columnFamily, true);
+    } catch (IllegalArgumentException e) {
+      // Invalid region, try table
+      compact(TableName.valueOf(tableNameOrRegionName), columnFamily, true);
+    }
+  }
+
+  /**
+   * Compact a table.
    * Asynchronous operation.
    *
-   * @param tableNameOrRegionName table or region to compact
+   * @param tableName table or region to compact
    * @param columnFamily column family within a table or region
    * @param major True if we are to do a major compaction.
    * @throws IOException if a remote or network exception occurs
    * @throws InterruptedException
    */
-  private void compact(final byte[] tableNameOrRegionName,
-    final byte[] columnFamily,final boolean major)
+  private void compact(final TableName tableName, final byte[] columnFamily,final boolean major)
   throws IOException, InterruptedException {
     ZooKeeperWatcher zookeeper = null;
     try {
-      Pair<HRegionInfo, ServerName> regionServerPair
-        = getRegion(tableNameOrRegionName);
-      if (regionServerPair != null) {
-        if (regionServerPair.getSecond() == null) {
-          throw new NoServerForRegionException(Bytes.toStringBinary(tableNameOrRegionName));
-        } else {
-          compact(regionServerPair.getSecond(), regionServerPair.getFirst(), major, columnFamily);
-        }
-      } else {
-        final TableName tableName =
-            checkTableExists(TableName.valueOf(tableNameOrRegionName));
-        zookeeper = new ZooKeeperWatcher(conf, ZK_IDENTIFIER_PREFIX + connection.toString(),
-            new ThrowableAbortable());
-        List<Pair<HRegionInfo, ServerName>> pairs =
-          MetaTableAccessor.getTableRegionsAndLocations(zookeeper, connection,
-            tableName);
-        for (Pair<HRegionInfo, ServerName> pair: pairs) {
-          if (pair.getFirst().isOffline()) continue;
-          if (pair.getSecond() == null) continue;
-          try {
-            compact(pair.getSecond(), pair.getFirst(), major, columnFamily);
-          } catch (NotServingRegionException e) {
-            if (LOG.isDebugEnabled()) {
-              LOG.debug("Trying to" + (major ? " major" : "") + " compact " +
-                pair.getFirst() + ": " +
-                StringUtils.stringifyException(e));
-            }
+      checkTableExists(tableName);
+      zookeeper = new ZooKeeperWatcher(conf, ZK_IDENTIFIER_PREFIX + connection.toString(),
+          new ThrowableAbortable());
+      List<Pair<HRegionInfo, ServerName>> pairs =
+        MetaTableAccessor.getTableRegionsAndLocations(zookeeper, connection, tableName);
+      for (Pair<HRegionInfo, ServerName> pair: pairs) {
+        if (pair.getFirst().isOffline()) continue;
+        if (pair.getSecond() == null) continue;
+        try {
+          compact(pair.getSecond(), pair.getFirst(), major, columnFamily);
+        } catch (NotServingRegionException e) {
+          if (LOG.isDebugEnabled()) {
+            LOG.debug("Trying to" + (major ? " major" : "") + " compact " +
+              pair.getFirst() + ": " +
+              StringUtils.stringifyException(e));
           }
         }
       }
@@ -1691,6 +1742,28 @@ public class HBaseAdmin implements Admin {
     }
   }
 
+  /**
+   * Compact an individual region.
+   * Asynchronous operation.
+   *
+   * @param regionName region to compact
+   * @param columnFamily column family within a table or region
+   * @param major True if we are to do a major compaction.
+   * @throws IOException if a remote or network exception occurs
+   * @throws InterruptedException
+   */
+  private void compactRegion(final byte[] regionName, final byte[] columnFamily,final boolean major)
+  throws IOException, InterruptedException {
+    Pair<HRegionInfo, ServerName> regionServerPair = getRegion(regionName);
+    if (regionServerPair == null) {
+      throw new IllegalArgumentException("Invalid region: " + Bytes.toStringBinary(regionName));
+    }
+    if (regionServerPair.getSecond() == null) {
+      throw new NoServerForRegionException(Bytes.toStringBinary(regionName));
+    }
+    compact(regionServerPair.getSecond(), regionServerPair.getFirst(), major, columnFamily);
+  }
+
   private void compact(final ServerName sn, final HRegionInfo hri,
       final boolean major, final byte [] family)
   throws IOException {
@@ -1726,7 +1799,7 @@ public class HBaseAdmin implements Admin {
     try {
       MoveRegionRequest request =
         RequestConverter.buildMoveRegionRequest(encodedRegionName, destServerName);
-      stub.moveRegion(null,request);
+      stub.moveRegion(null, request);
     } catch (ServiceException se) {
       IOException ioe = ProtobufUtil.getRemoteException(se);
       if (ioe instanceof HBaseIOException) {
@@ -1785,7 +1858,7 @@ public class HBaseAdmin implements Admin {
       public Void call(int callTimeout) throws ServiceException {
         UnassignRegionRequest request =
           RequestConverter.buildUnassignRegionRequest(toBeUnassigned, force);
-        master.unassignRegion(null,request);
+        master.unassignRegion(null, request);
         return null;
       }
     });
@@ -1858,7 +1931,7 @@ public class HBaseAdmin implements Admin {
   throws MasterNotRunningException, ZooKeeperConnectionException, ServiceException {
     MasterKeepAliveConnection stub = connection.getKeepAliveMasterService();
     try {
-      return stub.balance(null,RequestConverter.buildBalanceRequest()).getBalancerRan();
+      return stub.balance(null, RequestConverter.buildBalanceRequest()).getBalancerRan();
     } finally {
       stub.close();
     }
@@ -1877,7 +1950,7 @@ public class HBaseAdmin implements Admin {
     MasterKeepAliveConnection stub = connection.getKeepAliveMasterService();
     try {
       return stub.enableCatalogJanitor(null,
-          RequestConverter.buildEnableCatalogJanitorRequest(enable)).getPrevValue();
+        RequestConverter.buildEnableCatalogJanitorRequest(enable)).getPrevValue();
     } finally {
       stub.close();
     }
@@ -1894,7 +1967,7 @@ public class HBaseAdmin implements Admin {
     MasterKeepAliveConnection stub = connection.getKeepAliveMasterService();
     try {
       return stub.runCatalogScan(null,
-          RequestConverter.buildCatalogScanRequest()).getScanResult();
+        RequestConverter.buildCatalogScanRequest()).getScanResult();
     } finally {
       stub.close();
     }
@@ -1910,7 +1983,7 @@ public class HBaseAdmin implements Admin {
     MasterKeepAliveConnection stub = connection.getKeepAliveMasterService();
     try {
       return stub.isCatalogJanitorEnabled(null,
-          RequestConverter.buildIsCatalogJanitorEnabledRequest()).getValue();
+        RequestConverter.buildIsCatalogJanitorEnabledRequest()).getValue();
     } finally {
       stub.close();
     }
@@ -1953,85 +2026,112 @@ public class HBaseAdmin implements Admin {
   }
 
   /**
-   * Split a table or an individual region.
-   * Asynchronous operation.
-   *
-   * @param tableNameOrRegionName table or region to split
-   * @throws IOException if a remote or network exception occurs
-   * @throws InterruptedException
+   * {@inheritDoc}
    */
   @Override
+  public void split(final TableName tableName)
+    throws IOException, InterruptedException {
+    split(tableName, null);
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public void splitRegion(final byte[] regionName)
+    throws IOException, InterruptedException {
+    splitRegion(regionName, null);
+  }
+
+  /**
+   * @deprecated Use {@link #split(org.apache.hadoop.hbase.TableName)} or {@link #splitRegion
+   * (byte[])} instead.
+   */
+  @Deprecated
   public void split(final String tableNameOrRegionName)
   throws IOException, InterruptedException {
     split(Bytes.toBytes(tableNameOrRegionName));
   }
 
   /**
-   * Split a table or an individual region.  Implicitly finds an optimal split
-   * point.  Asynchronous operation.
-   *
-   * @param tableNameOrRegionName table to region to split
-   * @throws IOException if a remote or network exception occurs
-   * @throws InterruptedException
+   * @deprecated Use {@link #split(org.apache.hadoop.hbase.TableName)} or {@link #splitRegion
+   * (byte[])} instead.
    */
-  @Override
+  @Deprecated
   public void split(final byte[] tableNameOrRegionName)
   throws IOException, InterruptedException {
     split(tableNameOrRegionName, null);
   }
 
+  /**
+   * {@inheritDoc}
+   */
   @Override
+  public void split(final TableName tableName, final byte [] splitPoint)
+  throws IOException, InterruptedException {
+    ZooKeeperWatcher zookeeper = null;
+    try {
+      checkTableExists(tableName);
+      zookeeper = new ZooKeeperWatcher(conf, ZK_IDENTIFIER_PREFIX + connection.toString(),
+        new ThrowableAbortable());
+      List<Pair<HRegionInfo, ServerName>> pairs =
+        MetaTableAccessor.getTableRegionsAndLocations(zookeeper, connection, tableName);
+      for (Pair<HRegionInfo, ServerName> pair: pairs) {
+        // May not be a server for a particular row
+        if (pair.getSecond() == null) continue;
+        HRegionInfo r = pair.getFirst();
+        // check for parents
+        if (r.isSplitParent()) continue;
+        // if a split point given, only split that particular region
+        if (splitPoint != null && !r.containsRow(splitPoint)) continue;
+        // call out to region server to do split now
+        split(pair.getSecond(), pair.getFirst(), splitPoint);
+      }
+    } finally {
+      if (zookeeper != null) {
+        zookeeper.close();
+      }
+    }
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public void splitRegion(final byte[] regionName, final byte [] splitPoint)
+  throws IOException, InterruptedException {
+    Pair<HRegionInfo, ServerName> regionServerPair = getRegion(regionName);
+    if (regionServerPair == null) {
+      throw new IllegalArgumentException("Invalid region: " + Bytes.toStringBinary(regionName));
+    }
+    if (regionServerPair.getSecond() == null) {
+      throw new NoServerForRegionException(Bytes.toStringBinary(regionName));
+    }
+    split(regionServerPair.getSecond(), regionServerPair.getFirst(), splitPoint);
+  }
+
+  /**
+   * @deprecated Use {@link #split(org.apache.hadoop.hbase.TableName,
+   * byte[])} or {@link #splitRegion(byte[], byte[])} instead.
+   */
+  @Deprecated
   public void split(final String tableNameOrRegionName,
     final String splitPoint) throws IOException, InterruptedException {
     split(Bytes.toBytes(tableNameOrRegionName), Bytes.toBytes(splitPoint));
   }
 
   /**
-   * Split a table or an individual region.
-   * Asynchronous operation.
-   *
-   * @param tableNameOrRegionName table to region to split
-   * @param splitPoint the explicit position to split on
-   * @throws IOException if a remote or network exception occurs
-   * @throws InterruptedException interrupt exception occurred
+   * @deprecated Use {@link #split(org.apache.hadoop.hbase.TableName,
+   * byte[])} or {@link #splitRegion(byte[], byte[])} instead.
    */
-  @Override
+  @Deprecated
   public void split(final byte[] tableNameOrRegionName,
       final byte [] splitPoint) throws IOException, InterruptedException {
-    ZooKeeperWatcher zookeeper = null;
     try {
-      Pair<HRegionInfo, ServerName> regionServerPair
-        = getRegion(tableNameOrRegionName);
-      if (regionServerPair != null) {
-        if (regionServerPair.getSecond() == null) {
-            throw new NoServerForRegionException(Bytes.toStringBinary(tableNameOrRegionName));
-        } else {
-          split(regionServerPair.getSecond(), regionServerPair.getFirst(), splitPoint);
-        }
-      } else {
-        final TableName tableName =
-            checkTableExists(TableName.valueOf(tableNameOrRegionName));
-        zookeeper = new ZooKeeperWatcher(conf, ZK_IDENTIFIER_PREFIX + connection.toString(),
-            new ThrowableAbortable());
-        List<Pair<HRegionInfo, ServerName>> pairs =
-          MetaTableAccessor.getTableRegionsAndLocations(zookeeper, connection,
-            tableName);
-        for (Pair<HRegionInfo, ServerName> pair: pairs) {
-          // May not be a server for a particular row
-          if (pair.getSecond() == null) continue;
-          HRegionInfo r = pair.getFirst();
-          // check for parents
-          if (r.isSplitParent()) continue;
-          // if a split point given, only split that particular region
-          if (splitPoint != null && !r.containsRow(splitPoint)) continue;
-          // call out to region server to do split now
-          split(pair.getSecond(), pair.getFirst(), splitPoint);
-        }
-      }
-    } finally {
-      if (zookeeper != null) {
-        zookeeper.close();
-      }
+      splitRegion(tableNameOrRegionName, splitPoint);
+    } catch (IllegalArgumentException e) {
+      // Bad region, try table
+      split(TableName.valueOf(tableNameOrRegionName), splitPoint);
     }
   }
 
@@ -2083,24 +2183,24 @@ public class HBaseAdmin implements Admin {
   }
 
   /**
-   * @param tableNameOrRegionName Name of a table or name of a region.
-   * @return a pair of HRegionInfo and ServerName if <code>tableNameOrRegionName</code> is
+   * @param regionName Name of a region.
+   * @return a pair of HRegionInfo and ServerName if <code>regionName</code> is
    *  a verified region name (we call {@link
    *  MetaTableAccessor#getRegion(HConnection, byte[])}
    *  else null.
-   * Throw an exception if <code>tableNameOrRegionName</code> is null.
+   * Throw IllegalArgumentException if <code>regionName</code> is null.
    * @throws IOException
    */
-  Pair<HRegionInfo, ServerName> getRegion(final byte[] tableNameOrRegionName) throws IOException {
-    if (tableNameOrRegionName == null) {
+  Pair<HRegionInfo, ServerName> getRegion(final byte[] regionName) throws IOException {
+    if (regionName == null) {
       throw new IllegalArgumentException("Pass a table name or region name");
     }
     Pair<HRegionInfo, ServerName> pair =
-      MetaTableAccessor.getRegion(connection, tableNameOrRegionName);
+      MetaTableAccessor.getRegion(connection, regionName);
     if (pair == null) {
       final AtomicReference<Pair<HRegionInfo, ServerName>> result =
         new AtomicReference<Pair<HRegionInfo, ServerName>>(null);
-      final String encodedName = Bytes.toString(tableNameOrRegionName);
+      final String encodedName = Bytes.toString(regionName);
       MetaScannerVisitor visitor = new MetaScannerVisitorBase() {
         @Override
         public boolean processRow(Result data) throws IOException {
@@ -2187,7 +2287,7 @@ public class HBaseAdmin implements Admin {
     executeCallable(new MasterCallable<Void>(getConnection()) {
       @Override
       public Void call(int callTimeout) throws ServiceException {
-        master.stopMaster(null,StopMasterRequest.newBuilder().build());
+        master.stopMaster(null, StopMasterRequest.newBuilder().build());
         return null;
       }
     });
@@ -2226,7 +2326,7 @@ public class HBaseAdmin implements Admin {
       @Override
       public ClusterStatus call(int callTimeout) throws ServiceException {
         GetClusterStatusRequest req = RequestConverter.buildGetClusterStatusRequest();
-        return ClusterStatus.convert(master.getClusterStatus(null,req).getClusterStatus());
+        return ClusterStatus.convert(master.getClusterStatus(null, req).getClusterStatus());
       }
     });
   }
@@ -2257,8 +2357,9 @@ public class HBaseAdmin implements Admin {
       public Void call(int callTimeout) throws Exception {
         master.createNamespace(null,
           CreateNamespaceRequest.newBuilder()
-                .setNamespaceDescriptor(ProtobufUtil
-                    .toProtoNamespaceDescriptor(descriptor)).build());
+            .setNamespaceDescriptor(ProtobufUtil
+              .toProtoNamespaceDescriptor(descriptor)).build()
+        );
         return null;
       }
     });
@@ -2517,8 +2618,8 @@ public class HBaseAdmin implements Admin {
    * @throws IOException if a remote or network exception occurs
    * @throws FailedLogCloseException
    */
- @Override
-public synchronized  byte[][] rollHLogWriter(String serverName)
+  @Override
+  public synchronized  byte[][] rollHLogWriter(String serverName)
       throws IOException, FailedLogCloseException {
     ServerName sn = ServerName.valueOf(serverName);
     AdminService.BlockingInterface admin = this.connection.getAdmin(sn);
@@ -2548,96 +2649,60 @@ public synchronized  byte[][] rollHLogWriter(String serverName)
   }
 
   /**
-   * Get the current compaction state of a table or region.
-   * It could be in a major compaction, a minor compaction, both, or none.
-   *
-   * @param tableNameOrRegionName table or region to major compact
-   * @throws IOException if a remote or network exception occurs
-   * @throws InterruptedException
-   * @return the current compaction state
-   */
-  @Override
-  public CompactionState getCompactionState(final String tableNameOrRegionName)
-      throws IOException, InterruptedException {
-    return getCompactionState(Bytes.toBytes(tableNameOrRegionName));
-  }
-
-  /**
-   * Get the current compaction state of a table or region.
-   * It could be in a major compaction, a minor compaction, both, or none.
-   *
-   * @param tableNameOrRegionName table or region to major compact
-   * @throws IOException if a remote or network exception occurs
-   * @throws InterruptedException
-   * @return the current compaction state
+   * {@inheritDoc}
    */
   @Override
-  public CompactionState getCompactionState(final byte[] tableNameOrRegionName)
-      throws IOException, InterruptedException {
+  public CompactionState getCompactionState(final TableName tableName)
+  throws IOException, InterruptedException {
     CompactionState state = CompactionState.NONE;
     ZooKeeperWatcher zookeeper =
       new ZooKeeperWatcher(conf, ZK_IDENTIFIER_PREFIX + connection.toString(),
         new ThrowableAbortable());
     try {
-      Pair<HRegionInfo, ServerName> regionServerPair = getRegion(tableNameOrRegionName);
-      if (regionServerPair != null) {
-        if (regionServerPair.getSecond() == null) {
-          throw new NoServerForRegionException(Bytes.toStringBinary(tableNameOrRegionName));
-        } else {
-          ServerName sn = regionServerPair.getSecond();
+      checkTableExists(tableName);
+      List<Pair<HRegionInfo, ServerName>> pairs =
+        MetaTableAccessor.getTableRegionsAndLocations(zookeeper, connection, tableName);
+      for (Pair<HRegionInfo, ServerName> pair: pairs) {
+        if (pair.getFirst().isOffline()) continue;
+        if (pair.getSecond() == null) continue;
+        try {
+          ServerName sn = pair.getSecond();
           AdminService.BlockingInterface admin = this.connection.getAdmin(sn);
           GetRegionInfoRequest request = RequestConverter.buildGetRegionInfoRequest(
-            regionServerPair.getFirst().getRegionName(), true);
+            pair.getFirst().getRegionName(), true);
           GetRegionInfoResponse response = admin.getRegionInfo(null, request);
-          return response.getCompactionState();
-        }
-      } else {
-        final TableName tableName =
-            checkTableExists(TableName.valueOf(tableNameOrRegionName));
-        List<Pair<HRegionInfo, ServerName>> pairs =
-          MetaTableAccessor.getTableRegionsAndLocations(zookeeper, connection, tableName);
-        for (Pair<HRegionInfo, ServerName> pair: pairs) {
-          if (pair.getFirst().isOffline()) continue;
-          if (pair.getSecond() == null) continue;
-          try {
-            ServerName sn = pair.getSecond();
-            AdminService.BlockingInterface admin = this.connection.getAdmin(sn);
-            GetRegionInfoRequest request = RequestConverter.buildGetRegionInfoRequest(
-              pair.getFirst().getRegionName(), true);
-            GetRegionInfoResponse response = admin.getRegionInfo(null, request);
-            switch (response.getCompactionState()) {
-            case MAJOR_AND_MINOR:
+          switch (response.getCompactionState()) {
+          case MAJOR_AND_MINOR:
+            return CompactionState.MAJOR_AND_MINOR;
+          case MAJOR:
+            if (state == CompactionState.MINOR) {
               return CompactionState.MAJOR_AND_MINOR;
-            case MAJOR:
-              if (state == CompactionState.MINOR) {
-                return CompactionState.MAJOR_AND_MINOR;
-              }
-              state = CompactionState.MAJOR;
-              break;
-            case MINOR:
-              if (state == CompactionState.MAJOR) {
-                return CompactionState.MAJOR_AND_MINOR;
-              }
-              state = CompactionState.MINOR;
-              break;
-            case NONE:
-              default: // nothing, continue
             }
-          } catch (NotServingRegionException e) {
-            if (LOG.isDebugEnabled()) {
-              LOG.debug("Trying to get compaction state of " +
-                pair.getFirst() + ": " +
-                StringUtils.stringifyException(e));
+            state = CompactionState.MAJOR;
+            break;
+          case MINOR:
+            if (state == CompactionState.MAJOR) {
+              return CompactionState.MAJOR_AND_MINOR;
             }
-          } catch (RemoteException e) {
-            if (e.getMessage().indexOf(NotServingRegionException.class.getName()) >= 0) {
-              if (LOG.isDebugEnabled()) {
-                LOG.debug("Trying to get compaction state of " + pair.getFirst() + ": "
-                    + StringUtils.stringifyException(e));
-              }
-            } else {
-              throw e;
+            state = CompactionState.MINOR;
+            break;
+          case NONE:
+          default: // nothing, continue
+          }
+        } catch (NotServingRegionException e) {
+          if (LOG.isDebugEnabled()) {
+            LOG.debug("Trying to get compaction state of " +
+              pair.getFirst() + ": " +
+              StringUtils.stringifyException(e));
+          }
+        } catch (RemoteException e) {
+          if (e.getMessage().indexOf(NotServingRegionException.class.getName()) >= 0) {
+            if (LOG.isDebugEnabled()) {
+              LOG.debug("Trying to get compaction state of " + pair.getFirst() + ": "
+                + StringUtils.stringifyException(e));
             }
+          } else {
+            throw e;
           }
         }
       }
@@ -2650,6 +2715,56 @@ public synchronized  byte[][] rollHLogWriter(String serverName)
   }
 
   /**
+   * {@inheritDoc}
+   */
+  @Override
+  public CompactionState getCompactionStateForRegion(final byte[] regionName)
+  throws IOException, InterruptedException {
+    try {
+      Pair<HRegionInfo, ServerName> regionServerPair = getRegion(regionName);
+      if (regionServerPair == null) {
+        throw new IllegalArgumentException("Invalid region: " + Bytes.toStringBinary(regionName));
+      }
+      if (regionServerPair.getSecond() == null) {
+        throw new NoServerForRegionException(Bytes.toStringBinary(regionName));
+      }
+      ServerName sn = regionServerPair.getSecond();
+      AdminService.BlockingInterface admin = this.connection.getAdmin(sn);
+      GetRegionInfoRequest request = RequestConverter.buildGetRegionInfoRequest(
+        regionServerPair.getFirst().getRegionName(), true);
+      GetRegionInfoResponse response = admin.getRegionInfo(null, request);
+      return response.getCompactionState();
+    } catch (ServiceException se) {
+      throw ProtobufUtil.getRemoteException(se);
+    }
+  }
+
+  /**
+   * @deprecated Use {@link #getCompactionState(org.apache.hadoop.hbase.TableName)} or {@link
+   * #getCompactionStateForRegion(byte[])} instead.
+   */
+  @Deprecated
+  public CompactionState getCompactionState(final String tableNameOrRegionName)
+  throws IOException, InterruptedException {
+    return getCompactionState(Bytes.toBytes(tableNameOrRegionName));
+  }
+
+  /**
+   * @deprecated Use {@link #getCompactionState(org.apache.hadoop.hbase.TableName)} or {@link
+   * #getCompactionStateForRegion(byte[])} instead.
+   */
+  @Deprecated
+  public CompactionState getCompactionState(final byte[] tableNameOrRegionName)
+  throws IOException, InterruptedException {
+    try {
+      return getCompactionStateForRegion(tableNameOrRegionName);
+    } catch (IllegalArgumentException e) {
+      // Invalid region, try table
+      return getCompactionState(TableName.valueOf(tableNameOrRegionName));
+    }
+  }
+
+  /**
    * Take a snapshot for the given table. If the table is enabled, a FLUSH-type snapshot will be
    * taken. If the table is disabled, an offline snapshot is taken.
    * <p>
@@ -2726,7 +2841,7 @@ public synchronized  byte[][] rollHLogWriter(String serverName)
                        final byte[] tableName) throws IOException,
       SnapshotCreationException, IllegalArgumentException {
     snapshot(Bytes.toString(snapshotName), TableName.valueOf(tableName),
-        SnapshotDescription.Type.FLUSH);
+      SnapshotDescription.Type.FLUSH);
   }
 
   /**
@@ -3398,7 +3513,8 @@ public synchronized  byte[][] rollHLogWriter(String serverName)
       public Void call(int callTimeout) throws ServiceException {
         master.deleteSnapshot(null,
           DeleteSnapshotRequest.newBuilder().
-            setSnapshot(SnapshotDescription.newBuilder().setName(snapshotName).build()).build());
+            setSnapshot(SnapshotDescription.newBuilder().setName(snapshotName).build()).build()
+        );
         return null;
       }
     });

http://git-wip-us.apache.org/repos/asf/hbase/blob/1a6eea33/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestBase.java
----------------------------------------------------------------------
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestBase.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestBase.java
index 85bc5db..085c252 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestBase.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestBase.java
@@ -189,7 +189,7 @@ public abstract class IntegrationTestBase extends AbstractHBaseTool {
 
   public abstract int runTestFromCommandLine() throws Exception;
 
-  public abstract String getTablename();
+  public abstract TableName getTablename();
 
   protected abstract Set<String> getColumnFamilies();
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/1a6eea33/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestIngest.java
----------------------------------------------------------------------
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestIngest.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestIngest.java
index 0994b8f..7ac0d32 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestIngest.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestIngest.java
@@ -115,9 +115,10 @@ public class IntegrationTestIngest extends IntegrationTestBase {
   }
 
   @Override
-  public String getTablename() {
+  public TableName getTablename() {
     String clazz = this.getClass().getSimpleName();
-    return conf.get(String.format("%s.%s", clazz, LoadTestTool.OPT_TABLE_NAME), clazz);
+    return TableName.valueOf(
+      conf.get(String.format("%s.%s", clazz, LoadTestTool.OPT_TABLE_NAME), clazz));
   }
 
   @Override
@@ -126,8 +127,8 @@ public class IntegrationTestIngest extends IntegrationTestBase {
   }
 
   private void deleteTableIfNecessary() throws IOException {
-    if (util.getHBaseAdmin().tableExists(TableName.valueOf(getTablename()))) {
-      util.deleteTable(Bytes.toBytes(getTablename()));
+    if (util.getHBaseAdmin().tableExists(getTablename())) {
+      util.deleteTable(getTablename());
     }
   }
 
@@ -178,7 +179,7 @@ public class IntegrationTestIngest extends IntegrationTestBase {
   protected String[] getArgsForLoadTestToolInitTable() {
     List<String> args = new ArrayList<String>();
     args.add("-tn");
-    args.add(getTablename());
+    args.add(getTablename().getNameAsString());
     // pass all remaining args from conf with keys <test class name>.<load test tool arg>
     String clazz = this.getClass().getSimpleName();
     for (String arg : LOAD_TEST_TOOL_INIT_ARGS) {
@@ -196,7 +197,7 @@ public class IntegrationTestIngest extends IntegrationTestBase {
       long numKeys) {
     List<String> args = new ArrayList<String>();
     args.add("-tn");
-    args.add(getTablename());
+    args.add(getTablename().getNameAsString());
     args.add(mode);
     args.add(modeSpecificArg);
     args.add("-start_key");

http://git-wip-us.apache.org/repos/asf/hbase/blob/1a6eea33/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestIngestWithEncryption.java
----------------------------------------------------------------------
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestIngestWithEncryption.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestIngestWithEncryption.java
index 72c5689..f4246a2 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestIngestWithEncryption.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestIngestWithEncryption.java
@@ -22,7 +22,6 @@ import java.io.IOException;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.Waiter.Predicate;
 import org.apache.hadoop.hbase.client.Admin;
-import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.io.crypto.KeyProviderForTesting;
 import org.apache.hadoop.hbase.io.hfile.HFile;
 import org.apache.hadoop.hbase.io.hfile.HFileReaderV3;
@@ -30,7 +29,6 @@ import org.apache.hadoop.hbase.io.hfile.HFileWriterV3;
 import org.apache.hadoop.hbase.regionserver.wal.HLog;
 import org.apache.hadoop.hbase.regionserver.wal.SecureProtobufLogReader;
 import org.apache.hadoop.hbase.regionserver.wal.SecureProtobufLogWriter;
-import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.util.ToolRunner;
 import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
@@ -81,18 +79,18 @@ public class IntegrationTestIngestWithEncryption extends IntegrationTestIngest {
     // encryption features enabled.
     final Admin admin = util.getHBaseAdmin();
     HTableDescriptor tableDescriptor =
-        new HTableDescriptor(admin.getTableDescriptor(TableName.valueOf(getTablename())));
+        new HTableDescriptor(admin.getTableDescriptor(getTablename()));
     for (HColumnDescriptor columnDescriptor: tableDescriptor.getColumnFamilies()) {
       columnDescriptor.setEncryptionType("AES");
       LOG.info("Updating CF schema for " + getTablename() + "." +
         columnDescriptor.getNameAsString());
-      admin.disableTable(TableName.valueOf(getTablename()));
-      admin.modifyColumn(TableName.valueOf(getTablename()), columnDescriptor);
-      admin.enableTable(TableName.valueOf(getTablename()));
+      admin.disableTable(getTablename());
+      admin.modifyColumn(getTablename(), columnDescriptor);
+      admin.enableTable(getTablename());
       util.waitFor(30000, 1000, true, new Predicate<IOException>() {
         @Override
         public boolean evaluate() throws IOException {
-          return admin.isTableAvailable(TableName.valueOf(getTablename()));
+          return admin.isTableAvailable(getTablename());
         }
       });
     }

http://git-wip-us.apache.org/repos/asf/hbase/blob/1a6eea33/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestRegionReplicaPerf.java
----------------------------------------------------------------------
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestRegionReplicaPerf.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestRegionReplicaPerf.java
index 999ed51..160dc66 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestRegionReplicaPerf.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestRegionReplicaPerf.java
@@ -30,7 +30,6 @@ import org.apache.hadoop.hbase.chaos.monkies.PolicyBasedChaosMonkey;
 import org.apache.hadoop.hbase.chaos.policies.PeriodicRandomActionPolicy;
 import org.apache.hadoop.hbase.chaos.policies.Policy;
 import org.apache.hadoop.hbase.client.Admin;
-import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.ipc.RpcClient;
 import org.apache.hadoop.hbase.regionserver.DisabledRegionSplitPolicy;
 import org.apache.hadoop.mapreduce.Counters;
@@ -166,7 +165,7 @@ public class IntegrationTestRegionReplicaPerf extends IntegrationTestBase {
   public void setUpMonkey() throws Exception {
     Policy p = new PeriodicRandomActionPolicy(sleepTime,
       new RestartRsHoldingTableAction(sleepTime, tableName.getNameAsString()),
-      new MoveRandomRegionOfTableAction(tableName.getNameAsString()));
+      new MoveRandomRegionOfTableAction(tableName));
     this.monkey = new PolicyBasedChaosMonkey(util, p);
     // don't start monkey right away
   }
@@ -213,8 +212,8 @@ public class IntegrationTestRegionReplicaPerf extends IntegrationTestBase {
   }
 
   @Override
-  public String getTablename() {
-    return tableName.getNameAsString();
+  public TableName getTablename() {
+    return tableName;
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/hbase/blob/1a6eea33/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/AddColumnAction.java
----------------------------------------------------------------------
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/AddColumnAction.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/AddColumnAction.java
index aa29b78..e7d2e12 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/AddColumnAction.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/AddColumnAction.java
@@ -25,8 +25,6 @@ import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.Admin;
-import org.apache.hadoop.hbase.client.HBaseAdmin;
-import org.apache.hadoop.hbase.util.Bytes;
 
 /**
  * Action the adds a column family to a table.
@@ -35,8 +33,8 @@ public class AddColumnAction extends Action {
   private final TableName tableName;
   private Admin admin;
 
-  public AddColumnAction(String tableName) {
-    this.tableName = TableName.valueOf(tableName);
+  public AddColumnAction(TableName tableName) {
+    this.tableName = tableName;
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/hbase/blob/1a6eea33/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/ChangeBloomFilterAction.java
----------------------------------------------------------------------
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/ChangeBloomFilterAction.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/ChangeBloomFilterAction.java
index 62db382..5bd7444 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/ChangeBloomFilterAction.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/ChangeBloomFilterAction.java
@@ -25,9 +25,7 @@ import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.Admin;
-import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.regionserver.BloomType;
-import org.apache.hadoop.hbase.util.Bytes;
 
 /**
  * Action that tries to adjust the bloom filter setting on all the columns of a
@@ -37,13 +35,13 @@ public class ChangeBloomFilterAction extends Action {
   private final long sleepTime;
   private final TableName tableName;
 
-  public ChangeBloomFilterAction(String tableName) {
+  public ChangeBloomFilterAction(TableName tableName) {
     this(-1, tableName);
   }
 
-  public ChangeBloomFilterAction(int sleepTime, String tableName) {
+  public ChangeBloomFilterAction(int sleepTime, TableName tableName) {
     this.sleepTime = sleepTime;
-    this.tableName = TableName.valueOf(tableName);
+    this.tableName = tableName;
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/hbase/blob/1a6eea33/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/ChangeCompressionAction.java
----------------------------------------------------------------------
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/ChangeCompressionAction.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/ChangeCompressionAction.java
index 07deb3d..f048b58 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/ChangeCompressionAction.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/ChangeCompressionAction.java
@@ -25,23 +25,19 @@ import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.Admin;
-import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.io.compress.Compression.Algorithm;
-import org.apache.hadoop.hbase.util.Bytes;
 
 /**
  * Action that changes the compression algorithm on a column family from a list of tables.
  */
 public class ChangeCompressionAction extends Action {
   private final TableName tableName;
-  private final String tableNameString;
 
   private Admin admin;
   private Random random;
 
-  public ChangeCompressionAction(String tableName) {
-    tableNameString = tableName;
-    this.tableName = TableName.valueOf(tableName);
+  public ChangeCompressionAction(TableName tableName) {
+    this.tableName = tableName;
     this.random = new Random();
   }
 
@@ -69,7 +65,7 @@ public class ChangeCompressionAction extends Action {
     Algorithm algo = possibleAlgos[random.nextInt(possibleAlgos.length)];
 
     LOG.debug("Performing action: Changing compression algorithms on "
-      + tableNameString + " to " + algo);
+      + tableName.getNameAsString() + " to " + algo);
     for (HColumnDescriptor descriptor : columnDescriptors) {
       if (random.nextBoolean()) {
         descriptor.setCompactionCompressionType(algo);

http://git-wip-us.apache.org/repos/asf/hbase/blob/1a6eea33/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/ChangeEncodingAction.java
----------------------------------------------------------------------
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/ChangeEncodingAction.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/ChangeEncodingAction.java
index e44c132..4833d70 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/ChangeEncodingAction.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/ChangeEncodingAction.java
@@ -25,9 +25,7 @@ import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.Admin;
-import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.io.encoding.DataBlockEncoding;
-import org.apache.hadoop.hbase.util.Bytes;
 
 /**
  * Action that changes the encoding on a column family from a list of tables.
@@ -38,8 +36,8 @@ public class ChangeEncodingAction extends Action {
   private Admin admin;
   private Random random;
 
-  public ChangeEncodingAction(String tableName) {
-    this.tableName = TableName.valueOf(tableName);
+  public ChangeEncodingAction(TableName tableName) {
+    this.tableName = tableName;
     this.random = new Random();
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/1a6eea33/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/ChangeVersionsAction.java
----------------------------------------------------------------------
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/ChangeVersionsAction.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/ChangeVersionsAction.java
index 48799e6..0faa8a3 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/ChangeVersionsAction.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/ChangeVersionsAction.java
@@ -25,8 +25,6 @@ import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.Admin;
-import org.apache.hadoop.hbase.client.HBaseAdmin;
-import org.apache.hadoop.hbase.util.Bytes;
 
 /**
  * Action that changes the number of versions on a column family from a list of tables.
@@ -35,14 +33,12 @@ import org.apache.hadoop.hbase.util.Bytes;
  */
 public class ChangeVersionsAction extends Action {
   private final TableName tableName;
-  private final String tableNameString;
 
   private Admin admin;
   private Random random;
 
-  public ChangeVersionsAction(String tableName) {
-    tableNameString = tableName;
-    this.tableName = TableName.valueOf(tableName);
+  public ChangeVersionsAction(TableName tableName) {
+    this.tableName = tableName;
     this.random = new Random();
   }
 
@@ -66,7 +62,7 @@ public class ChangeVersionsAction extends Action {
       descriptor.setMaxVersions(versions);
       descriptor.setMinVersions(versions);
     }
-    LOG.debug("Performing action: Changing versions on " + tableNameString);
+    LOG.debug("Performing action: Changing versions on " + tableName.getNameAsString());
     admin.modifyTable(tableName, tableDescriptor);
   }
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/1a6eea33/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/CompactRandomRegionOfTableAction.java
----------------------------------------------------------------------
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/CompactRandomRegionOfTableAction.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/CompactRandomRegionOfTableAction.java
index 410859a..114b511 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/CompactRandomRegionOfTableAction.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/CompactRandomRegionOfTableAction.java
@@ -26,8 +26,6 @@ import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.chaos.monkies.PolicyBasedChaosMonkey;
 import org.apache.hadoop.hbase.client.Admin;
-import org.apache.hadoop.hbase.client.HBaseAdmin;
-import org.apache.hadoop.hbase.util.Bytes;
 
 /**
  * Region that queues a compaction of a random region from the table.
@@ -38,15 +36,15 @@ public class CompactRandomRegionOfTableAction extends Action {
   private final TableName tableName;
 
   public CompactRandomRegionOfTableAction(
-      String tableName, float majorRatio) {
+      TableName tableName, float majorRatio) {
     this(-1, tableName, majorRatio);
   }
 
   public CompactRandomRegionOfTableAction(
-      int sleepTime, String tableName, float majorRatio) {
+      int sleepTime, TableName tableName, float majorRatio) {
     this.majorRatio = (int) (100 * majorRatio);
     this.sleepTime = sleepTime;
-    this.tableName = TableName.valueOf(tableName);
+    this.tableName = tableName;
   }
 
   @Override
@@ -69,10 +67,10 @@ public class CompactRandomRegionOfTableAction extends Action {
     try {
       if (major) {
         LOG.debug("Major compacting region " + region.getRegionNameAsString());
-        admin.majorCompact(region.getRegionName());
+        admin.majorCompactRegion(region.getRegionName());
       } else {
         LOG.debug("Compacting region " + region.getRegionNameAsString());
-        admin.compact(region.getRegionName());
+        admin.compactRegion(region.getRegionName());
       }
     } catch (Exception ex) {
       LOG.warn("Compaction failed, might be caused by other chaos: " + ex.getMessage());

http://git-wip-us.apache.org/repos/asf/hbase/blob/1a6eea33/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/CompactTableAction.java
----------------------------------------------------------------------
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/CompactTableAction.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/CompactTableAction.java
index 63af0b8..796cc43 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/CompactTableAction.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/CompactTableAction.java
@@ -20,29 +20,26 @@ package org.apache.hadoop.hbase.chaos.actions;
 
 import org.apache.commons.lang.math.RandomUtils;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.Admin;
-import org.apache.hadoop.hbase.client.HBaseAdmin;
-import org.apache.hadoop.hbase.util.Bytes;
 
 /**
  * Action that queues a table compaction.
  */
 public class CompactTableAction extends Action {
-  private final byte[] tableNameBytes;
+  private final TableName tableName;
   private final int majorRatio;
   private final long sleepTime;
-  private final String tableName;
 
-  public CompactTableAction(String tableName, float majorRatio) {
+  public CompactTableAction(TableName tableName, float majorRatio) {
     this(-1, tableName, majorRatio);
   }
 
   public CompactTableAction(
-      int sleepTime, String tableName, float majorRatio) {
-    this.tableNameBytes = Bytes.toBytes(tableName);
+      int sleepTime, TableName tableName, float majorRatio) {
+    this.tableName = tableName;
     this.majorRatio = (int) (100 * majorRatio);
     this.sleepTime = sleepTime;
-    this.tableName = tableName;
   }
 
   @Override
@@ -54,9 +51,9 @@ public class CompactTableAction extends Action {
     LOG.info("Performing action: Compact table " + tableName + ", major=" + major);
     try {
       if (major) {
-        admin.majorCompact(tableNameBytes);
+        admin.majorCompact(tableName);
       } else {
-        admin.compact(tableNameBytes);
+        admin.compact(tableName);
       }
     } catch (Exception ex) {
       LOG.warn("Compaction failed, might be caused by other chaos: " + ex.getMessage());

http://git-wip-us.apache.org/repos/asf/hbase/blob/1a6eea33/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/FlushRandomRegionOfTableAction.java
----------------------------------------------------------------------
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/FlushRandomRegionOfTableAction.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/FlushRandomRegionOfTableAction.java
index 671bf2b..c919789 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/FlushRandomRegionOfTableAction.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/FlushRandomRegionOfTableAction.java
@@ -25,8 +25,6 @@ import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.chaos.monkies.PolicyBasedChaosMonkey;
 import org.apache.hadoop.hbase.client.Admin;
-import org.apache.hadoop.hbase.client.HBaseAdmin;
-import org.apache.hadoop.hbase.util.Bytes;
 
 /**
 * Action that tries to flush a random region of a table.
@@ -35,13 +33,13 @@ public class FlushRandomRegionOfTableAction extends Action {
   private final long sleepTime;
   private final TableName tableName;
 
-  public FlushRandomRegionOfTableAction(String tableName) {
+  public FlushRandomRegionOfTableAction(TableName tableName) {
    this (-1, tableName);
   }
 
-  public FlushRandomRegionOfTableAction(int sleepTime, String tableName) {
+  public FlushRandomRegionOfTableAction(int sleepTime, TableName tableName) {
     this.sleepTime = sleepTime;
-    this.tableName = TableName.valueOf(tableName);
+    this.tableName = tableName;
   }
 
   @Override
@@ -60,7 +58,7 @@ public class FlushRandomRegionOfTableAction extends Action {
       regions.toArray(new HRegionInfo[regions.size()]));
     LOG.debug("Flushing region " + region.getRegionNameAsString());
     try {
-      admin.flush(region.getRegionName());
+      admin.flushRegion(region.getRegionName());
     } catch (Exception ex) {
       LOG.warn("Flush failed, might be caused by other chaos: " + ex.getMessage());
     }

http://git-wip-us.apache.org/repos/asf/hbase/blob/1a6eea33/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/FlushTableAction.java
----------------------------------------------------------------------
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/FlushTableAction.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/FlushTableAction.java
index 4ae21d1..f86d2a1 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/FlushTableAction.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/FlushTableAction.java
@@ -21,8 +21,6 @@ package org.apache.hadoop.hbase.chaos.actions;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.Admin;
-import org.apache.hadoop.hbase.client.HBaseAdmin;
-import org.apache.hadoop.hbase.util.Bytes;
 
 /**
 * Action that tries to flush a table.
@@ -31,13 +29,13 @@ public class FlushTableAction extends Action {
   private final long sleepTime;
   private final TableName tableName;
 
-  public FlushTableAction(String tableName) {
+  public FlushTableAction(TableName tableName) {
     this(-1, tableName);
   }
 
-  public FlushTableAction(int sleepTime, String tableName) {
+  public FlushTableAction(int sleepTime, TableName tableName) {
     this.sleepTime = sleepTime;
-    this.tableName = TableName.valueOf(tableName);
+    this.tableName = tableName;
   }
 
   @Override
@@ -47,7 +45,7 @@ public class FlushTableAction extends Action {
 
     LOG.info("Performing action: Flush table " + tableName);
     try {
-      admin.flush(tableName.toBytes());
+      admin.flush(tableName);
     } catch (Exception ex) {
       LOG.warn("Flush failed, might be caused by other chaos: " + ex.getMessage());
     }

http://git-wip-us.apache.org/repos/asf/hbase/blob/1a6eea33/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/MergeRandomAdjacentRegionsOfTableAction.java
----------------------------------------------------------------------
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/MergeRandomAdjacentRegionsOfTableAction.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/MergeRandomAdjacentRegionsOfTableAction.java
index ecb58da..0aaefe5 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/MergeRandomAdjacentRegionsOfTableAction.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/MergeRandomAdjacentRegionsOfTableAction.java
@@ -25,8 +25,6 @@ import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.Admin;
-import org.apache.hadoop.hbase.client.HBaseAdmin;
-import org.apache.hadoop.hbase.util.Bytes;
 
 /**
  * Action to merge regions of a table.
@@ -35,12 +33,12 @@ public class MergeRandomAdjacentRegionsOfTableAction extends Action {
   private final TableName tableName;
   private final long sleepTime;
 
-  public MergeRandomAdjacentRegionsOfTableAction(String tableName) {
+  public MergeRandomAdjacentRegionsOfTableAction(TableName tableName) {
     this(-1, tableName);
   }
 
-  public MergeRandomAdjacentRegionsOfTableAction(int sleepTime, String tableName) {
-    this.tableName = TableName.valueOf(tableName);
+  public MergeRandomAdjacentRegionsOfTableAction(int sleepTime, TableName tableName) {
+    this.tableName = tableName;
     this.sleepTime = sleepTime;
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/1a6eea33/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/MoveRandomRegionOfTableAction.java
----------------------------------------------------------------------
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/MoveRandomRegionOfTableAction.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/MoveRandomRegionOfTableAction.java
index 0981fb5..96cd008 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/MoveRandomRegionOfTableAction.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/MoveRandomRegionOfTableAction.java
@@ -25,8 +25,6 @@ import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.chaos.monkies.PolicyBasedChaosMonkey;
 import org.apache.hadoop.hbase.client.Admin;
-import org.apache.hadoop.hbase.client.HBaseAdmin;
-import org.apache.hadoop.hbase.util.Bytes;
 
 /**
 * Action that tries to move a random region of a table.
@@ -35,13 +33,13 @@ public class MoveRandomRegionOfTableAction extends Action {
   private final long sleepTime;
   private final TableName tableName;
 
-  public MoveRandomRegionOfTableAction(String tableName) {
+  public MoveRandomRegionOfTableAction(TableName tableName) {
     this(-1, tableName);
   }
 
-  public MoveRandomRegionOfTableAction(long sleepTime, String tableName) {
+  public MoveRandomRegionOfTableAction(long sleepTime, TableName tableName) {
     this.sleepTime = sleepTime;
-    this.tableName = TableName.valueOf(tableName);
+    this.tableName = tableName;
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/hbase/blob/1a6eea33/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/MoveRegionsOfTableAction.java
----------------------------------------------------------------------
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/MoveRegionsOfTableAction.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/MoveRegionsOfTableAction.java
index 50d1948..5e380a3 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/MoveRegionsOfTableAction.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/MoveRegionsOfTableAction.java
@@ -28,7 +28,6 @@ import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.chaos.factories.MonkeyConstants;
 import org.apache.hadoop.hbase.client.Admin;
-import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.util.Bytes;
 
 /**
@@ -39,13 +38,13 @@ public class MoveRegionsOfTableAction extends Action {
   private final TableName tableName;
   private final long maxTime;
 
-  public MoveRegionsOfTableAction(String tableName) {
+  public MoveRegionsOfTableAction(TableName tableName) {
     this(-1, MonkeyConstants.DEFAULT_MOVE_REGIONS_MAX_TIME, tableName);
   }
 
-  public MoveRegionsOfTableAction(long sleepTime, long maxSleepTime, String tableName) {
+  public MoveRegionsOfTableAction(long sleepTime, long maxSleepTime, TableName tableName) {
     this.sleepTime = sleepTime;
-    this.tableName = TableName.valueOf(tableName);
+    this.tableName = tableName;
     this.maxTime = maxSleepTime;
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/1a6eea33/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/RemoveColumnAction.java
----------------------------------------------------------------------
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/RemoveColumnAction.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/RemoveColumnAction.java
index bfcf1b5..fc169e3 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/RemoveColumnAction.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/RemoveColumnAction.java
@@ -26,8 +26,6 @@ import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.Admin;
-import org.apache.hadoop.hbase.client.HBaseAdmin;
-import org.apache.hadoop.hbase.util.Bytes;
 
 /**
  * Action that removes a column family.
@@ -35,13 +33,11 @@ import org.apache.hadoop.hbase.util.Bytes;
 public class RemoveColumnAction extends Action {
   private final TableName tableName;
   private final Set<String> protectedColumns;
-  private final String tableNameString;
   private Admin admin;
   private Random random;
 
-  public RemoveColumnAction(String tableName, Set<String> protectedColumns) {
-    tableNameString = tableName;
-    this.tableName = TableName.valueOf(tableName);
+  public RemoveColumnAction(TableName tableName, Set<String> protectedColumns) {
+    this.tableName = tableName;
     this.protectedColumns = protectedColumns;
     random = new Random();
   }
@@ -67,7 +63,7 @@ public class RemoveColumnAction extends Action {
       index = random.nextInt(columnDescriptors.length);
     }
     LOG.debug("Performing action: Removing " + columnDescriptors[index].getName() + " from "
-        + tableNameString);
+        + tableName.getNameAsString());
     tableDescriptor.removeFamily(columnDescriptors[index].getName());
 
     admin.modifyTable(tableName, tableDescriptor);

http://git-wip-us.apache.org/repos/asf/hbase/blob/1a6eea33/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/SnapshotTableAction.java
----------------------------------------------------------------------
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/SnapshotTableAction.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/SnapshotTableAction.java
index c0dedaa..1c7a9d9 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/SnapshotTableAction.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/SnapshotTableAction.java
@@ -21,7 +21,6 @@ package org.apache.hadoop.hbase.chaos.actions;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.Admin;
-import org.apache.hadoop.hbase.client.HBaseAdmin;
 
 /**
 * Action that tries to take a snapshot of a table.
@@ -30,12 +29,12 @@ public class SnapshotTableAction extends Action {
   private final TableName tableName;
   private final long sleepTime;
 
-  public SnapshotTableAction(String tableName) {
+  public SnapshotTableAction(TableName tableName) {
     this(-1, tableName);
   }
 
-  public SnapshotTableAction(int sleepTime, String tableName) {
-    this.tableName = TableName.valueOf(tableName);
+  public SnapshotTableAction(int sleepTime, TableName tableName) {
+    this.tableName = tableName;
     this.sleepTime = sleepTime;
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/1a6eea33/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/SplitRandomRegionOfTableAction.java
----------------------------------------------------------------------
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/SplitRandomRegionOfTableAction.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/SplitRandomRegionOfTableAction.java
index d0c3419..209ef24 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/SplitRandomRegionOfTableAction.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/SplitRandomRegionOfTableAction.java
@@ -25,8 +25,6 @@ import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.chaos.monkies.PolicyBasedChaosMonkey;
 import org.apache.hadoop.hbase.client.Admin;
-import org.apache.hadoop.hbase.client.HBaseAdmin;
-import org.apache.hadoop.hbase.util.Bytes;
 
 /**
 * Action that tries to split a random region of a table.
@@ -35,13 +33,13 @@ public class SplitRandomRegionOfTableAction extends Action {
   private final long sleepTime;
   private final TableName tableName;
 
-  public SplitRandomRegionOfTableAction(String tableName) {
+  public SplitRandomRegionOfTableAction(TableName tableName) {
     this(-1, tableName);
   }
 
-  public SplitRandomRegionOfTableAction(int sleepTime, String tableName) {
+  public SplitRandomRegionOfTableAction(int sleepTime, TableName tableName) {
     this.sleepTime = sleepTime;
-    this.tableName = TableName.valueOf(tableName);
+    this.tableName = tableName;
   }
 
   @Override
@@ -60,7 +58,7 @@ public class SplitRandomRegionOfTableAction extends Action {
         regions.toArray(new HRegionInfo[regions.size()]));
     LOG.debug("Splitting region " + region.getRegionNameAsString());
     try {
-      admin.split(region.getRegionName());
+      admin.splitRegion(region.getRegionName());
     } catch (Exception ex) {
       LOG.warn("Split failed, might be caused by other chaos: " + ex.getMessage());
     }

http://git-wip-us.apache.org/repos/asf/hbase/blob/1a6eea33/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/factories/MonkeyFactory.java
----------------------------------------------------------------------
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/factories/MonkeyFactory.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/factories/MonkeyFactory.java
index 8fb1859..532839e 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/factories/MonkeyFactory.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/factories/MonkeyFactory.java
@@ -23,6 +23,7 @@ import java.util.Properties;
 import java.util.Set;
 
 import org.apache.hadoop.hbase.IntegrationTestingUtility;
+import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.chaos.monkies.ChaosMonkey;
 
 import com.google.common.collect.ImmutableMap;
@@ -32,12 +33,12 @@ import com.google.common.collect.ImmutableMap;
  */
 public abstract class MonkeyFactory {
 
-  protected String tableName;
+  protected TableName tableName;
   protected Set<String> columnFamilies;
   protected IntegrationTestingUtility util;
   protected Properties properties = new Properties();
 
-  public MonkeyFactory setTableName(String tableName) {
+  public MonkeyFactory setTableName(TableName tableName) {
     this.tableName = tableName;
     return this;
   }


Mime
View raw message