hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zhang...@apache.org
Subject [hbase] branch branch-2 updated: HBASE-22108 Avoid passing null in Admin methods
Date Sun, 07 Apr 2019 13:17:52 GMT
This is an automated email from the ASF dual-hosted git repository.

zhangduo pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2 by this push:
     new b04b1ec  HBASE-22108 Avoid passing null in Admin methods
b04b1ec is described below

commit b04b1ecc74f042c0f1b706ae03cd51013618db5a
Author: zhangduo <zhangduo@apache.org>
AuthorDate: Mon Apr 1 20:48:03 2019 +0800

    HBASE-22108 Avoid passing null in Admin methods
    
    Signed-off-by: Guanghao Zhang <zghao@apache.org>
---
 .../java/org/apache/hadoop/hbase/client/Admin.java | 61 +++++++++++++++++-----
 .../org/apache/hadoop/hbase/client/HBaseAdmin.java | 23 ++++----
 .../apache/hadoop/hbase/chaos/actions/Action.java  |  3 +-
 .../chaos/actions/MoveRegionsOfTableAction.java    |  5 +-
 .../actions/SplitRandomRegionOfTableAction.java    |  3 +-
 .../hadoop/hbase/rsgroup/TestRSGroupsAdmin2.java   |  7 ++-
 .../hadoop/hbase/rsgroup/TestRSGroupsBalance.java  |  2 +-
 .../hbase/rsgroup/TestRSGroupsOfflineMode.java     |  3 +-
 .../master/normalizer/SplitNormalizationPlan.java  |  6 +--
 .../org/apache/hadoop/hbase/util/RegionMover.java  |  4 +-
 .../apache/hadoop/hbase/HBaseTestingUtility.java   |  3 +-
 .../hbase/TestPartialResultsFromClientSide.java    |  3 +-
 .../hbase/client/RegionReplicaTestHelper.java      |  4 +-
 .../org/apache/hadoop/hbase/client/TestAdmin1.java |  2 +-
 .../org/apache/hadoop/hbase/client/TestAdmin2.java |  2 +-
 .../client/TestAsyncNonMetaRegionLocator.java      |  5 +-
 .../TestAsyncSingleRequestRpcRetryingCaller.java   |  7 ++-
 .../client/TestAsyncTableGetMultiThreaded.java     |  3 +-
 .../hbase/client/TestConnectionImplementation.java | 21 +++-----
 .../hadoop/hbase/client/TestFromClientSide.java    |  3 +-
 .../hbase/client/TestHBaseAdminNoCluster.java      |  2 +-
 .../hadoop/hbase/client/TestMetaWithReplicas.java  |  6 +--
 .../hbase/client/TestMvccConsistentScanner.java    |  3 +-
 .../hbase/client/TestSeparateClientZKCluster.java  |  6 +--
 .../client/TestSnapshotCloneIndependence.java      |  2 +-
 .../coprocessor/TestRegionObserverInterface.java   |  4 +-
 .../hadoop/hbase/master/AbstractTestDLS.java       |  3 +-
 .../master/TestCatalogJanitorInMemoryStates.java   |  6 +--
 .../hbase/master/TestCloseAnOpeningRegion.java     |  6 +--
 .../org/apache/hadoop/hbase/master/TestMaster.java |  4 +-
 .../TestMasterHandlerFullWhenTransitRegion.java    |  2 +-
 .../assignment/TestCloseRegionWhileRSCrash.java    |  6 +--
 .../TestFavoredStochasticBalancerPickers.java      |  3 +-
 .../hbase/regionserver/TestCleanupMetaWAL.java     |  2 +-
 .../hbase/regionserver/TestHRegionOnCluster.java   |  6 +--
 .../TestOpenSeqNumUnexpectedIncrease.java          |  3 +-
 .../hadoop/hbase/regionserver/TestRegionMove.java  |  6 +--
 .../TestSplitTransactionOnCluster.java             |  8 +--
 .../replication/SerialReplicationTestBase.java     |  3 +-
 .../security/access/TestAccessController.java      |  3 +-
 .../hadoop/hbase/thrift2/client/ThriftAdmin.java   | 11 +++-
 41 files changed, 139 insertions(+), 126 deletions(-)

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 0605a03..7f493c0 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
@@ -1073,19 +1073,49 @@ public interface Admin extends Abortable, Closeable {
   void majorCompactRegionServer(ServerName serverName) throws IOException;
 
   /**
-   * Move the region <code>r</code> to <code>dest</code>.
-   *
+   * Move the region <code>encodedRegionName</code> to a random server.
    * @param encodedRegionName The encoded region name; i.e. the hash that makes up the region name
-   * suffix: e.g. if regionname is
-   * <code>TestTable,0094429456,1289497600452.527db22f95c8a9e0116f0cc13c680396.</code>,
-   * then the encoded region name is: <code>527db22f95c8a9e0116f0cc13c680396</code>.
-   * @param destServerName The servername of the destination regionserver.  If passed the empty byte
-   * array we'll assign to a random server.  A server name is made of host, port and startcode.
-   * Here is an example: <code> host187.example.com,60020,1289493121758</code>
-   * @throws IOException if we can't find a region named
-   * <code>encodedRegionName</code>
+   *          suffix: e.g. if regionname is
+   *          <code>TestTable,0094429456,1289497600452.527db22f95c8a9e0116f0cc13c680396.</code>,
+   *          then the encoded region name is: <code>527db22f95c8a9e0116f0cc13c680396</code>.
+   * @throws IOException if we can't find a region named <code>encodedRegionName</code>
+   */
+  void move(byte[] encodedRegionName) throws IOException;
+
+  /**
+   * Move the region <code>rencodedRegionName</code> to <code>destServerName</code>.
+   * @param encodedRegionName The encoded region name; i.e. the hash that makes up the region name
+   *          suffix: e.g. if regionname is
+   *          <code>TestTable,0094429456,1289497600452.527db22f95c8a9e0116f0cc13c680396.</code>,
+   *          then the encoded region name is: <code>527db22f95c8a9e0116f0cc13c680396</code>.
+   * @param destServerName The servername of the destination regionserver. If passed the empty byte
+   *          array we'll assign to a random server. A server name is made of host, port and
+   *          startcode. Here is an example: <code> host187.example.com,60020,1289493121758</code>
+   * @throws IOException if we can't find a region named <code>encodedRegionName</code>
+   * @deprecated Use {@link #move(byte[], ServerName)} instead. And if you want to move the region
+   *             to a random server, please use {@link #move(byte[])}.
+   */
+  @Deprecated
+  default void move(byte[] encodedRegionName, byte[] destServerName) throws IOException {
+    if (destServerName == null || destServerName.length == 0) {
+      move(encodedRegionName);
+    } else {
+      move(encodedRegionName, ServerName.valueOf(Bytes.toString(destServerName)));
+    }
+  }
+
+  /**
+   * Move the region <code>rencodedRegionName</code> to <code>destServerName</code>.
+   * @param encodedRegionName The encoded region name; i.e. the hash that makes up the region name
+   *          suffix: e.g. if regionname is
+   *          <code>TestTable,0094429456,1289497600452.527db22f95c8a9e0116f0cc13c680396.</code>,
+   *          then the encoded region name is: <code>527db22f95c8a9e0116f0cc13c680396</code>.
+   * @param destServerName The servername of the destination regionserver. A server name is made of
+   *          host, port and startcode. Here is an example:
+   *          <code> host187.example.com,60020,1289493121758</code>
+   * @throws IOException if we can't find a region named <code>encodedRegionName</code>
    */
-  void move(byte[] encodedRegionName, byte[] destServerName) throws IOException;
+  void move(byte[] encodedRegionName, ServerName destServerName) throws IOException;
 
   /**
    * Assign a Region.
@@ -1096,7 +1126,7 @@ public interface Admin extends Abortable, Closeable {
   /**
    * Unassign a region from current hosting regionserver.  Region will then be assigned to a
    * regionserver chosen at random.  Region could be reassigned back to the same server.  Use {@link
-   * #move(byte[], byte[])} if you want to control the region movement.
+   * #move(byte[], ServerName)} if you want to control the region movement.
    *
    * @param regionName Region to unassign. Will clear any existing RegionPlan if one found.
    * @param force If <code>true</code>, force unassign (Will remove region from regions-in-transition too if
@@ -1411,6 +1441,13 @@ public interface Admin extends Abortable, Closeable {
   /**
    * Split an individual region. Asynchronous operation.
    * @param regionName region to split
+   * @throws IOException if a remote or network exception occurs
+   */
+  Future<Void> splitRegionAsync(byte[] regionName) throws IOException;
+
+  /**
+   * Split an individual region. Asynchronous operation.
+   * @param regionName region to split
    * @param splitPoint the explicit position to split on
    * @throws IOException if a remote or network exception occurs
    */
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 cc8590f..14eb328 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
@@ -1387,14 +1387,17 @@ public class HBaseAdmin implements Admin {
   }
 
   @Override
-  public void move(final byte[] encodedRegionName, final byte[] destServerName) throws IOException {
+  public void move(byte[] encodedRegionName) throws IOException {
+    move(encodedRegionName, (ServerName) null);
+  }
+
+  public void move(final byte[] encodedRegionName, ServerName destServerName) throws IOException {
     executeCallable(new MasterCallable<Void>(getConnection(), getRpcControllerFactory()) {
       @Override
       protected Void rpcCall() throws Exception {
         setPriority(encodedRegionName);
         MoveRegionRequest request =
-            RequestConverter.buildMoveRegionRequest(encodedRegionName,
-              destServerName != null ? ServerName.valueOf(Bytes.toString(destServerName)) : null);
+          RequestConverter.buildMoveRegionRequest(encodedRegionName, destServerName);
         master.moveRegion(getRpcController(), request);
         return null;
       }
@@ -1780,12 +1783,9 @@ public class HBaseAdmin implements Admin {
    * @param units time units
    * @throws IOException
    */
-  public void splitRegionSync(byte[] regionName, byte[] splitPoint,
-    final long timeout, final TimeUnit units) throws IOException {
-    get(
-        splitRegionAsync(regionName, splitPoint),
-        timeout,
-        units);
+  public void splitRegionSync(byte[] regionName, byte[] splitPoint, final long timeout,
+      final TimeUnit units) throws IOException {
+    get(splitRegionAsync(regionName, splitPoint), timeout, units);
   }
 
   @Override
@@ -4276,4 +4276,9 @@ public class HBaseAdmin implements Admin {
         }
       });
   }
+
+  @Override
+  public Future<Void> splitRegionAsync(byte[] regionName) throws IOException {
+    return splitRegionAsync(regionName, null);
+  }
 }
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/Action.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/Action.java
index 6db6da0..65fe92c 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/Action.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/Action.java
@@ -28,7 +28,6 @@ import java.util.Map;
 import java.util.Set;
 import java.util.function.BiConsumer;
 import java.util.function.Consumer;
-
 import org.apache.commons.lang3.RandomUtils;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.ClusterMetrics;
@@ -253,7 +252,7 @@ public class Action {
         break;
       }
       int targetIx = RandomUtils.nextInt(0, toServers.size());
-      admin.move(victimRegion, Bytes.toBytes(toServers.get(targetIx).getServerName()));
+      admin.move(victimRegion, toServers.get(targetIx));
     }
   }
 
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 3496b9a..764acfd 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
@@ -31,7 +31,6 @@ 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.RegionInfo;
-import org.apache.hadoop.hbase.util.Bytes;
 
 /**
 * Action that tries to move every region of a table.
@@ -98,9 +97,9 @@ public class MoveRegionsOfTableAction extends Action {
 
   static void moveRegion(Admin admin, ServerName [] servers, RegionInfo regionInfo) {
     try {
-      String destServerName = servers[RandomUtils.nextInt(0, servers.length)].getServerName();
+      ServerName destServerName = servers[RandomUtils.nextInt(0, servers.length)];
       LOG.debug("Moving {} to {}", regionInfo.getRegionNameAsString(), destServerName);
-      admin.move(regionInfo.getEncodedNameAsBytes(), Bytes.toBytes(destServerName));
+      admin.move(regionInfo.getEncodedNameAsBytes(), destServerName);
     } catch (Exception ex) {
       LOG.warn("Move failed, might be caused by other chaos: {}", ex.getMessage());
     }
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 de266f5..a143c70 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
@@ -19,7 +19,6 @@
 package org.apache.hadoop.hbase.chaos.actions;
 
 import java.util.List;
-
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.TableName;
@@ -62,7 +61,7 @@ public class SplitRandomRegionOfTableAction extends Action {
         regions.toArray(new HRegionInfo[regions.size()]));
     LOG.debug("Splitting region " + region.getRegionNameAsString());
     try {
-      admin.splitRegion(region.getRegionName());
+      admin.splitRegionAsync(region.getRegionName()).get();
     } catch (Exception ex) {
       LOG.warn("Split failed, might be caused by other chaos: " + ex.getMessage());
     }
diff --git a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsAdmin2.java b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsAdmin2.java
index ccdbbc0..d18bb66 100644
--- a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsAdmin2.java
+++ b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsAdmin2.java
@@ -128,9 +128,8 @@ public class TestRSGroupsAdmin2 extends TestRSGroupsBase {
     });
 
     // Lets move this region to the new group.
-    TEST_UTIL.getAdmin().move(
-      Bytes.toBytes(RegionInfo.encodeRegionName(Bytes.toBytes(targetRegion))),
-      Bytes.toBytes(targetServer.getServerName()));
+    TEST_UTIL.getAdmin()
+      .move(Bytes.toBytes(RegionInfo.encodeRegionName(Bytes.toBytes(targetRegion))), targetServer);
     TEST_UTIL.waitFor(WAIT_TIMEOUT, new Waiter.Predicate<Exception>() {
       @Override
       public boolean evaluate() throws Exception {
@@ -362,7 +361,7 @@ public class TestRSGroupsAdmin2 extends TestRSGroupsBase {
     for (String region : regionList) {
       // Lets move this region to the targetServer
       TEST_UTIL.getAdmin().move(Bytes.toBytes(RegionInfo.encodeRegionName(Bytes.toBytes(region))),
-        Bytes.toBytes(targetServer.getServerName()));
+        targetServer);
     }
 
     TEST_UTIL.waitFor(WAIT_TIMEOUT, new Waiter.Predicate<Exception>() {
diff --git a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsBalance.java b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsBalance.java
index 53cefe3..67f5c7e 100644
--- a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsBalance.java
+++ b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsBalance.java
@@ -106,7 +106,7 @@ public class TestRSGroupsBalance extends TestRSGroupsBase {
     final ServerName first = assignMap.entrySet().iterator().next().getKey();
     for (RegionInfo region : admin.getRegions(tableName)) {
       if (!assignMap.get(first).contains(region.getRegionNameAsString())) {
-        admin.move(region.getEncodedNameAsBytes(), Bytes.toBytes(first.getServerName()));
+        admin.move(region.getEncodedNameAsBytes(), first);
       }
     }
     TEST_UTIL.waitFor(WAIT_TIMEOUT, new Waiter.Predicate<Exception>() {
diff --git a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsOfflineMode.java b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsOfflineMode.java
index 8058439..39cf164 100644
--- a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsOfflineMode.java
+++ b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsOfflineMode.java
@@ -118,8 +118,7 @@ public class TestRSGroupsOfflineMode {
     if (master.getAssignmentManager().getRegionStates().getRegionAssignments()
       .containsValue(failoverRS.getServerName())) {
       for (RegionInfo regionInfo : hbaseAdmin.getRegions(failoverRS.getServerName())) {
-        hbaseAdmin.move(regionInfo.getEncodedNameAsBytes(),
-          Bytes.toBytes(failoverRS.getServerName().getServerName()));
+        hbaseAdmin.move(regionInfo.getEncodedNameAsBytes(), failoverRS.getServerName());
       }
       LOG.info("Waiting for region unassignments on failover RS...");
       TEST_UTIL.waitFor(WAIT_TIMEOUT, new Waiter.Predicate<Exception>() {
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/SplitNormalizationPlan.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/SplitNormalizationPlan.java
index b5f8e82..04e11d1 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/SplitNormalizationPlan.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/SplitNormalizationPlan.java
@@ -18,9 +18,7 @@
  */
 package org.apache.hadoop.hbase.master.normalizer;
 
-import java.io.IOException;
 import java.util.Arrays;
-
 import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.RegionInfo;
 import org.apache.yetus.audience.InterfaceAudience;
@@ -78,8 +76,8 @@ public class SplitNormalizationPlan implements NormalizationPlan {
   public void execute(Admin admin) {
     LOG.info("Executing splitting normalization plan: " + this);
     try {
-      admin.splitRegion(regionInfo.getRegionName());
-    } catch (IOException ex) {
+      admin.splitRegionAsync(regionInfo.getRegionName()).get();
+    } catch (Exception ex) {
       LOG.error("Error during region split: ", ex);
     }
   }
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/RegionMover.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/RegionMover.java
index 70a4f0e..fdd079e 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/RegionMover.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/RegionMover.java
@@ -271,7 +271,7 @@ public class RegionMover extends AbstractHBaseTool implements Closeable {
           LOG.info("Retry " + Integer.toString(count) + " of maximum " + Integer.toString(retries));
         }
         count = count + 1;
-        admin.move(region.getEncodedNameAsBytes(), Bytes.toBytes(targetServer.getServerName()));
+        admin.move(region.getEncodedNameAsBytes(), targetServer);
         long maxWait = startTime + (maxWaitInSeconds * 1000);
         while (EnvironmentEdgeManager.currentTime() < maxWait) {
           sameServer = isSameServer(region, sourceServer);
@@ -321,7 +321,7 @@ public class RegionMover extends AbstractHBaseTool implements Closeable {
       try {
         LOG.info("Moving region:" + region.getEncodedName() + " from " + sourceServer + " to "
             + targetServer);
-        admin.move(region.getEncodedNameAsBytes(), Bytes.toBytes(targetServer.getServerName()));
+        admin.move(region.getEncodedNameAsBytes(), targetServer);
         LOG.info("Moved " + region.getEncodedName() + " from " + sourceServer + " to "
             + targetServer);
       } catch (Exception e) {
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
index 3f69e79..c147fa1 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
@@ -3498,8 +3498,7 @@ public class HBaseTestingUtility extends HBaseZKTestingUtility {
       throws InterruptedException, IOException {
     HMaster master = getMiniHBaseCluster().getMaster();
     // TODO: Here we start the move. The move can take a while.
-    getAdmin().move(destRegion.getEncodedNameAsBytes(),
-        Bytes.toBytes(destServer.getServerName()));
+    getAdmin().move(destRegion.getEncodedNameAsBytes(), destServer);
     while (true) {
       ServerName serverName = master.getAssignmentManager().getRegionStates()
           .getRegionServerOfRegion(destRegion);
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestPartialResultsFromClientSide.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestPartialResultsFromClientSide.java
index cc62cbb..bd002e9 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestPartialResultsFromClientSide.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestPartialResultsFromClientSide.java
@@ -828,8 +828,7 @@ public class TestPartialResultsFromClientSide {
     assertEquals(1, regions.size());
     RegionInfo regionInfo = regions.get(0).getFirst();
     ServerName name = TEST_UTIL.getHBaseCluster().getRegionServer(index).getServerName();
-    TEST_UTIL.getAdmin().move(regionInfo.getEncodedNameAsBytes(),
-        Bytes.toBytes(name.getServerName()));
+    TEST_UTIL.getAdmin().move(regionInfo.getEncodedNameAsBytes(), name);
   }
 
   private void assertCell(Cell cell, byte[] row, byte[] cf, byte[] cq) {
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/RegionReplicaTestHelper.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/RegionReplicaTestHelper.java
index c14f69f..cd04567 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/RegionReplicaTestHelper.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/RegionReplicaTestHelper.java
@@ -29,7 +29,6 @@ import org.apache.hadoop.hbase.RegionLocations;
 import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.Waiter.ExplainingPredicate;
-import org.apache.hadoop.hbase.util.Bytes;
 
 final class RegionReplicaTestHelper {
 
@@ -89,8 +88,7 @@ final class RegionReplicaTestHelper {
     ServerName newServerName = util.getHBaseCluster().getRegionServerThreads().stream()
       .map(t -> t.getRegionServer().getServerName()).filter(sn -> !sn.equals(serverName)).findAny()
       .get();
-    util.getAdmin().move(regionInfo.getEncodedNameAsBytes(),
-      Bytes.toBytes(newServerName.getServerName()));
+    util.getAdmin().move(regionInfo.getEncodedNameAsBytes(), newServerName);
     util.waitFor(30000, new ExplainingPredicate<Exception>() {
 
       @Override
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin1.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin1.java
index 9484be6..bbff17a 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin1.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin1.java
@@ -1216,7 +1216,7 @@ public class TestAdmin1 {
     // the element at index 1 would be a replica (since the metareader gives us ordered
     // regions). Try splitting that region via the split API . Should fail
     try {
-      TEST_UTIL.getAdmin().splitRegion(regions.get(1).getFirst().getRegionName());
+      TEST_UTIL.getAdmin().splitRegionAsync(regions.get(1).getFirst().getRegionName()).get();
     } catch (IllegalArgumentException ex) {
       gotException = true;
     }
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin2.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin2.java
index 2c14eaf..9cbb474 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin2.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin2.java
@@ -457,7 +457,7 @@ public class TestAdmin2 {
     RegionInfo hri = tableRegions.get(0);
     AssignmentManager am = master.getAssignmentManager();
     ServerName server = am.getRegionStates().getRegionServerOfRegion(hri);
-    localAdmin.move(hri.getEncodedNameAsBytes(), Bytes.toBytes(server.getServerName()));
+    localAdmin.move(hri.getEncodedNameAsBytes(), server);
     assertEquals("Current region server and region server before move should be same.", server,
       am.getRegionStates().getRegionServerOfRegion(hri));
   }
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncNonMetaRegionLocator.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncNonMetaRegionLocator.java
index cb09b79..042e067 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncNonMetaRegionLocator.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncNonMetaRegionLocator.java
@@ -249,8 +249,7 @@ public class TestAsyncNonMetaRegionLocator {
       .map(t -> t.getRegionServer().getServerName()).filter(sn -> !sn.equals(serverName)).findAny()
       .get();
 
-    TEST_UTIL.getAdmin().move(Bytes.toBytes(loc.getRegion().getEncodedName()),
-      Bytes.toBytes(newServerName.getServerName()));
+    TEST_UTIL.getAdmin().move(Bytes.toBytes(loc.getRegion().getEncodedName()), newServerName);
     while (!TEST_UTIL.getRSForFirstRegionInTable(TABLE_NAME).getServerName()
       .equals(newServerName)) {
       Thread.sleep(100);
@@ -326,7 +325,7 @@ public class TestAsyncNonMetaRegionLocator {
       .get();
     Admin admin = TEST_UTIL.getAdmin();
     RegionInfo region = admin.getRegions(TABLE_NAME).stream().findAny().get();
-    admin.move(region.getEncodedNameAsBytes(), Bytes.toBytes(newServerName.getServerName()));
+    admin.move(region.getEncodedNameAsBytes(), newServerName);
     TEST_UTIL.waitFor(30000, new ExplainingPredicate<Exception>() {
 
       @Override
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncSingleRequestRpcRetryingCaller.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncSingleRequestRpcRetryingCaller.java
index 7d8956b..8959c1d 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncSingleRequestRpcRetryingCaller.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncSingleRequestRpcRetryingCaller.java
@@ -87,15 +87,14 @@ public class TestAsyncSingleRequestRpcRetryingCaller {
     // This will leave a cached entry in location cache
     HRegionLocation loc = CONN.getRegionLocator(TABLE_NAME).getRegionLocation(ROW).get();
     int index = TEST_UTIL.getHBaseCluster().getServerWith(loc.getRegion().getRegionName());
-    TEST_UTIL.getAdmin().move(loc.getRegion().getEncodedNameAsBytes(), Bytes.toBytes(
-      TEST_UTIL.getHBaseCluster().getRegionServer(1 - index).getServerName().getServerName()));
+    TEST_UTIL.getAdmin().move(loc.getRegion().getEncodedNameAsBytes(),
+      TEST_UTIL.getHBaseCluster().getRegionServer(1 - index).getServerName());
     AsyncTable<?> table = CONN.getTableBuilder(TABLE_NAME).setRetryPause(100, TimeUnit.MILLISECONDS)
       .setMaxRetries(30).build();
     table.put(new Put(ROW).addColumn(FAMILY, QUALIFIER, VALUE)).get();
 
     // move back
-    TEST_UTIL.getAdmin().move(loc.getRegion().getEncodedNameAsBytes(),
-      Bytes.toBytes(loc.getServerName().getServerName()));
+    TEST_UTIL.getAdmin().move(loc.getRegion().getEncodedNameAsBytes(), loc.getServerName());
     Result result = table.get(new Get(ROW).addColumn(FAMILY, QUALIFIER)).get();
     assertArrayEquals(VALUE, result.getValue(FAMILY, QUALIFIER));
   }
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableGetMultiThreaded.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableGetMultiThreaded.java
index 8a2dfcc..19dc05c 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableGetMultiThreaded.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableGetMultiThreaded.java
@@ -172,8 +172,7 @@ public class TestAsyncTableGetMultiThreaded {
       ServerName newMetaServer = TEST_UTIL.getHBaseCluster().getRegionServerThreads().stream()
           .map(t -> t.getRegionServer().getServerName()).filter(s -> !s.equals(metaServer))
           .findAny().get();
-      admin.move(RegionInfoBuilder.FIRST_META_REGIONINFO.getEncodedNameAsBytes(),
-        Bytes.toBytes(newMetaServer.getServerName()));
+      admin.move(RegionInfoBuilder.FIRST_META_REGIONINFO.getEncodedNameAsBytes(), newMetaServer);
       Thread.sleep(5000);
     }
     stop.set(true);
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestConnectionImplementation.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestConnectionImplementation.java
index 4d9f39b..e91d9c5 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestConnectionImplementation.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestConnectionImplementation.java
@@ -40,7 +40,6 @@ import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.stream.Collectors;
 import java.util.stream.IntStream;
-
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.Cell;
 import org.apache.hadoop.hbase.HBaseClassTestRule;
@@ -232,8 +231,8 @@ public class TestConnectionImplementation {
     final ConnectionImplementation hci =  (ConnectionImplementation)TEST_UTIL.getConnection();
     try (RegionLocator l = TEST_UTIL.getConnection().getRegionLocator(tableName)) {
       while (l.getRegionLocation(rk).getPort() != sn.getPort()) {
-        TEST_UTIL.getAdmin().move(l.getRegionLocation(rk).getRegionInfo().
-            getEncodedNameAsBytes(), Bytes.toBytes(sn.toString()));
+        TEST_UTIL.getAdmin().move(l.getRegionLocation(rk).getRegionInfo().getEncodedNameAsBytes(),
+          sn);
         TEST_UTIL.waitUntilNoRegionsInTransition();
         hci.clearRegionCache(tableName);
       }
@@ -604,10 +603,7 @@ public class TestConnectionImplementation {
     // Moving. It's possible that we don't have all the regions online at this point, so
     //  the test must depend only on the region we're looking at.
     LOG.info("Move starting region="+toMove.getRegionInfo().getRegionNameAsString());
-    TEST_UTIL.getAdmin().move(
-      toMove.getRegionInfo().getEncodedNameAsBytes(),
-      destServerName.getServerName().getBytes()
-    );
+    TEST_UTIL.getAdmin().move(toMove.getRegionInfo().getEncodedNameAsBytes(), destServerName);
 
     while (destServer.getOnlineRegion(regionName) == null ||
         destServer.getRegionsInTransitionInRS().containsKey(encodedRegionNameBytes) ||
@@ -670,10 +666,8 @@ public class TestConnectionImplementation {
 
     // We move it back to do another test with a scan
     LOG.info("Move starting region=" + toMove.getRegionInfo().getRegionNameAsString());
-    TEST_UTIL.getAdmin().move(
-      toMove.getRegionInfo().getEncodedNameAsBytes(),
-      curServer.getServerName().getServerName().getBytes()
-    );
+    TEST_UTIL.getAdmin().move(toMove.getRegionInfo().getEncodedNameAsBytes(),
+      curServer.getServerName());
 
     while (curServer.getOnlineRegion(regionName) == null ||
         destServer.getRegionsInTransitionInRS().containsKey(encodedRegionNameBytes) ||
@@ -928,10 +922,7 @@ public class TestConnectionImplementation {
        // Moving. It's possible that we don't have all the regions online at this point, so
       //  the test depends only on the region we're looking at.
       LOG.info("Move starting region=" + toMove.getRegionInfo().getRegionNameAsString());
-      TEST_UTIL.getAdmin().move(
-          toMove.getRegionInfo().getEncodedNameAsBytes(),
-          destServerName.getServerName().getBytes()
-      );
+      TEST_UTIL.getAdmin().move(toMove.getRegionInfo().getEncodedNameAsBytes(), destServerName);
 
       while (destServer.getOnlineRegion(regionName) == null ||
           destServer.getRegionsInTransitionInRS().containsKey(encodedRegionNameBytes) ||
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
index d458218..39fbdbd 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
@@ -5362,8 +5362,7 @@ public class TestFromClientSide {
         HRegionServer regionServer = TEST_UTIL.getHBaseCluster().getRegionServer(i);
         ServerName addr = regionServer.getServerName();
         if (addr.getPort() != addrBefore.getPort()) {
-          admin.move(regionInfo.getEncodedNameAsBytes(),
-              Bytes.toBytes(addr.toString()));
+          admin.move(regionInfo.getEncodedNameAsBytes(), addr);
           // Wait for the region to move.
           Thread.sleep(5000);
           addrAfter = addr;
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestHBaseAdminNoCluster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestHBaseAdminNoCluster.java
index a1026a9..d9add95 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestHBaseAdminNoCluster.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestHBaseAdminNoCluster.java
@@ -185,7 +185,7 @@ public class TestHBaseAdminNoCluster {
     testMasterOperationIsRetried(new MethodCaller() {
       @Override
       public void call(Admin admin) throws Exception {
-        admin.move(new byte[0], null);
+        admin.move(new byte[0]);
       }
       @Override
       public void verify(MasterKeepAliveConnection masterAdmin, int count) throws Exception {
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java
index f52e020..e923911 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java
@@ -131,7 +131,7 @@ public class TestMetaWithReplicas {
           TEST_UTIL.getHBaseCluster().getRegionServer(metaServerIndex).getServerName();
       assertNotEquals(destinationServerName, metaServerName);
       TEST_UTIL.getAdmin().move(RegionInfoBuilder.FIRST_META_REGIONINFO.getEncodedNameAsBytes(),
-          Bytes.toBytes(destinationServerName.toString()));
+        destinationServerName);
     }
     // Disable the balancer
     LoadBalancerTracker l = new LoadBalancerTracker(TEST_UTIL.getZooKeeperWatcher(),
@@ -230,7 +230,7 @@ public class TestMetaWithReplicas {
         // If the servers are the same, then move the test table's region out of the server
         // to another random server
         if (hrl.getServerName().equals(primary)) {
-          util.getAdmin().move(hrl.getRegionInfo().getEncodedNameAsBytes(), null);
+          util.getAdmin().move(hrl.getRegionInfo().getEncodedNameAsBytes());
           // wait for the move to complete
           do {
             Thread.sleep(10);
@@ -462,7 +462,7 @@ public class TestMetaWithReplicas {
     TEST_UTIL.createTable(tableName, "f");
     assertTrue(TEST_UTIL.getAdmin().tableExists(tableName));
     TEST_UTIL.getAdmin().move(RegionInfoBuilder.FIRST_META_REGIONINFO.getEncodedNameAsBytes(),
-        Bytes.toBytes(moveToServer.getServerName()));
+      moveToServer);
     int i = 0;
     assert !moveToServer.equals(currentServer);
     LOG.info("CurrentServer=" + currentServer + ", moveToServer=" + moveToServer);
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMvccConsistentScanner.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMvccConsistentScanner.java
index 2312655..0d2aff0 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMvccConsistentScanner.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMvccConsistentScanner.java
@@ -92,8 +92,7 @@ public class TestMvccConsistentScanner {
     HRegionServer rs =
         UTIL.getHBaseCluster().getRegionServerThreads().stream().map(t -> t.getRegionServer())
             .filter(r -> !r.getOnlineTables().contains(tableName)).findAny().get();
-    UTIL.getAdmin().move(region.getEncodedNameAsBytes(),
-      Bytes.toBytes(rs.getServerName().getServerName()));
+    UTIL.getAdmin().move(region.getEncodedNameAsBytes(), rs.getServerName());
     while (UTIL.getRSForFirstRegionInTable(tableName) != rs) {
       Thread.sleep(100);
     }
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestSeparateClientZKCluster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestSeparateClientZKCluster.java
index 026010d..511d072 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestSeparateClientZKCluster.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestSeparateClientZKCluster.java
@@ -165,11 +165,11 @@ public class TestSeparateClientZKCluster {
       Get get = new Get(row);
       Result result = table.get(get);
       // move meta region and confirm client could detect
-      byte[] destServerName = null;
+      ServerName destServerName = null;
       for (RegionServerThread rst : cluster.getLiveRegionServerThreads()) {
         ServerName name = rst.getRegionServer().getServerName();
         if (!name.equals(cluster.getServerHoldingMeta())) {
-          destServerName = Bytes.toBytes(name.getServerName());
+          destServerName = name;
           break;
         }
       }
@@ -182,7 +182,7 @@ public class TestSeparateClientZKCluster {
       for (RegionServerThread rst : cluster.getLiveRegionServerThreads()) {
         ServerName name = rst.getRegionServer().getServerName();
         if (!name.equals(currentServer)) {
-          destServerName = Bytes.toBytes(name.getServerName());
+          destServerName = name;
           break;
         }
       }
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestSnapshotCloneIndependence.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestSnapshotCloneIndependence.java
index 0562c90..90201c6 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestSnapshotCloneIndependence.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestSnapshotCloneIndependence.java
@@ -307,7 +307,7 @@ public class TestSnapshotCloneIndependence {
       originalRegionCount, cloneTableRegionCount);
 
     // Split a region on the parent table
-    admin.splitRegion(originalTableHRegions.get(0).getRegionName());
+    admin.splitRegionAsync(originalTableHRegions.get(0).getRegionName()).get();
     waitOnSplit(UTIL.getConnection(), originalTable, originalRegionCount);
 
     // Verify that the cloned table region is not split
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverInterface.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverInterface.java
index ef3fa10..6934c98 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverInterface.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverInterface.java
@@ -589,7 +589,7 @@ public class TestRegionObserverInterface {
       ServerName sn2 = rs1.getRegionServer().getServerName();
       String regEN = locator.getAllRegionLocations().get(0).getRegionInfo().getEncodedName();
 
-      util.getAdmin().move(regEN.getBytes(), sn2.getServerName().getBytes());
+      util.getAdmin().move(Bytes.toBytes(regEN), sn2);
       while (!sn2.equals(locator.getAllRegionLocations().get(0).getServerName())) {
         Thread.sleep(100);
       }
@@ -639,7 +639,7 @@ public class TestRegionObserverInterface {
       ServerName sn2 = rs1.getRegionServer().getServerName();
       String regEN = locator.getAllRegionLocations().get(0).getRegionInfo().getEncodedName();
 
-      util.getAdmin().move(regEN.getBytes(), sn2.getServerName().getBytes());
+      util.getAdmin().move(Bytes.toBytes(regEN), sn2);
       while (!sn2.equals(locator.getAllRegionLocations().get(0).getServerName())) {
         Thread.sleep(100);
       }
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/AbstractTestDLS.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/AbstractTestDLS.java
index 3f074c8..084dd89 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/AbstractTestDLS.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/AbstractTestDLS.java
@@ -731,8 +731,7 @@ public abstract class AbstractTestDLS {
           // the RS doesn't have regions of the specified table so we need move one to this RS
           List<RegionInfo> tableRegions = TEST_UTIL.getAdmin().getRegions(tableName);
           RegionInfo hri = tableRegions.get(0);
-          TEST_UTIL.getAdmin().move(hri.getEncodedNameAsBytes(),
-            Bytes.toBytes(destRS.getServerName().getServerName()));
+          TEST_UTIL.getAdmin().move(hri.getEncodedNameAsBytes(), destRS.getServerName());
           // wait for region move completes
           RegionStates regionStates =
               TEST_UTIL.getHBaseCluster().getMaster().getAssignmentManager().getRegionStates();
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestCatalogJanitorInMemoryStates.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestCatalogJanitorInMemoryStates.java
index fcd1638..b4bafb7 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestCatalogJanitorInMemoryStates.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestCatalogJanitorInMemoryStates.java
@@ -91,7 +91,7 @@ public class TestCatalogJanitorInMemoryStates {
    * Test clearing a split parent from memory.
    */
   @Test
-  public void testInMemoryParentCleanup() throws IOException, InterruptedException {
+  public void testInMemoryParentCleanup() throws Exception {
     final AssignmentManager am = TEST_UTIL.getHBaseCluster().getMaster().getAssignmentManager();
     final ServerManager sm = TEST_UTIL.getHBaseCluster().getMaster().getServerManager();
     final CatalogJanitor janitor = TEST_UTIL.getHBaseCluster().getMaster().getCatalogJanitor();
@@ -136,12 +136,12 @@ public class TestCatalogJanitorInMemoryStates {
  * @throws IOException, InterruptedException
  */
   private List<HRegionLocation> splitRegion(final RegionInfo r)
-      throws IOException, InterruptedException {
+      throws Exception {
     List<HRegionLocation> locations = new ArrayList<>();
     // Split this table in two.
     Admin admin = TEST_UTIL.getAdmin();
     Connection connection = TEST_UTIL.getConnection();
-    admin.splitRegion(r.getEncodedNameAsBytes());
+    admin.splitRegionAsync(r.getEncodedNameAsBytes()).get();
     admin.close();
     PairOfSameType<RegionInfo> regions = waitOnDaughters(r);
     if (regions != null) {
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestCloseAnOpeningRegion.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestCloseAnOpeningRegion.java
index 17cf8f4..ba4d535 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestCloseAnOpeningRegion.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestCloseAnOpeningRegion.java
@@ -115,8 +115,7 @@ public class TestCloseAnOpeningRegion {
     HRegionServer dst = UTIL.getOtherRegionServer(src);
     Thread move0 = new Thread(() -> {
       try {
-        UTIL.getAdmin().move(region.getEncodedNameAsBytes(),
-          Bytes.toBytes(dst.getServerName().getServerName()));
+        UTIL.getAdmin().move(region.getEncodedNameAsBytes(), dst.getServerName());
       } catch (IOException e) {
         throw new UncheckedIOException(e);
       }
@@ -125,8 +124,7 @@ public class TestCloseAnOpeningRegion {
     ARRIVE.await();
     Thread move1 = new Thread(() -> {
       try {
-        UTIL.getAdmin().move(region.getEncodedNameAsBytes(),
-          Bytes.toBytes(src.getServerName().getServerName()));
+        UTIL.getAdmin().move(region.getEncodedNameAsBytes(), src.getServerName());
       } catch (IOException e) {
         throw new UncheckedIOException(e);
       }
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMaster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMaster.java
index ce04761..3f6bd6a 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMaster.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMaster.java
@@ -195,7 +195,7 @@ public class TestMaster {
           .setStartKey(Bytes.toBytes("A"))
           .setEndKey(Bytes.toBytes("Z"))
           .build();
-      admin.move(hri.getEncodedNameAsBytes(), null);
+      admin.move(hri.getEncodedNameAsBytes());
       fail("Region should not be moved since it is fake");
     } catch (IOException ioe) {
       assertTrue(ioe instanceof UnknownRegionException);
@@ -217,7 +217,7 @@ public class TestMaster {
       List<RegionInfo> tableRegions = admin.getRegions(tableName);
 
       master.setInitialized(false); // fake it, set back later
-      admin.move(tableRegions.get(0).getEncodedNameAsBytes(), null);
+      admin.move(tableRegions.get(0).getEncodedNameAsBytes());
       fail("Region should not be moved since master is not initialized");
     } catch (IOException ioe) {
       assertTrue(StringUtils.stringifyException(ioe).contains("PleaseHoldException"));
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterHandlerFullWhenTransitRegion.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterHandlerFullWhenTransitRegion.java
index 049c560..e136cdd 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterHandlerFullWhenTransitRegion.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterHandlerFullWhenTransitRegion.java
@@ -69,7 +69,7 @@ public class TestMasterHandlerFullWhenTransitRegion {
     //See HBASE-21754
     //There is Only one handler, if ReportRegionStateTransitionRequest executes in the same kind
     // of thread with moveRegion, it will lock each other. Making the move operation can not finish.
-    UTIL.getAdmin().move(regionInfo.getEncodedNameAsBytes(), null);
+    UTIL.getAdmin().move(regionInfo.getEncodedNameAsBytes());
     LOG.info("Region move complete");
   }
 
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestCloseRegionWhileRSCrash.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestCloseRegionWhileRSCrash.java
index 0a29958..04e6930 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestCloseRegionWhileRSCrash.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestCloseRegionWhileRSCrash.java
@@ -150,8 +150,7 @@ public class TestCloseRegionWhileRSCrash {
     if (!srcRs.getRegions(TableName.META_TABLE_NAME).isEmpty()) {
       RegionInfo metaRegion = srcRs.getRegions(TableName.META_TABLE_NAME).get(0).getRegionInfo();
       HRegionServer dstRs = UTIL.getOtherRegionServer(srcRs);
-      UTIL.getAdmin().move(metaRegion.getEncodedNameAsBytes(),
-        Bytes.toBytes(dstRs.getServerName().getServerName()));
+      UTIL.getAdmin().move(metaRegion.getEncodedNameAsBytes(), dstRs.getServerName());
       UTIL.waitFor(30000, () -> !dstRs.getRegions(TableName.META_TABLE_NAME).isEmpty());
     }
   }
@@ -175,8 +174,7 @@ public class TestCloseRegionWhileRSCrash {
       () -> procExec.getProcedures().stream().anyMatch(p -> p instanceof ServerCrashProcedure));
     Thread t = new Thread(() -> {
       try {
-        UTIL.getAdmin().move(region.getEncodedNameAsBytes(),
-          Bytes.toBytes(dstRs.getServerName().getServerName()));
+        UTIL.getAdmin().move(region.getEncodedNameAsBytes(), dstRs.getServerName());
       } catch (IOException e) {
       }
     });
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestFavoredStochasticBalancerPickers.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestFavoredStochasticBalancerPickers.java
index 0b40ae0..6a050a8 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestFavoredStochasticBalancerPickers.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestFavoredStochasticBalancerPickers.java
@@ -152,8 +152,7 @@ public class TestFavoredStochasticBalancerPickers extends BalancerTestBase {
     RegionStates rst = master.getAssignmentManager().getRegionStates();
     for (int i = 0; i < regionsToMove; i++) {
       final RegionInfo regionInfo = hris.get(i);
-      admin.move(regionInfo.getEncodedNameAsBytes(),
-          Bytes.toBytes(mostLoadedServer.getServerName()));
+      admin.move(regionInfo.getEncodedNameAsBytes(), mostLoadedServer);
       LOG.info("Moving region: " + hris.get(i).getRegionNameAsString() + " to " + mostLoadedServer);
       TEST_UTIL.waitFor(60000, new Waiter.Predicate<Exception>() {
         @Override
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCleanupMetaWAL.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCleanupMetaWAL.java
index 03b3316..a5c2987 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCleanupMetaWAL.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCleanupMetaWAL.java
@@ -65,7 +65,7 @@ public class TestCleanupMetaWAL {
     HRegionServer serverWithMeta = TEST_UTIL.getMiniHBaseCluster()
         .getRegionServer(TEST_UTIL.getMiniHBaseCluster().getServerWithMeta());
     TEST_UTIL.getAdmin()
-        .move(RegionInfoBuilder.FIRST_META_REGIONINFO.getEncodedNameAsBytes(), null);
+        .move(RegionInfoBuilder.FIRST_META_REGIONINFO.getEncodedNameAsBytes());
     LOG.info("KILL");
     TEST_UTIL.getMiniHBaseCluster().killRegionServer(serverWithMeta.getServerName());
     LOG.info("WAIT");
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionOnCluster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionOnCluster.java
index 0681c37..42ab311 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionOnCluster.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionOnCluster.java
@@ -109,8 +109,7 @@ public class TestHRegionOnCluster {
 
       TEST_UTIL.waitUntilAllRegionsAssigned(table.getName());
       LOG.info("Moving " + regionInfo.getEncodedName() + " to " + targetServer.getServerName());
-      hbaseAdmin.move(regionInfo.getEncodedNameAsBytes(),
-          Bytes.toBytes(targetServer.getServerName().getServerName()));
+      hbaseAdmin.move(regionInfo.getEncodedNameAsBytes(), targetServer.getServerName());
       do {
         Thread.sleep(1);
       } while (cluster.getServerWith(regionInfo.getRegionName()) == originServerNum);
@@ -122,8 +121,7 @@ public class TestHRegionOnCluster {
       TEST_UTIL.waitUntilAllRegionsAssigned(table.getName());
       // Move region to origin server
       LOG.info("Moving " + regionInfo.getEncodedName() + " to " + originServer.getServerName());
-      hbaseAdmin.move(regionInfo.getEncodedNameAsBytes(),
-          Bytes.toBytes(originServer.getServerName().getServerName()));
+      hbaseAdmin.move(regionInfo.getEncodedNameAsBytes(), originServer.getServerName());
       do {
         Thread.sleep(1);
       } while (cluster.getServerWith(regionInfo.getRegionName()) == targetServerNum);
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestOpenSeqNumUnexpectedIncrease.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestOpenSeqNumUnexpectedIncrease.java
index 14d5a98..11db694 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestOpenSeqNumUnexpectedIncrease.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestOpenSeqNumUnexpectedIncrease.java
@@ -99,8 +99,7 @@ public class TestOpenSeqNumUnexpectedIncrease {
 
     // will fail two times, and then verify that the open sequence number is still openSeqNum + 2
     FAILED_OPEN.set(2);
-    UTIL.getAdmin().move(region.getRegionInfo().getEncodedNameAsBytes(),
-      Bytes.toBytes(dst.getServerName().getServerName()));
+    UTIL.getAdmin().move(region.getRegionInfo().getEncodedNameAsBytes(), dst.getServerName());
     UTIL.waitTableAvailable(TABLE_NAME);
 
     HRegion region1 = UTIL.getMiniHBaseCluster().getRegions(TABLE_NAME).get(0);
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionMove.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionMove.java
index badd8db..a9874bf 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionMove.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionMove.java
@@ -119,8 +119,7 @@ public class TestRegionMove {
     // Offline the region and then try to move it. Should fail.
     admin.unassign(regionToMove.getRegionName(), true);
     try {
-      admin.move(regionToMove.getEncodedNameAsBytes(),
-          Bytes.toBytes(rs2.getServerName().toString()));
+      admin.move(regionToMove.getEncodedNameAsBytes(), rs2.getServerName());
       fail();
     } catch (DoNotRetryRegionException e) {
       // We got expected exception
@@ -133,8 +132,7 @@ public class TestRegionMove {
 
     try {
       // Move the region to the other RS -- should fail
-      admin.move(regionToMove.getEncodedNameAsBytes(),
-        Bytes.toBytes(rs2.getServerName().toString()));
+      admin.move(regionToMove.getEncodedNameAsBytes(), rs2.getServerName());
       fail();
     } catch (DoNotRetryIOException e) {
       // We got expected exception
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java
index f24515d..6fcd073 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java
@@ -328,7 +328,7 @@ public class TestSplitTransactionOnCluster {
       // We don't roll back here anymore. Instead we fail-fast on construction of the
       // split transaction. Catch the exception instead.
       try {
-        this.admin.splitRegionAsync(hri.getRegionName(), null);
+        this.admin.splitRegionAsync(hri.getRegionName());
         fail();
       } catch (DoNotRetryRegionException e) {
         // Expected
@@ -541,7 +541,7 @@ public class TestSplitTransactionOnCluster {
       HRegionServer server = cluster.getRegionServer(tableRegionIndex);
       printOutRegions(server, "Initial regions: ");
       // Call split.
-      this.admin.splitRegionAsync(hri.getRegionName(), null);
+      this.admin.splitRegionAsync(hri.getRegionName());
       List<HRegion> daughters = checkAndGetDaughters(tableName);
 
       // Before cleanup, get a new master.
@@ -837,7 +837,7 @@ public class TestSplitTransactionOnCluster {
 
   private void split(final RegionInfo hri, final HRegionServer server, final int regionCount)
       throws IOException, InterruptedException {
-    admin.splitRegionAsync(hri.getRegionName(), null);
+    admin.splitRegionAsync(hri.getRegionName());
     for (int i = 0; cluster.getRegions(hri.getTable()).size() <= regionCount && i < 60; i++) {
       LOG.debug("Waiting on region " + hri.getRegionNameAsString() + " to split");
       Thread.sleep(2000);
@@ -885,7 +885,7 @@ public class TestSplitTransactionOnCluster {
       LOG.info("Moving " + hri.getRegionNameAsString() + " from " +
         metaRegionServer.getServerName() + " to " +
         hrs.getServerName() + "; metaServerIndex=" + metaServerIndex);
-      admin.move(hri.getEncodedNameAsBytes(), Bytes.toBytes(hrs.getServerName().toString()));
+      admin.move(hri.getEncodedNameAsBytes(), hrs.getServerName());
     }
     // Wait till table region is up on the server that is NOT carrying hbase:meta.
     for (int i = 0; i < 100; i++) {
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/SerialReplicationTestBase.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/SerialReplicationTestBase.java
index 1b98518..e1a7ecd 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/SerialReplicationTestBase.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/SerialReplicationTestBase.java
@@ -147,8 +147,7 @@ public class SerialReplicationTestBase {
   }
 
   protected static void moveRegion(RegionInfo region, HRegionServer rs) throws Exception {
-    UTIL.getAdmin().move(region.getEncodedNameAsBytes(),
-      Bytes.toBytes(rs.getServerName().getServerName()));
+    UTIL.getAdmin().move(region.getEncodedNameAsBytes(), rs.getServerName());
     UTIL.waitFor(30000, new ExplainingPredicate<Exception>() {
 
       @Override
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
index 7cbe0e6..f70c4d7 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
@@ -2140,8 +2140,7 @@ public class TestAccessController extends SecureTestUtil {
       AccessTestAction moveAction = new AccessTestAction() {
         @Override
         public Object run() throws Exception {
-          admin.move(hri.getEncodedNameAsBytes(),
-            Bytes.toBytes(newRs.getServerName().getServerName()));
+          admin.move(hri.getEncodedNameAsBytes(), newRs.getServerName());
           return null;
         }
       };
diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/client/ThriftAdmin.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/client/ThriftAdmin.java
index 355468e..9d84a0e 100644
--- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/client/ThriftAdmin.java
+++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/client/ThriftAdmin.java
@@ -717,9 +717,13 @@ public class ThriftAdmin implements Admin {
   }
 
   @Override
-  public void move(byte[] encodedRegionName, byte[] destServerName) {
+  public void move(byte[] encodedRegionName) {
     throw new NotImplementedException("move not supported in ThriftAdmin");
+  }
 
+  @Override
+  public void move(byte[] encodedRegionName, ServerName destServerName) {
+    throw new NotImplementedException("move not supported in ThriftAdmin");
   }
 
   @Override
@@ -1356,4 +1360,9 @@ public class ThriftAdmin implements Admin {
       getUserPermissions(GetUserPermissionsRequest getUserPermissionsRequest) {
     throw new NotImplementedException("getUserPermissions not supported in ThriftAdmin");
   }
+
+  @Override
+  public Future<Void> splitRegionAsync(byte[] regionName) throws IOException {
+    return splitRegionAsync(regionName, null);
+  }
 }


Mime
View raw message