HBASE-12558 TestHCM.testClusterStatus Unexpected exception, expected<org.apache.hadoop.hbase.regionserver.RegionServerStoppedException> but was<junit.framework.AssertionFailedError> -- ADDED DEBUG
This commit is contained in:
parent
4b1983c89d
commit
2458be08ed
|
@ -67,6 +67,7 @@ import org.apache.hadoop.hbase.client.MetaScanner.MetaScannerVisitorBase;
|
|||
import org.apache.hadoop.hbase.client.coprocessor.Batch;
|
||||
import org.apache.hadoop.hbase.exceptions.RegionMovedException;
|
||||
import org.apache.hadoop.hbase.exceptions.RegionOpeningException;
|
||||
import org.apache.hadoop.hbase.ipc.RpcClientFactory;
|
||||
import org.apache.hadoop.hbase.ipc.RpcClient;
|
||||
import org.apache.hadoop.hbase.ipc.RpcControllerFactory;
|
||||
import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
|
||||
|
@ -619,7 +620,7 @@ class ConnectionManager {
|
|||
this.registry = setupRegistry();
|
||||
retrieveClusterId();
|
||||
|
||||
this.rpcClient = new RpcClient(this.conf, this.clusterId);
|
||||
this.rpcClient = RpcClientFactory.createClient(this.conf, this.clusterId);
|
||||
this.rpcControllerFactory = RpcControllerFactory.instantiate(conf);
|
||||
|
||||
// Do we publish the status?
|
||||
|
@ -639,7 +640,7 @@ class ConnectionManager {
|
|||
@Override
|
||||
public void newDead(ServerName sn) {
|
||||
clearCaches(sn);
|
||||
rpcClient.cancelConnections(sn.getHostname(), sn.getPort());
|
||||
rpcClient.cancelConnections(sn);
|
||||
}
|
||||
}, conf, listenerClass);
|
||||
}
|
||||
|
@ -783,18 +784,6 @@ class ConnectionManager {
|
|||
return RegistryFactory.getRegistry(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* For tests only.
|
||||
* @param rpcClient Client we should use instead.
|
||||
* @return Previous rpcClient
|
||||
*/
|
||||
@VisibleForTesting
|
||||
RpcClient setRpcClient(final RpcClient rpcClient) {
|
||||
RpcClient oldRpcClient = this.rpcClient;
|
||||
this.rpcClient = rpcClient;
|
||||
return oldRpcClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* For tests only.
|
||||
*/
|
||||
|
@ -2336,7 +2325,7 @@ class ConnectionManager {
|
|||
clusterStatusListener.close();
|
||||
}
|
||||
if (rpcClient != null) {
|
||||
rpcClient.stop();
|
||||
rpcClient.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ import org.apache.hadoop.hbase.ServerName;
|
|||
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
||||
import org.apache.hadoop.hbase.exceptions.ConnectionClosingException;
|
||||
import org.apache.hadoop.hbase.exceptions.PreemptiveFastFailException;
|
||||
import org.apache.hadoop.hbase.ipc.RpcClient.FailedServerException;
|
||||
import org.apache.hadoop.hbase.ipc.FailedServerException;
|
||||
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
|
||||
import org.apache.hadoop.ipc.RemoteException;
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ import com.google.protobuf.Message;
|
|||
* Utility to help ipc'ing.
|
||||
*/
|
||||
@InterfaceAudience.Private
|
||||
class IPCUtil {
|
||||
public class IPCUtil {
|
||||
public static final Log LOG = LogFactory.getLog(IPCUtil.class);
|
||||
/**
|
||||
* How much we think the decompressor will expand the original compressed content.
|
||||
|
@ -60,7 +60,7 @@ class IPCUtil {
|
|||
private final int cellBlockBuildingInitialBufferSize;
|
||||
private final Configuration conf;
|
||||
|
||||
IPCUtil(final Configuration conf) {
|
||||
public IPCUtil(final Configuration conf) {
|
||||
super();
|
||||
this.conf = conf;
|
||||
this.cellBlockDecompressionMultiplier =
|
||||
|
@ -81,14 +81,14 @@ class IPCUtil {
|
|||
* <code>compressor</code>.
|
||||
* @param codec
|
||||
* @param compressor
|
||||
* @Param cellScanner
|
||||
* @param cellScanner
|
||||
* @return Null or byte buffer filled with a cellblock filled with passed-in Cells encoded using
|
||||
* passed in <code>codec</code> and/or <code>compressor</code>; the returned buffer has been
|
||||
* flipped and is ready for reading. Use limit to find total size.
|
||||
* @throws IOException
|
||||
*/
|
||||
@SuppressWarnings("resource")
|
||||
ByteBuffer buildCellBlock(final Codec codec, final CompressionCodec compressor,
|
||||
public ByteBuffer buildCellBlock(final Codec codec, final CompressionCodec compressor,
|
||||
final CellScanner cellScanner)
|
||||
throws IOException {
|
||||
if (cellScanner == null) return null;
|
||||
|
@ -145,7 +145,7 @@ class IPCUtil {
|
|||
* @return CellScanner to work against the content of <code>cellBlock</code>
|
||||
* @throws IOException
|
||||
*/
|
||||
CellScanner createCellScanner(final Codec codec, final CompressionCodec compressor,
|
||||
public CellScanner createCellScanner(final Codec codec, final CompressionCodec compressor,
|
||||
final byte [] cellBlock)
|
||||
throws IOException {
|
||||
return createCellScanner(codec, compressor, cellBlock, 0, cellBlock.length);
|
||||
|
@ -159,7 +159,7 @@ class IPCUtil {
|
|||
* @return CellScanner to work against the content of <code>cellBlock</code>
|
||||
* @throws IOException
|
||||
*/
|
||||
CellScanner createCellScanner(final Codec codec, final CompressionCodec compressor,
|
||||
public CellScanner createCellScanner(final Codec codec, final CompressionCodec compressor,
|
||||
final byte [] cellBlock, final int offset, final int length)
|
||||
throws IOException {
|
||||
// If compressed, decompress it first before passing it on else we will leak compression
|
||||
|
@ -200,7 +200,7 @@ class IPCUtil {
|
|||
* @return The passed in Message serialized with delimiter. Return null if <code>m</code> is null
|
||||
* @throws IOException
|
||||
*/
|
||||
static ByteBuffer getDelimitedMessageAsByteBuffer(final Message m) throws IOException {
|
||||
public static ByteBuffer getDelimitedMessageAsByteBuffer(final Message m) throws IOException {
|
||||
if (m == null) return null;
|
||||
int serializedSize = m.getSerializedSize();
|
||||
int vintSize = CodedOutputStream.computeRawVarint32Size(serializedSize);
|
||||
|
@ -223,7 +223,7 @@ class IPCUtil {
|
|||
* @return Total number of bytes written.
|
||||
* @throws IOException
|
||||
*/
|
||||
static int write(final OutputStream dos, final Message header, final Message param,
|
||||
public static int write(final OutputStream dos, final Message header, final Message param,
|
||||
final ByteBuffer cellBlock)
|
||||
throws IOException {
|
||||
// Must calculate total size and write that first so other side can read it all in in one
|
||||
|
@ -255,7 +255,7 @@ class IPCUtil {
|
|||
* @param len
|
||||
* @throws IOException
|
||||
*/
|
||||
static void readChunked(final DataInput in, byte[] dest, int offset, int len)
|
||||
public static void readChunked(final DataInput in, byte[] dest, int offset, int len)
|
||||
throws IOException {
|
||||
int maxRead = 8192;
|
||||
|
||||
|
@ -265,11 +265,9 @@ class IPCUtil {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param header
|
||||
* @param body
|
||||
* @return Size on the wire when the two messages are written with writeDelimitedTo
|
||||
*/
|
||||
static int getTotalSizeWhenWrittenDelimited(Message ... messages) {
|
||||
public static int getTotalSizeWhenWrittenDelimited(Message ... messages) {
|
||||
int totalSize = 0;
|
||||
for (Message m: messages) {
|
||||
if (m == null) continue;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -39,7 +39,7 @@ import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
|||
import org.apache.hadoop.hbase.client.HConnection;
|
||||
import org.apache.hadoop.hbase.client.RetriesExhaustedException;
|
||||
import org.apache.hadoop.hbase.exceptions.DeserializationException;
|
||||
import org.apache.hadoop.hbase.ipc.RpcClient;
|
||||
import org.apache.hadoop.hbase.ipc.FailedServerException;
|
||||
import org.apache.hadoop.hbase.ipc.ServerNotRunningYetException;
|
||||
import org.apache.hadoop.hbase.master.RegionState;
|
||||
import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
|
||||
|
@ -316,7 +316,7 @@ public class MetaTableLocator {
|
|||
LOG.debug("Exception connecting to " + sn);
|
||||
} catch (UnknownHostException e) {
|
||||
LOG.debug("Unknown host exception connecting to " + sn);
|
||||
} catch (RpcClient.FailedServerException e) {
|
||||
} catch (FailedServerException e) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Server " + sn + " is in failed server list.");
|
||||
}
|
||||
|
|
|
@ -148,7 +148,7 @@ import com.google.protobuf.TextFormat;
|
|||
* CallRunner#run executes the call. When done, asks the included Call to put itself on new
|
||||
* queue for Responder to pull from and return result to client.
|
||||
*
|
||||
* @see RpcClient
|
||||
* @see RpcClientImpl
|
||||
*/
|
||||
@InterfaceAudience.LimitedPrivate({HBaseInterfaceAudience.COPROC, HBaseInterfaceAudience.PHOENIX})
|
||||
@InterfaceStability.Evolving
|
||||
|
|
|
@ -64,8 +64,8 @@ import org.apache.hadoop.hbase.client.TableState;
|
|||
import org.apache.hadoop.hbase.executor.EventHandler;
|
||||
import org.apache.hadoop.hbase.executor.EventType;
|
||||
import org.apache.hadoop.hbase.executor.ExecutorService;
|
||||
import org.apache.hadoop.hbase.ipc.FailedServerException;
|
||||
import org.apache.hadoop.hbase.ipc.RpcClient;
|
||||
import org.apache.hadoop.hbase.ipc.RpcClient.FailedServerException;
|
||||
import org.apache.hadoop.hbase.ipc.ServerNotRunningYetException;
|
||||
import org.apache.hadoop.hbase.master.RegionState.State;
|
||||
import org.apache.hadoop.hbase.master.balancer.FavoredNodeAssignmentHelper;
|
||||
|
|
|
@ -78,7 +78,6 @@ import org.apache.hadoop.hbase.client.ConnectionFactory;
|
|||
import org.apache.hadoop.hbase.client.ConnectionUtils;
|
||||
import org.apache.hadoop.hbase.conf.ConfigurationManager;
|
||||
import org.apache.hadoop.hbase.client.ClusterConnection;
|
||||
import org.apache.hadoop.hbase.client.ConnectionFactory;
|
||||
import org.apache.hadoop.hbase.coordination.BaseCoordinatedStateManager;
|
||||
import org.apache.hadoop.hbase.coordination.SplitLogWorkerCoordination;
|
||||
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
|
||||
|
@ -91,6 +90,7 @@ import org.apache.hadoop.hbase.fs.HFileSystem;
|
|||
import org.apache.hadoop.hbase.http.InfoServer;
|
||||
import org.apache.hadoop.hbase.io.hfile.CacheConfig;
|
||||
import org.apache.hadoop.hbase.ipc.RpcClient;
|
||||
import org.apache.hadoop.hbase.ipc.RpcClientFactory;
|
||||
import org.apache.hadoop.hbase.ipc.RpcServerInterface;
|
||||
import org.apache.hadoop.hbase.ipc.ServerNotRunningYetException;
|
||||
import org.apache.hadoop.hbase.ipc.ServerRpcController;
|
||||
|
@ -782,10 +782,11 @@ public class HRegionServer extends HasThread implements
|
|||
rsQuotaManager = new RegionServerQuotaManager(this);
|
||||
|
||||
// Setup RPC client for master communication
|
||||
rpcClient = new RpcClient(conf, clusterId, new InetSocketAddress(
|
||||
rpcClient = RpcClientFactory.createClient(conf, clusterId, new InetSocketAddress(
|
||||
rpcServices.isa.getAddress(), 0));
|
||||
|
||||
int storefileRefreshPeriod = conf.getInt(StorefileRefresherChore.REGIONSERVER_STOREFILE_REFRESH_PERIOD
|
||||
int storefileRefreshPeriod = conf.getInt(
|
||||
StorefileRefresherChore.REGIONSERVER_STOREFILE_REFRESH_PERIOD
|
||||
, StorefileRefresherChore.DEFAULT_REGIONSERVER_STOREFILE_REFRESH_PERIOD);
|
||||
if (storefileRefreshPeriod > 0) {
|
||||
this.storefileRefresher = new StorefileRefresherChore(storefileRefreshPeriod, this, this);
|
||||
|
@ -994,7 +995,7 @@ public class HRegionServer extends HasThread implements
|
|||
this.rssStub = null;
|
||||
}
|
||||
if (this.rpcClient != null) {
|
||||
this.rpcClient.stop();
|
||||
this.rpcClient.close();
|
||||
}
|
||||
if (this.leases != null) {
|
||||
this.leases.close();
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.apache.hadoop.hbase.HConstants;
|
|||
import org.apache.hadoop.hbase.MiniHBaseCluster.MiniHBaseClusterRegionServer;
|
||||
import org.apache.hadoop.hbase.TableName;
|
||||
import org.apache.hadoop.hbase.CoordinatedStateManager;
|
||||
import org.apache.hadoop.hbase.ipc.RpcClient;
|
||||
import org.apache.hadoop.hbase.ipc.AbstractRpcClient;
|
||||
import org.apache.hadoop.hbase.ipc.RpcServer;
|
||||
import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest;
|
||||
import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanResponse;
|
||||
|
@ -65,7 +65,7 @@ public class TestClientScannerRPCTimeout {
|
|||
@BeforeClass
|
||||
public static void setUpBeforeClass() throws Exception {
|
||||
((Log4JLogger)RpcServer.LOG).getLogger().setLevel(Level.ALL);
|
||||
((Log4JLogger)RpcClient.LOG).getLogger().setLevel(Level.ALL);
|
||||
((Log4JLogger)AbstractRpcClient.LOG).getLogger().setLevel(Level.ALL);
|
||||
((Log4JLogger)ScannerCallable.LOG).getLogger().setLevel(Level.ALL);
|
||||
Configuration conf = TEST_UTIL.getConfiguration();
|
||||
// Don't report so often so easier to see other rpcs
|
||||
|
|
|
@ -22,6 +22,7 @@ package org.apache.hadoop.hbase.client;
|
|||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.net.SocketAddress;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
@ -35,6 +36,8 @@ import org.apache.hadoop.hbase.HConstants;
|
|||
import org.apache.hadoop.hbase.MasterNotRunningException;
|
||||
import org.apache.hadoop.hbase.ServerName;
|
||||
import org.apache.hadoop.hbase.ipc.RpcClient;
|
||||
import org.apache.hadoop.hbase.ipc.RpcClientFactory;
|
||||
import org.apache.hadoop.hbase.ipc.RpcClientImpl;
|
||||
import org.apache.hadoop.hbase.security.User;
|
||||
import org.apache.hadoop.hbase.testclassification.ClientTests;
|
||||
import org.apache.hadoop.hbase.testclassification.MediumTests;
|
||||
|
@ -61,6 +64,10 @@ public class TestClientTimeouts {
|
|||
@BeforeClass
|
||||
public static void setUpBeforeClass() throws Exception {
|
||||
TEST_UTIL.startMiniCluster(SLAVES);
|
||||
// Set the custom RPC client with random timeouts as the client
|
||||
TEST_UTIL.getConfiguration().set(
|
||||
RpcClientFactory.CUSTOM_RPC_CLIENT_IMPL_CONF_KEY,
|
||||
RandomTimeoutRpcClient.class.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -81,7 +88,9 @@ public class TestClientTimeouts {
|
|||
Connection lastConnection = null;
|
||||
boolean lastFailed = false;
|
||||
int initialInvocations = RandomTimeoutBlockingRpcChannel.invokations.get();
|
||||
RpcClient rpcClient = newRandomTimeoutRpcClient();
|
||||
RandomTimeoutRpcClient rpcClient = (RandomTimeoutRpcClient) RpcClientFactory
|
||||
.createClient(TEST_UTIL.getConfiguration(), TEST_UTIL.getClusterKey());
|
||||
|
||||
try {
|
||||
for (int i = 0; i < 5 || (lastFailed && i < 100); ++i) {
|
||||
lastFailed = false;
|
||||
|
@ -94,13 +103,6 @@ public class TestClientTimeouts {
|
|||
Connection connection = admin.getConnection();
|
||||
assertFalse(connection == lastConnection);
|
||||
lastConnection = connection;
|
||||
// Override the connection's rpc client for timeout testing
|
||||
RpcClient oldRpcClient =
|
||||
((ConnectionManager.HConnectionImplementation)connection).setRpcClient(
|
||||
rpcClient);
|
||||
if (oldRpcClient != null) {
|
||||
oldRpcClient.stop();
|
||||
}
|
||||
// run some admin commands
|
||||
HBaseAdmin.checkHBaseAvailable(conf);
|
||||
admin.setBalancerRunning(false, false);
|
||||
|
@ -111,7 +113,8 @@ public class TestClientTimeouts {
|
|||
} finally {
|
||||
admin.close();
|
||||
if (admin.getConnection().isClosed()) {
|
||||
rpcClient = newRandomTimeoutRpcClient();
|
||||
rpcClient = (RandomTimeoutRpcClient) RpcClientFactory
|
||||
.createClient(TEST_UTIL.getConfiguration(), TEST_UTIL.getClusterKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -119,31 +122,36 @@ public class TestClientTimeouts {
|
|||
assertFalse(lastFailed);
|
||||
assertTrue(RandomTimeoutBlockingRpcChannel.invokations.get() > initialInvocations);
|
||||
} finally {
|
||||
rpcClient.stop();
|
||||
rpcClient.close();
|
||||
}
|
||||
}
|
||||
|
||||
private static RpcClient newRandomTimeoutRpcClient() {
|
||||
return new RpcClient(
|
||||
TEST_UTIL.getConfiguration(), TEST_UTIL.getClusterKey()) {
|
||||
/**
|
||||
* Rpc Channel implementation with RandomTimeoutBlockingRpcChannel
|
||||
*/
|
||||
public static class RandomTimeoutRpcClient extends RpcClientImpl{
|
||||
public RandomTimeoutRpcClient(Configuration conf, String clusterId, SocketAddress localAddr) {
|
||||
super(conf, clusterId, localAddr);
|
||||
}
|
||||
|
||||
// Return my own instance, one that does random timeouts
|
||||
@Override
|
||||
public BlockingRpcChannel createBlockingRpcChannel(ServerName sn,
|
||||
User ticket, int rpcTimeout) {
|
||||
return new RandomTimeoutBlockingRpcChannel(this, sn, ticket, rpcTimeout);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Blocking rpc channel that goes via hbase rpc.
|
||||
*/
|
||||
static class RandomTimeoutBlockingRpcChannel extends RpcClient.BlockingRpcChannelImplementation {
|
||||
static class RandomTimeoutBlockingRpcChannel
|
||||
extends RpcClientImpl.BlockingRpcChannelImplementation {
|
||||
private static final Random RANDOM = new Random(System.currentTimeMillis());
|
||||
public static final double CHANCE_OF_TIMEOUT = 0.3;
|
||||
private static AtomicInteger invokations = new AtomicInteger();
|
||||
|
||||
RandomTimeoutBlockingRpcChannel(final RpcClient rpcClient, final ServerName sn,
|
||||
RandomTimeoutBlockingRpcChannel(final RpcClientImpl rpcClient, final ServerName sn,
|
||||
final User ticket, final int rpcTimeout) {
|
||||
super(rpcClient, sn, ticket, rpcTimeout);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.hadoop.conf.Configuration;
|
|||
import org.apache.hadoop.hbase.Cell;
|
||||
import org.apache.hadoop.hbase.CellScanner;
|
||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||
import org.apache.hadoop.hbase.ipc.RpcClient;
|
||||
import org.apache.hadoop.hbase.ipc.AbstractRpcClient;
|
||||
import org.apache.hadoop.hbase.testclassification.ClientTests;
|
||||
import org.apache.hadoop.hbase.testclassification.MediumTests;
|
||||
import org.apache.hadoop.hbase.util.Bytes;
|
||||
|
@ -97,7 +97,7 @@ public class TestFromClientSideNoCodec {
|
|||
public void testNoCodec() {
|
||||
Configuration c = new Configuration();
|
||||
c.set("hbase.client.default.rpc.codec", "");
|
||||
String codec = RpcClient.getDefaultCodec(c);
|
||||
String codec = AbstractRpcClient.getDefaultCodec(c);
|
||||
assertTrue(codec == null || codec.length() == 0);
|
||||
}
|
||||
}
|
|
@ -394,7 +394,7 @@ public class TestHCM {
|
|||
|
||||
LOG.info("Going to cancel connections. connection=" + conn.toString() + ", sn=" + sn);
|
||||
for (int i = 0; i < 5000; i++) {
|
||||
rpcClient.cancelConnections(sn.getHostname(), sn.getPort());
|
||||
rpcClient.cancelConnections(sn);
|
||||
Thread.sleep(5);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ import org.apache.hadoop.hbase.client.HBaseAdmin;
|
|||
import org.apache.hadoop.hbase.client.HTable;
|
||||
import org.apache.hadoop.hbase.client.ScannerCallable;
|
||||
import org.apache.hadoop.hbase.client.Table;
|
||||
import org.apache.hadoop.hbase.ipc.RpcClient;
|
||||
import org.apache.hadoop.hbase.ipc.AbstractRpcClient;
|
||||
import org.apache.hadoop.hbase.ipc.RpcServer;
|
||||
import org.apache.hadoop.hbase.testclassification.FilterTests;
|
||||
import org.apache.hadoop.hbase.testclassification.MediumTests;
|
||||
|
@ -115,7 +115,7 @@ public class FilterTestingCluster {
|
|||
@BeforeClass
|
||||
public static void setUp() throws Exception {
|
||||
((Log4JLogger)RpcServer.LOG).getLogger().setLevel(Level.ALL);
|
||||
((Log4JLogger)RpcClient.LOG).getLogger().setLevel(Level.ALL);
|
||||
((Log4JLogger)AbstractRpcClient.LOG).getLogger().setLevel(Level.ALL);
|
||||
((Log4JLogger)ScannerCallable.LOG).getLogger().setLevel(Level.ALL);
|
||||
TEST_UTIL.startMiniCluster(1);
|
||||
initialize(TEST_UTIL.getConfiguration());
|
||||
|
|
|
@ -89,7 +89,8 @@ public class TestDelayedRpc {
|
|||
conf,
|
||||
new FifoRpcScheduler(conf, 1));
|
||||
rpcServer.start();
|
||||
RpcClient rpcClient = new RpcClient(conf, HConstants.DEFAULT_CLUSTER_ID.toString());
|
||||
RpcClient rpcClient = RpcClientFactory.createClient(
|
||||
conf, HConstants.DEFAULT_CLUSTER_ID.toString());
|
||||
try {
|
||||
BlockingRpcChannel channel = rpcClient.createBlockingRpcChannel(
|
||||
ServerName.valueOf(rpcServer.getListenerAddress().getHostName(),
|
||||
|
@ -118,7 +119,7 @@ public class TestDelayedRpc {
|
|||
assertEquals(UNDELAYED, results.get(1).intValue());
|
||||
assertEquals(results.get(2).intValue(), delayReturnValue ? DELAYED : 0xDEADBEEF);
|
||||
} finally {
|
||||
rpcClient.stop();
|
||||
rpcClient.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -170,7 +171,8 @@ public class TestDelayedRpc {
|
|||
conf,
|
||||
new FifoRpcScheduler(conf, 1));
|
||||
rpcServer.start();
|
||||
RpcClient rpcClient = new RpcClient(conf, HConstants.DEFAULT_CLUSTER_ID.toString());
|
||||
RpcClient rpcClient = RpcClientFactory.createClient(
|
||||
conf, HConstants.DEFAULT_CLUSTER_ID.toString());
|
||||
try {
|
||||
BlockingRpcChannel channel = rpcClient.createBlockingRpcChannel(
|
||||
ServerName.valueOf(rpcServer.getListenerAddress().getHostName(),
|
||||
|
@ -200,7 +202,7 @@ public class TestDelayedRpc {
|
|||
|
||||
log.removeAppender(listAppender);
|
||||
} finally {
|
||||
rpcClient.stop();
|
||||
rpcClient.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -293,7 +295,8 @@ public class TestDelayedRpc {
|
|||
conf,
|
||||
new FifoRpcScheduler(conf, 1));
|
||||
rpcServer.start();
|
||||
RpcClient rpcClient = new RpcClient(conf, HConstants.DEFAULT_CLUSTER_ID.toString());
|
||||
RpcClient rpcClient = RpcClientFactory.createClient(
|
||||
conf, HConstants.DEFAULT_CLUSTER_ID.toString());
|
||||
try {
|
||||
BlockingRpcChannel channel = rpcClient.createBlockingRpcChannel(
|
||||
ServerName.valueOf(rpcServer.getListenerAddress().getHostName(),
|
||||
|
@ -323,7 +326,7 @@ public class TestDelayedRpc {
|
|||
}
|
||||
assertTrue(caughtException);
|
||||
} finally {
|
||||
rpcClient.stop();
|
||||
rpcClient.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ public class TestHBaseClient {
|
|||
public void testFailedServer(){
|
||||
ManualEnvironmentEdge ee = new ManualEnvironmentEdge();
|
||||
EnvironmentEdgeManager.injectEdge( ee );
|
||||
RpcClient.FailedServers fs = new RpcClient.FailedServers(new Configuration());
|
||||
FailedServers fs = new FailedServers(new Configuration());
|
||||
|
||||
InetSocketAddress ia = InetSocketAddress.createUnresolved("bad", 12);
|
||||
InetSocketAddress ia2 = InetSocketAddress.createUnresolved("bad", 12); // same server as ia
|
||||
|
|
|
@ -178,7 +178,7 @@ public class TestIPC {
|
|||
@Test
|
||||
public void testNoCodec() throws InterruptedException, IOException {
|
||||
Configuration conf = HBaseConfiguration.create();
|
||||
RpcClient client = new RpcClient(conf, HConstants.CLUSTER_ID_DEFAULT) {
|
||||
RpcClientImpl client = new RpcClientImpl(conf, HConstants.CLUSTER_ID_DEFAULT) {
|
||||
@Override
|
||||
Codec getCodec() {
|
||||
return null;
|
||||
|
@ -197,7 +197,7 @@ public class TestIPC {
|
|||
// Silly assertion that the message is in the returned pb.
|
||||
assertTrue(r.getFirst().toString().contains(message));
|
||||
} finally {
|
||||
client.stop();
|
||||
client.close();
|
||||
rpcServer.stop();
|
||||
}
|
||||
}
|
||||
|
@ -216,10 +216,10 @@ public class TestIPC {
|
|||
throws IOException, InterruptedException, SecurityException, NoSuchMethodException {
|
||||
Configuration conf = new Configuration(HBaseConfiguration.create());
|
||||
conf.set("hbase.client.rpc.compressor", GzipCodec.class.getCanonicalName());
|
||||
doSimpleTest(conf, new RpcClient(conf, HConstants.CLUSTER_ID_DEFAULT));
|
||||
doSimpleTest(conf, new RpcClientImpl(conf, HConstants.CLUSTER_ID_DEFAULT));
|
||||
}
|
||||
|
||||
private void doSimpleTest(final Configuration conf, final RpcClient client)
|
||||
private void doSimpleTest(final Configuration conf, final RpcClientImpl client)
|
||||
throws InterruptedException, IOException {
|
||||
TestRpcServer rpcServer = new TestRpcServer();
|
||||
List<Cell> cells = new ArrayList<Cell>();
|
||||
|
@ -239,7 +239,7 @@ public class TestIPC {
|
|||
}
|
||||
assertEquals(count, index);
|
||||
} finally {
|
||||
client.stop();
|
||||
client.close();
|
||||
rpcServer.stop();
|
||||
}
|
||||
}
|
||||
|
@ -258,7 +258,7 @@ public class TestIPC {
|
|||
}).when(spyFactory).createSocket();
|
||||
|
||||
TestRpcServer rpcServer = new TestRpcServer();
|
||||
RpcClient client = new RpcClient(conf, HConstants.CLUSTER_ID_DEFAULT, spyFactory);
|
||||
RpcClientImpl client = new RpcClientImpl(conf, HConstants.CLUSTER_ID_DEFAULT, spyFactory);
|
||||
try {
|
||||
rpcServer.start();
|
||||
InetSocketAddress address = rpcServer.getListenerAddress();
|
||||
|
@ -270,7 +270,7 @@ public class TestIPC {
|
|||
LOG.info("Caught expected exception: " + e.toString());
|
||||
assertTrue(StringUtils.stringifyException(e).contains("Injected fault"));
|
||||
} finally {
|
||||
client.stop();
|
||||
client.close();
|
||||
rpcServer.stop();
|
||||
}
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ public class TestIPC {
|
|||
RpcScheduler scheduler = spy(new FifoRpcScheduler(CONF, 1));
|
||||
RpcServer rpcServer = new TestRpcServer(scheduler);
|
||||
verify(scheduler).init((RpcScheduler.Context) anyObject());
|
||||
RpcClient client = new RpcClient(CONF, HConstants.CLUSTER_ID_DEFAULT);
|
||||
RpcClientImpl client = new RpcClientImpl(CONF, HConstants.CLUSTER_ID_DEFAULT);
|
||||
try {
|
||||
rpcServer.start();
|
||||
verify(scheduler).start();
|
||||
|
@ -312,7 +312,7 @@ public class TestIPC {
|
|||
TestRpcServer rpcServer = new TestRpcServer();
|
||||
MethodDescriptor md = SERVICE.getDescriptorForType().findMethodByName("echo");
|
||||
EchoRequestProto param = EchoRequestProto.newBuilder().setMessage("hello").build();
|
||||
RpcClient client = new RpcClient(conf, HConstants.CLUSTER_ID_DEFAULT);
|
||||
RpcClientImpl client = new RpcClientImpl(conf, HConstants.CLUSTER_ID_DEFAULT);
|
||||
KeyValue kv = KeyValueUtil.ensureKeyValue(BIG_CELL);
|
||||
Put p = new Put(kv.getRow());
|
||||
for (int i = 0; i < cellcount; i++) {
|
||||
|
@ -354,7 +354,7 @@ public class TestIPC {
|
|||
LOG.info("Cycled " + cycles + " time(s) with " + cellcount + " cell(s) in " +
|
||||
(System.currentTimeMillis() - startTime) + "ms");
|
||||
} finally {
|
||||
client.stop();
|
||||
client.close();
|
||||
rpcServer.stop();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ public class TestProtoBufRpc {
|
|||
|
||||
@Test
|
||||
public void testProtoBufRpc() throws Exception {
|
||||
RpcClient rpcClient = new RpcClient(conf, HConstants.CLUSTER_ID_DEFAULT);
|
||||
RpcClient rpcClient = RpcClientFactory.createClient(conf, HConstants.CLUSTER_ID_DEFAULT);
|
||||
try {
|
||||
BlockingRpcChannel channel = rpcClient.createBlockingRpcChannel(
|
||||
ServerName.valueOf(this.isa.getHostName(), this.isa.getPort(), System.currentTimeMillis()),
|
||||
|
@ -136,7 +136,7 @@ public class TestProtoBufRpc {
|
|||
} catch (ServiceException e) {
|
||||
}
|
||||
} finally {
|
||||
rpcClient.stop();
|
||||
rpcClient.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.apache.hadoop.hbase.*;
|
|||
import org.apache.hadoop.hbase.CoordinatedStateManager;
|
||||
import org.apache.hadoop.hbase.CoordinatedStateManagerFactory;
|
||||
import org.apache.hadoop.hbase.ipc.RpcClient;
|
||||
import org.apache.hadoop.hbase.ipc.RpcClientFactory;
|
||||
import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
|
||||
import org.apache.hadoop.hbase.protobuf.generated.MasterProtos;
|
||||
import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.IsMasterRunningRequest;
|
||||
|
@ -53,7 +54,7 @@ public class TestHMasterRPCException {
|
|||
CoordinatedStateManager cp = CoordinatedStateManagerFactory.getCoordinatedStateManager(conf);
|
||||
HMaster hm = new HMaster(conf, cp);
|
||||
ServerName sm = hm.getServerName();
|
||||
RpcClient rpcClient = new RpcClient(conf, HConstants.CLUSTER_ID_DEFAULT);
|
||||
RpcClient rpcClient = RpcClientFactory.createClient(conf, HConstants.CLUSTER_ID_DEFAULT);
|
||||
try {
|
||||
int i = 0;
|
||||
//retry the RPC a few times; we have seen SocketTimeoutExceptions if we
|
||||
|
@ -88,7 +89,7 @@ public class TestHMasterRPCException {
|
|||
}
|
||||
fail();
|
||||
} finally {
|
||||
rpcClient.stop();
|
||||
rpcClient.close();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -35,6 +35,7 @@ import org.apache.hadoop.conf.Configuration;
|
|||
import org.apache.hadoop.fs.CommonConfigurationKeys;
|
||||
import org.apache.hadoop.hbase.HConstants;
|
||||
import org.apache.hadoop.hbase.ServerName;
|
||||
import org.apache.hadoop.hbase.ipc.RpcClientFactory;
|
||||
import org.apache.hadoop.hbase.testclassification.SecurityTests;
|
||||
import org.apache.hadoop.hbase.testclassification.SmallTests;
|
||||
import org.apache.hadoop.hbase.ipc.FifoRpcScheduler;
|
||||
|
@ -99,7 +100,8 @@ public class TestSecureRPC {
|
|||
Lists.newArrayList(new RpcServer.BlockingServiceAndInterface(service, null)),
|
||||
isa, conf, new FifoRpcScheduler(conf, 1));
|
||||
rpcServer.start();
|
||||
RpcClient rpcClient = new RpcClient(conf, HConstants.DEFAULT_CLUSTER_ID.toString());
|
||||
RpcClient rpcClient = RpcClientFactory
|
||||
.createClient(conf, HConstants.DEFAULT_CLUSTER_ID.toString());
|
||||
try {
|
||||
BlockingRpcChannel channel = rpcClient.createBlockingRpcChannel(
|
||||
ServerName.valueOf(rpcServer.getListenerAddress().getHostName(),
|
||||
|
@ -115,7 +117,7 @@ public class TestSecureRPC {
|
|||
|
||||
assertEquals(0xDEADBEEF, results.get(0).intValue());
|
||||
} finally {
|
||||
rpcClient.stop();
|
||||
rpcClient.close();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -51,6 +51,7 @@ import org.apache.hadoop.hbase.ipc.BlockingRpcCallback;
|
|||
import org.apache.hadoop.hbase.ipc.FifoRpcScheduler;
|
||||
import org.apache.hadoop.hbase.ipc.RequestContext;
|
||||
import org.apache.hadoop.hbase.ipc.RpcClient;
|
||||
import org.apache.hadoop.hbase.ipc.RpcClientFactory;
|
||||
import org.apache.hadoop.hbase.ipc.RpcServer;
|
||||
import org.apache.hadoop.hbase.ipc.RpcServer.BlockingServiceAndInterface;
|
||||
import org.apache.hadoop.hbase.ipc.RpcServerInterface;
|
||||
|
@ -400,7 +401,7 @@ public class TestTokenAuthentication {
|
|||
testuser.doAs(new PrivilegedExceptionAction<Object>() {
|
||||
public Object run() throws Exception {
|
||||
Configuration c = server.getConfiguration();
|
||||
RpcClient rpcClient = new RpcClient(c, clusterId.toString());
|
||||
RpcClient rpcClient = RpcClientFactory.createClient(c, clusterId.toString());
|
||||
ServerName sn =
|
||||
ServerName.valueOf(server.getAddress().getHostName(), server.getAddress().getPort(),
|
||||
System.currentTimeMillis());
|
||||
|
@ -416,7 +417,7 @@ public class TestTokenAuthentication {
|
|||
String authMethod = response.getAuthMethod();
|
||||
assertEquals("TOKEN", authMethod);
|
||||
} finally {
|
||||
rpcClient.stop();
|
||||
rpcClient.close();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ import org.apache.hadoop.hbase.TableNotFoundException;
|
|||
import org.apache.hadoop.hbase.client.Admin;
|
||||
import org.apache.hadoop.hbase.client.HTable;
|
||||
import org.apache.hadoop.hbase.client.ScannerCallable;
|
||||
import org.apache.hadoop.hbase.ipc.RpcClient;
|
||||
import org.apache.hadoop.hbase.ipc.AbstractRpcClient;
|
||||
import org.apache.hadoop.hbase.ipc.RpcServer;
|
||||
import org.apache.hadoop.hbase.master.HMaster;
|
||||
import org.apache.hadoop.hbase.master.snapshot.SnapshotManager;
|
||||
|
@ -88,7 +88,7 @@ public class TestFlushSnapshotFromClient {
|
|||
// Uncomment the following lines if more verbosity is needed for
|
||||
// debugging (see HBASE-12285 for details).
|
||||
//((Log4JLogger)RpcServer.LOG).getLogger().setLevel(Level.ALL);
|
||||
//((Log4JLogger)RpcClient.LOG).getLogger().setLevel(Level.ALL);
|
||||
//((Log4JLogger)AbstractRpcClient.LOG).getLogger().setLevel(Level.ALL);
|
||||
//((Log4JLogger)ScannerCallable.LOG).getLogger().setLevel(Level.ALL);
|
||||
setupConf(UTIL.getConfiguration());
|
||||
UTIL.startMiniCluster(NUM_RS);
|
||||
|
|
Loading…
Reference in New Issue