This is an automated email from the ASF dual-hosted git repository. zhangduo pushed a commit to branch HBASE-21512 in repository https://gitbox.apache.org/repos/asf/hbase.git
commit e3729b0f422ae2ea602bb909b929b9ca57265d04 Author: zhangduo <zhang...@apache.org> AuthorDate: Fri Nov 30 08:23:47 2018 +0800 HBASE-21515 Also initialize an AsyncClusterConnection in HRegionServer --- .../hbase/client/AsyncClusterConnection.java | 38 +++++++++++++ .../hadoop/hbase/client/AsyncConnectionImpl.java | 14 +++-- .../hbase/client/ClusterConnectionFactory.java | 63 ++++++++++++++++++++++ .../hadoop/hbase/client/ConnectionFactory.java | 5 +- .../apache/hadoop/hbase/util/ReflectionUtils.java | 22 ++++---- .../main/java/org/apache/hadoop/hbase/Server.java | 20 +++++++ .../org/apache/hadoop/hbase/master/HMaster.java | 3 ++ .../hadoop/hbase/regionserver/HRegionServer.java | 56 +++++++++++++------ .../regionserver/ReplicationSyncUp.java | 6 +++ .../hadoop/hbase/MockRegionServerServices.java | 5 ++ .../client/TestAsyncNonMetaRegionLocator.java | 2 +- ...stAsyncNonMetaRegionLocatorConcurrenyLimit.java | 2 +- .../client/TestAsyncRegionLocatorTimeout.java | 2 +- .../TestAsyncSingleRequestRpcRetryingCaller.java | 4 +- .../hbase/client/TestAsyncTableNoncedRetry.java | 2 +- .../hbase/master/MockNoopMasterServices.java | 6 +++ .../hadoop/hbase/master/MockRegionServer.java | 5 ++ .../hbase/master/TestActiveMasterManager.java | 6 +++ .../hbase/master/cleaner/TestHFileCleaner.java | 6 +++ .../hbase/master/cleaner/TestHFileLinkCleaner.java | 6 +++ .../hbase/master/cleaner/TestLogsCleaner.java | 6 +++ .../cleaner/TestReplicationHFileCleaner.java | 6 +++ .../hbase/regionserver/TestHeapMemoryManager.java | 6 +++ .../hbase/regionserver/TestSplitLogWorker.java | 6 +++ .../hadoop/hbase/regionserver/TestWALLockup.java | 6 +++ .../replication/TestReplicationTrackerZKImpl.java | 6 +++ .../regionserver/TestReplicationSourceManager.java | 6 +++ .../security/token/TestTokenAuthentication.java | 6 +++ .../org/apache/hadoop/hbase/util/MockServer.java | 6 +++ 29 files changed, 290 insertions(+), 37 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncClusterConnection.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncClusterConnection.java new file mode 100644 index 0000000..c7dea25 --- /dev/null +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncClusterConnection.java @@ -0,0 +1,38 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.hadoop.hbase.client; + +import org.apache.hadoop.hbase.ipc.RpcClient; +import org.apache.yetus.audience.InterfaceAudience; + +/** + * The asynchronous connection for internal usage. + */ +@InterfaceAudience.Private +public interface AsyncClusterConnection extends AsyncConnection { + + /** + * Get the nonce generator for this connection. + */ + NonceGenerator getNonceGenerator(); + + /** + * Get the rpc client we used to communicate with other servers. + */ + RpcClient getRpcClient(); +} diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncConnectionImpl.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncConnectionImpl.java index 1828650..bb5c083 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncConnectionImpl.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncConnectionImpl.java @@ -23,6 +23,7 @@ import static org.apache.hadoop.hbase.client.NonceGenerator.CLIENT_NONCES_ENABLE import static org.apache.hadoop.hbase.util.FutureUtils.addListener; import java.io.IOException; +import java.net.SocketAddress; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; @@ -63,7 +64,7 @@ import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.MasterServ * The implementation of AsyncConnection. */ @InterfaceAudience.Private -class AsyncConnectionImpl implements AsyncConnection { +class AsyncConnectionImpl implements AsyncClusterConnection { private static final Logger LOG = LoggerFactory.getLogger(AsyncConnectionImpl.class); @@ -106,7 +107,7 @@ class AsyncConnectionImpl implements AsyncConnection { private ChoreService authService; public AsyncConnectionImpl(Configuration conf, AsyncRegistry registry, String clusterId, - User user) { + SocketAddress localAddress, User user) { this.conf = conf; this.user = user; if (user.isLoginFromKeytab()) { @@ -114,7 +115,7 @@ class AsyncConnectionImpl implements AsyncConnection { } this.connConf = new AsyncConnectionConfiguration(conf); this.registry = registry; - this.rpcClient = RpcClientFactory.createClient(conf, clusterId); + this.rpcClient = RpcClientFactory.createClient(conf, clusterId, localAddress, null); this.rpcControllerFactory = RpcControllerFactory.instantiate(conf); this.hostnameCanChange = conf.getBoolean(RESOLVE_HOSTNAME_ON_FAIL_KEY, true); this.rpcTimeout = @@ -158,11 +159,16 @@ class AsyncConnectionImpl implements AsyncConnection { } // ditto - @VisibleForTesting + @Override public NonceGenerator getNonceGenerator() { return nonceGenerator; } + @Override + public RpcClient getRpcClient() { + return rpcClient; + } + private ClientService.Interface createRegionServerStub(ServerName serverName) throws IOException { return ClientService.newStub(rpcClient.createRpcChannel(serverName, user, rpcTimeout)); } diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClusterConnectionFactory.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClusterConnectionFactory.java new file mode 100644 index 0000000..68c0630 --- /dev/null +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClusterConnectionFactory.java @@ -0,0 +1,63 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.hadoop.hbase.client; + +import java.io.IOException; +import java.io.InterruptedIOException; +import java.net.SocketAddress; +import java.util.concurrent.ExecutionException; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hbase.security.User; +import org.apache.yetus.audience.InterfaceAudience; + +import org.apache.hbase.thirdparty.com.google.common.base.Throwables; + +/** + * The factory for creating {@link AsyncClusterConnection}. + */ +@InterfaceAudience.Private +public final class ClusterConnectionFactory { + + private ClusterConnectionFactory() { + } + + /** + * Create a new {@link AsyncClusterConnection} instance. + * <p/> + * Unlike what we have done in {@link ConnectionFactory}, here we just return an + * {@link AsyncClusterConnection} instead of a {@link java.util.concurrent.CompletableFuture}, + * which means this method could block on fetching the cluster id. This is just used to simplify + * the implementation, as when starting new region servers, we do not need to be event-driven. Can + * change later if we want a {@link java.util.concurrent.CompletableFuture} here. + */ + public static AsyncClusterConnection createAsyncClusterConnection(Configuration conf, + SocketAddress localAddress, User user) throws IOException { + AsyncRegistry registry = AsyncRegistryFactory.getRegistry(conf); + String clusterId; + try { + clusterId = registry.getClusterId().get(); + } catch (InterruptedException e) { + throw (IOException) new InterruptedIOException().initCause(e); + } catch (ExecutionException e) { + Throwable cause = e.getCause(); + Throwables.propagateIfPossible(cause, IOException.class); + throw new IOException(cause); + } + return new AsyncConnectionImpl(conf, registry, clusterId, localAddress, user); + } +} diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionFactory.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionFactory.java index e24af74..2ba732a 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionFactory.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionFactory.java @@ -295,9 +295,8 @@ public class ConnectionFactory { AsyncConnectionImpl.class, AsyncConnection.class); try { future.complete( - user.runAs((PrivilegedExceptionAction<? extends AsyncConnection>)() -> - ReflectionUtils.newInstance(clazz, conf, registry, clusterId, user)) - ); + user.runAs((PrivilegedExceptionAction<? extends AsyncConnection>) () -> ReflectionUtils + .newInstance(clazz, conf, registry, clusterId, null, user))); } catch (Exception e) { future.completeExceptionally(e); } diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/ReflectionUtils.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/ReflectionUtils.java index a136846..268249d 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/ReflectionUtils.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/ReflectionUtils.java @@ -83,15 +83,19 @@ public class ReflectionUtils { boolean match = true; for (int i = 0; i < ctorParamTypes.length && match; ++i) { - Class<?> paramType = paramTypes[i].getClass(); - match = (!ctorParamTypes[i].isPrimitive()) ? ctorParamTypes[i].isAssignableFrom(paramType) : - ((int.class.equals(ctorParamTypes[i]) && Integer.class.equals(paramType)) || - (long.class.equals(ctorParamTypes[i]) && Long.class.equals(paramType)) || - (double.class.equals(ctorParamTypes[i]) && Double.class.equals(paramType)) || - (char.class.equals(ctorParamTypes[i]) && Character.class.equals(paramType)) || - (short.class.equals(ctorParamTypes[i]) && Short.class.equals(paramType)) || - (boolean.class.equals(ctorParamTypes[i]) && Boolean.class.equals(paramType)) || - (byte.class.equals(ctorParamTypes[i]) && Byte.class.equals(paramType))); + if (paramTypes[i] == null) { + match = !ctorParamTypes[i].isPrimitive(); + } else { + Class<?> paramType = paramTypes[i].getClass(); + match = (!ctorParamTypes[i].isPrimitive()) ? ctorParamTypes[i].isAssignableFrom(paramType) + : ((int.class.equals(ctorParamTypes[i]) && Integer.class.equals(paramType)) || + (long.class.equals(ctorParamTypes[i]) && Long.class.equals(paramType)) || + (double.class.equals(ctorParamTypes[i]) && Double.class.equals(paramType)) || + (char.class.equals(ctorParamTypes[i]) && Character.class.equals(paramType)) || + (short.class.equals(ctorParamTypes[i]) && Short.class.equals(paramType)) || + (boolean.class.equals(ctorParamTypes[i]) && Boolean.class.equals(paramType)) || + (byte.class.equals(ctorParamTypes[i]) && Byte.class.equals(paramType))); + } } if (match) { diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/Server.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/Server.java index fb898ea..c33d5af 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/Server.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/Server.java @@ -20,6 +20,8 @@ package org.apache.hadoop.hbase; import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.hbase.client.AsyncClusterConnection; +import org.apache.hadoop.hbase.client.AsyncConnection; import org.apache.hadoop.hbase.client.ClusterConnection; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.zookeeper.ZKWatcher; @@ -61,6 +63,24 @@ public interface Server extends Abortable, Stoppable { ClusterConnection getClusterConnection(); /** + * Returns a reference to the servers' async connection. + * <p/> + * Important note: this method returns a reference to Connection which is managed by Server + * itself, so callers must NOT attempt to close connection obtained. + */ + default AsyncConnection getAsyncConnection() { + return getAsyncClusterConnection(); + } + + /** + * Returns a reference to the servers' async cluster connection. + * <p/> + * Important note: this method returns a reference to Connection which is managed by Server + * itself, so callers must NOT attempt to close connection obtained. + */ + AsyncClusterConnection getAsyncClusterConnection(); + + /** * @return The unique server name for this server. */ ServerName getServerName(); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java index 9d2a743..7579fd5 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java @@ -3033,6 +3033,9 @@ public class HMaster extends HRegionServer implements MasterServices { if (this.clusterConnection != null) { this.clusterConnection.close(); } + if (this.asyncClusterConnection != null) { + this.asyncClusterConnection.close(); + } } public void stopMaster() throws IOException { diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java index 34a6c13..dbc5e77 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java @@ -82,7 +82,9 @@ import org.apache.hadoop.hbase.TableDescriptors; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.YouAreDeadException; import org.apache.hadoop.hbase.ZNodeClearer; +import org.apache.hadoop.hbase.client.AsyncClusterConnection; import org.apache.hadoop.hbase.client.ClusterConnection; +import org.apache.hadoop.hbase.client.ClusterConnectionFactory; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.client.ConnectionUtils; import org.apache.hadoop.hbase.client.RegionInfo; @@ -109,7 +111,6 @@ import org.apache.hadoop.hbase.io.util.MemorySizeUtil; import org.apache.hadoop.hbase.ipc.CoprocessorRpcUtils; import org.apache.hadoop.hbase.ipc.NettyRpcClientConfigHelper; import org.apache.hadoop.hbase.ipc.RpcClient; -import org.apache.hadoop.hbase.ipc.RpcClientFactory; import org.apache.hadoop.hbase.ipc.RpcControllerFactory; import org.apache.hadoop.hbase.ipc.RpcServer; import org.apache.hadoop.hbase.ipc.RpcServerInterface; @@ -267,6 +268,11 @@ public class HRegionServer extends HasThread implements protected ClusterConnection clusterConnection; /** + * The asynchronous cluster connection to be shared by services. + */ + protected AsyncClusterConnection asyncClusterConnection; + + /** * Go here to get table descriptors. */ protected TableDescriptors tableDescriptors; @@ -783,11 +789,7 @@ public class HRegionServer extends HasThread implements return true; } - /** - * Create a 'smarter' Connection, one that is capable of by-passing RPC if the request is to the - * local server; i.e. a short-circuit Connection. Safe to use going to local or remote server. - */ - private ClusterConnection createClusterConnection() throws IOException { + private Configuration unsetClientZookeeperQuorum() { Configuration conf = this.conf; if (conf.get(HConstants.CLIENT_ZOOKEEPER_QUORUM) != null) { // Use server ZK cluster for server-issued connections, so we clone @@ -795,11 +797,20 @@ public class HRegionServer extends HasThread implements conf = new Configuration(this.conf); conf.unset(HConstants.CLIENT_ZOOKEEPER_QUORUM); } + return conf; + } + + /** + * Create a 'smarter' Connection, one that is capable of by-passing RPC if the request is to the + * local server; i.e. a short-circuit Connection. Safe to use going to local or remote server. + */ + private ClusterConnection createClusterConnection() throws IOException { // Create a cluster connection that when appropriate, can short-circuit and go directly to the // local server if the request is to the local server bypassing RPC. Can be used for both local // and remote invocations. - ClusterConnection conn = ConnectionUtils.createShortCircuitConnection(conf, null, - userProvider.getCurrent(), serverName, rpcServices, rpcServices); + ClusterConnection conn = + ConnectionUtils.createShortCircuitConnection(unsetClientZookeeperQuorum(), null, + userProvider.getCurrent(), serverName, rpcServices, rpcServices); // This is used to initialize the batch thread pool inside the connection implementation. // When deploy a fresh cluster, we may first use the cluster connection in InitMetaProcedure, // which will be executed inside the PEWorker, and then the batch thread pool will inherit the @@ -833,9 +844,12 @@ public class HRegionServer extends HasThread implements /** * Setup our cluster connection if not already initialized. */ - protected synchronized void setupClusterConnection() throws IOException { + protected final synchronized void setupClusterConnection() throws IOException { if (clusterConnection == null) { clusterConnection = createClusterConnection(); + asyncClusterConnection = + ClusterConnectionFactory.createAsyncClusterConnection(unsetClientZookeeperQuorum(), + new InetSocketAddress(this.rpcServices.isa.getAddress(), 0), userProvider.getCurrent()); } } @@ -849,8 +863,7 @@ public class HRegionServer extends HasThread implements initializeZooKeeper(); setupClusterConnection(); // Setup RPC client for master communication - this.rpcClient = RpcClientFactory.createClient(conf, clusterId, new InetSocketAddress( - this.rpcServices.isa.getAddress(), 0), clusterConnection.getConnectionMetrics()); + this.rpcClient = asyncClusterConnection.getRpcClient(); } catch (Throwable t) { // Call stop if error or process will stick around for ever since server // puts up non-daemon threads. @@ -1114,7 +1127,15 @@ public class HRegionServer extends HasThread implements LOG.warn("Attempt to close server's short circuit ClusterConnection failed.", e); } } - + if (this.asyncClusterConnection != null) { + try { + this.asyncClusterConnection.close(); + } catch (IOException e) { + // Although the {@link Closeable} interface throws an {@link + // IOException}, in reality, the implementation would never do that. + LOG.warn("Attempt to close server's AsyncClusterConnection failed.", e); + } + } // Closing the compactSplit thread before closing meta regions if (!this.killed && containsMetaTableRegions()) { if (!abortRequested || this.fsOk) { @@ -3747,9 +3768,9 @@ public class HRegionServer extends HasThread implements } @Override - public EntityLock regionLock(List<RegionInfo> regionInfos, String description, - Abortable abort) throws IOException { - return new LockServiceClient(conf, lockStub, clusterConnection.getNonceGenerator()) + public EntityLock regionLock(List<RegionInfo> regionInfos, String description, Abortable abort) + throws IOException { + return new LockServiceClient(conf, lockStub, asyncClusterConnection.getNonceGenerator()) .regionLock(regionInfos, description, abort); } @@ -3854,4 +3875,9 @@ public class HRegionServer extends HasThread implements System.exit(1); } } + + @Override + public AsyncClusterConnection getAsyncClusterConnection() { + return asyncClusterConnection; + } } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSyncUp.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSyncUp.java index c7bccb3..7d1245c 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSyncUp.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSyncUp.java @@ -29,6 +29,7 @@ import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.Server; import org.apache.hadoop.hbase.ServerName; +import org.apache.hadoop.hbase.client.AsyncClusterConnection; import org.apache.hadoop.hbase.client.ClusterConnection; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.util.FSUtils; @@ -180,5 +181,10 @@ public class ReplicationSyncUp extends Configured implements Tool { public Connection createConnection(Configuration conf) throws IOException { return null; } + + @Override + public AsyncClusterConnection getAsyncClusterConnection() { + return null; + } } } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/MockRegionServerServices.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/MockRegionServerServices.java index 0e4f241..5205960 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/MockRegionServerServices.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/MockRegionServerServices.java @@ -31,6 +31,7 @@ import java.util.concurrent.ConcurrentSkipListMap; import java.util.concurrent.atomic.AtomicBoolean; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.hbase.client.AsyncClusterConnection; import org.apache.hadoop.hbase.client.ClusterConnection; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.client.RegionInfo; @@ -368,4 +369,8 @@ public class MockRegionServerServices implements RegionServerServices { public Optional<MobFileCache> getMobFileCache() { return Optional.empty(); } + + public AsyncClusterConnection getAsyncClusterConnection() { + return null; + } } 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 eeaf99f..550a6f3 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 @@ -81,7 +81,7 @@ public class TestAsyncNonMetaRegionLocator { TEST_UTIL.getAdmin().balancerSwitch(false, true); AsyncRegistry registry = AsyncRegistryFactory.getRegistry(TEST_UTIL.getConfiguration()); CONN = new AsyncConnectionImpl(TEST_UTIL.getConfiguration(), registry, - registry.getClusterId().get(), User.getCurrent()); + registry.getClusterId().get(), null, User.getCurrent()); LOCATOR = new AsyncNonMetaRegionLocator(CONN); SPLIT_KEYS = new byte[8][]; for (int i = 111; i < 999; i += 111) { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncNonMetaRegionLocatorConcurrenyLimit.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncNonMetaRegionLocatorConcurrenyLimit.java index 8cdb4a9..7e06218 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncNonMetaRegionLocatorConcurrenyLimit.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncNonMetaRegionLocatorConcurrenyLimit.java @@ -125,7 +125,7 @@ public class TestAsyncNonMetaRegionLocatorConcurrenyLimit { TEST_UTIL.getAdmin().balancerSwitch(false, true); AsyncRegistry registry = AsyncRegistryFactory.getRegistry(TEST_UTIL.getConfiguration()); CONN = new AsyncConnectionImpl(TEST_UTIL.getConfiguration(), registry, - registry.getClusterId().get(), User.getCurrent()); + registry.getClusterId().get(), null, User.getCurrent()); LOCATOR = new AsyncNonMetaRegionLocator(CONN); SPLIT_KEYS = IntStream.range(1, 256).mapToObj(i -> Bytes.toBytes(String.format("%02x", i))) .toArray(byte[][]::new); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionLocatorTimeout.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionLocatorTimeout.java index 758aa30..0e28f96 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionLocatorTimeout.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionLocatorTimeout.java @@ -96,7 +96,7 @@ public class TestAsyncRegionLocatorTimeout { TEST_UTIL.waitTableAvailable(TABLE_NAME); AsyncRegistry registry = AsyncRegistryFactory.getRegistry(TEST_UTIL.getConfiguration()); CONN = new AsyncConnectionImpl(TEST_UTIL.getConfiguration(), registry, - registry.getClusterId().get(), User.getCurrent()); + registry.getClusterId().get(), null, User.getCurrent()); LOCATOR = CONN.getLocator(); } 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..29dcd56 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 @@ -73,7 +73,7 @@ public class TestAsyncSingleRequestRpcRetryingCaller { TEST_UTIL.waitTableAvailable(TABLE_NAME); AsyncRegistry registry = AsyncRegistryFactory.getRegistry(TEST_UTIL.getConfiguration()); CONN = new AsyncConnectionImpl(TEST_UTIL.getConfiguration(), registry, - registry.getClusterId().get(), User.getCurrent()); + registry.getClusterId().get(), null, User.getCurrent()); } @AfterClass @@ -164,7 +164,7 @@ public class TestAsyncSingleRequestRpcRetryingCaller { } }; try (AsyncConnectionImpl mockedConn = new AsyncConnectionImpl(CONN.getConfiguration(), - CONN.registry, CONN.registry.getClusterId().get(), User.getCurrent()) { + CONN.registry, CONN.registry.getClusterId().get(), null, User.getCurrent()) { @Override AsyncRegionLocator getLocator() { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableNoncedRetry.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableNoncedRetry.java index 3008561..e1e55f5 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableNoncedRetry.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableNoncedRetry.java @@ -85,7 +85,7 @@ public class TestAsyncTableNoncedRetry { TEST_UTIL.waitTableAvailable(TABLE_NAME); AsyncRegistry registry = AsyncRegistryFactory.getRegistry(TEST_UTIL.getConfiguration()); ASYNC_CONN = new AsyncConnectionImpl(TEST_UTIL.getConfiguration(), registry, - registry.getClusterId().get(), User.getCurrent()) { + registry.getClusterId().get(), null, User.getCurrent()) { @Override public NonceGenerator getNonceGenerator() { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/MockNoopMasterServices.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/MockNoopMasterServices.java index 9c55f57..3ebad66 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/MockNoopMasterServices.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/MockNoopMasterServices.java @@ -29,6 +29,7 @@ import org.apache.hadoop.hbase.CoordinatedStateManager; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.TableDescriptors; import org.apache.hadoop.hbase.TableName; +import org.apache.hadoop.hbase.client.AsyncClusterConnection; import org.apache.hadoop.hbase.client.ClusterConnection; import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor; import org.apache.hadoop.hbase.client.Connection; @@ -473,4 +474,9 @@ public class MockNoopMasterServices implements MasterServices { public SyncReplicationReplayWALManager getSyncReplicationReplayWALManager() { return null; } + + @Override + public AsyncClusterConnection getAsyncClusterConnection() { + return null; + } } \ No newline at end of file diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/MockRegionServer.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/MockRegionServer.java index a930d7f..73d53c7 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/MockRegionServer.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/MockRegionServer.java @@ -41,6 +41,7 @@ import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.TableDescriptors; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.ZooKeeperConnectionException; +import org.apache.hadoop.hbase.client.AsyncClusterConnection; import org.apache.hadoop.hbase.client.ClusterConnection; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.client.RegionInfo; @@ -721,4 +722,8 @@ class MockRegionServer implements AdminProtos.AdminService.BlockingInterface, public Optional<MobFileCache> getMobFileCache() { return Optional.empty(); } + + public AsyncClusterConnection getAsyncClusterConnection() { + return null; + } } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestActiveMasterManager.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestActiveMasterManager.java index 2300f54..77667a7 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestActiveMasterManager.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestActiveMasterManager.java @@ -31,6 +31,7 @@ import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.Server; import org.apache.hadoop.hbase.ServerName; +import org.apache.hadoop.hbase.client.AsyncClusterConnection; import org.apache.hadoop.hbase.client.ClusterConnection; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.monitoring.MonitoredTask; @@ -349,5 +350,10 @@ public class TestActiveMasterManager { public Connection createConnection(Configuration conf) throws IOException { return null; } + + @Override + public AsyncClusterConnection getAsyncClusterConnection() { + return null; + } } } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestHFileCleaner.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestHFileCleaner.java index 5c8db3e..c5fad32 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestHFileCleaner.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestHFileCleaner.java @@ -36,6 +36,7 @@ import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.Server; import org.apache.hadoop.hbase.ServerName; +import org.apache.hadoop.hbase.client.AsyncClusterConnection; import org.apache.hadoop.hbase.client.ClusterConnection; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.testclassification.MasterTests; @@ -279,6 +280,11 @@ public class TestHFileCleaner { public Connection createConnection(Configuration conf) throws IOException { return null; } + + @Override + public AsyncClusterConnection getAsyncClusterConnection() { + return null; + } } @Test diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestHFileLinkCleaner.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestHFileLinkCleaner.java index 119194b..fd11ff8 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestHFileLinkCleaner.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestHFileLinkCleaner.java @@ -34,6 +34,7 @@ import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.Server; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.TableName; +import org.apache.hadoop.hbase.client.AsyncClusterConnection; import org.apache.hadoop.hbase.client.ClusterConnection; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.io.HFileLink; @@ -213,5 +214,10 @@ public class TestHFileLinkCleaner { public Connection createConnection(Configuration conf) throws IOException { return null; } + + @Override + public AsyncClusterConnection getAsyncClusterConnection() { + return null; + } } } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestLogsCleaner.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestLogsCleaner.java index 247ed01..3286032 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestLogsCleaner.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestLogsCleaner.java @@ -45,6 +45,7 @@ import org.apache.hadoop.hbase.Server; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.Waiter; import org.apache.hadoop.hbase.ZooKeeperConnectionException; +import org.apache.hadoop.hbase.client.AsyncClusterConnection; import org.apache.hadoop.hbase.client.ClusterConnection; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.master.HMaster; @@ -409,6 +410,11 @@ public class TestLogsCleaner { public Connection createConnection(Configuration conf) throws IOException { return null; } + + @Override + public AsyncClusterConnection getAsyncClusterConnection() { + return null; + } } static class FaultyZooKeeperWatcher extends ZKWatcher { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestReplicationHFileCleaner.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestReplicationHFileCleaner.java index d162bf3..9791643 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestReplicationHFileCleaner.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestReplicationHFileCleaner.java @@ -41,6 +41,7 @@ import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.Server; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.ZooKeeperConnectionException; +import org.apache.hadoop.hbase.client.AsyncClusterConnection; import org.apache.hadoop.hbase.client.ClusterConnection; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.master.HMaster; @@ -303,6 +304,11 @@ public class TestReplicationHFileCleaner { public Connection createConnection(Configuration conf) throws IOException { return null; } + + @Override + public AsyncClusterConnection getAsyncClusterConnection() { + return null; + } } static class FaultyZooKeeperWatcher extends ZKWatcher { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHeapMemoryManager.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHeapMemoryManager.java index 8c9ce75..4a359e4 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHeapMemoryManager.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHeapMemoryManager.java @@ -36,6 +36,7 @@ import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.Server; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.Waiter; +import org.apache.hadoop.hbase.client.AsyncClusterConnection; import org.apache.hadoop.hbase.client.ClusterConnection; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.io.hfile.BlockCache; @@ -862,6 +863,11 @@ public class TestHeapMemoryManager { public Connection createConnection(Configuration conf) throws IOException { return null; } + + @Override + public AsyncClusterConnection getAsyncClusterConnection() { + return null; + } } static class CustomHeapMemoryTuner implements HeapMemoryTuner { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitLogWorker.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitLogWorker.java index 14dc619..43da846 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitLogWorker.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitLogWorker.java @@ -42,6 +42,7 @@ import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.SplitLogCounters; import org.apache.hadoop.hbase.SplitLogTask; import org.apache.hadoop.hbase.Waiter; +import org.apache.hadoop.hbase.client.AsyncClusterConnection; import org.apache.hadoop.hbase.client.ClusterConnection; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.coordination.ZkCoordinatedStateManager; @@ -160,6 +161,11 @@ public class TestSplitLogWorker { public Connection createConnection(Configuration conf) throws IOException { return null; } + + @Override + public AsyncClusterConnection getAsyncClusterConnection() { + return null; + } } private void waitForCounter(LongAdder ctr, long oldval, long newval, long timems) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestWALLockup.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestWALLockup.java index 0e20252..9e9d1d6 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestWALLockup.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestWALLockup.java @@ -36,6 +36,7 @@ import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.Server; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.TableName; +import org.apache.hadoop.hbase.client.AsyncClusterConnection; import org.apache.hadoop.hbase.client.ClusterConnection; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.client.Durability; @@ -523,6 +524,11 @@ public class TestWALLockup { public Connection createConnection(Configuration conf) throws IOException { return null; } + + @Override + public AsyncClusterConnection getAsyncClusterConnection() { + return null; + } } static class DummyWALActionsListener implements WALActionsListener { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationTrackerZKImpl.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationTrackerZKImpl.java index 863d558..62ab265 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationTrackerZKImpl.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationTrackerZKImpl.java @@ -32,6 +32,7 @@ import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.Server; import org.apache.hadoop.hbase.ServerName; +import org.apache.hadoop.hbase.client.AsyncClusterConnection; import org.apache.hadoop.hbase.client.ClusterConnection; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.testclassification.MediumTests; @@ -263,5 +264,10 @@ public class TestReplicationTrackerZKImpl { public Connection createConnection(Configuration conf) throws IOException { return null; } + + @Override + public AsyncClusterConnection getAsyncClusterConnection() { + return null; + } } } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSourceManager.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSourceManager.java index 86bbb09..427f319 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSourceManager.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSourceManager.java @@ -57,6 +57,7 @@ import org.apache.hadoop.hbase.Server; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.Waiter; +import org.apache.hadoop.hbase.client.AsyncClusterConnection; import org.apache.hadoop.hbase.client.ClusterConnection; import org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder; import org.apache.hadoop.hbase.client.Connection; @@ -906,5 +907,10 @@ public abstract class TestReplicationSourceManager { public Connection createConnection(Configuration conf) throws IOException { return null; } + + @Override + public AsyncClusterConnection getAsyncClusterConnection() { + return null; + } } } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestTokenAuthentication.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestTokenAuthentication.java index e4780f1..92c8e54 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestTokenAuthentication.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestTokenAuthentication.java @@ -44,6 +44,7 @@ import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.Server; import org.apache.hadoop.hbase.ServerName; +import org.apache.hadoop.hbase.client.AsyncClusterConnection; import org.apache.hadoop.hbase.client.ClusterConnection; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.client.ConnectionFactory; @@ -363,6 +364,11 @@ public class TestTokenAuthentication { public Connection createConnection(Configuration conf) throws IOException { return null; } + + @Override + public AsyncClusterConnection getAsyncClusterConnection() { + return null; + } } @Parameters(name = "{index}: rpcServerImpl={0}") diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MockServer.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MockServer.java index c25db01..13212d2 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MockServer.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MockServer.java @@ -26,6 +26,7 @@ import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.Server; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.ZooKeeperConnectionException; +import org.apache.hadoop.hbase.client.AsyncClusterConnection; import org.apache.hadoop.hbase.client.ClusterConnection; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.log.HBaseMarkers; @@ -143,4 +144,9 @@ public class MockServer implements Server { public Connection createConnection(Configuration conf) throws IOException { return null; } + + @Override + public AsyncClusterConnection getAsyncClusterConnection() { + return null; + } }