bharathv commented on a change in pull request #954: HBASE-23305: Master based
registry implementation
URL: https://github.com/apache/hbase/pull/954#discussion_r362718390
##########
File path:
hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/AbstractTestIPC.java
##########
@@ -363,6 +365,101 @@ public void testAsyncEcho() throws IOException {
}
}
+ /**
+ * Tests the happy path for various request fan out values using a simple
RPC hedged across
+ * a mix of running and failing servers.
+ */
+ @Test
+ public void testHedgedAsyncEcho() throws Exception {
+ List<RpcServer> rpcServers = new ArrayList<>();
+ List<InetSocketAddress> addresses = new ArrayList<>();
+ // Create a mix of running and failing servers.
+ final int numRunningServers = 5;
+ final int numFailingServers = 3;
+ final int numServers = numRunningServers + numFailingServers;
+ for (int i = 0; i < numRunningServers; i++) {
+ RpcServer rpcServer = createRpcServer(null, "testRpcServer" + i,
+ Lists.newArrayList(new RpcServer.BlockingServiceAndInterface(
+ SERVICE, null)), new InetSocketAddress("localhost", 0), CONF,
+ new FifoRpcScheduler(CONF, 1));
+ rpcServer.start();
+ addresses.add(rpcServer.getListenerAddress());
+ rpcServers.add(rpcServer);
+ }
+ for (int i = 0; i < numFailingServers; i++) {
+ RpcServer rpcServer = createTestFailingRpcServer(null,
"testFailingRpcServer" + i,
+ Lists.newArrayList(new RpcServer.BlockingServiceAndInterface(
+ SERVICE, null)), new InetSocketAddress("localhost", 0), CONF,
+ new FifoRpcScheduler(CONF, 1));
+ rpcServer.start();
+ addresses.add(rpcServer.getListenerAddress());
+ rpcServers.add(rpcServer);
+ }
+ Configuration conf = HBaseConfiguration.create();
+ try (AbstractRpcClient<?> client = createRpcClient(conf)) {
+ // Try out various fan out values starting from 1 -> numServers.
+ for (int reqFanOut = 1; reqFanOut <= numServers; reqFanOut++) {
+ // Update the client's underlying conf, should be ok for the test.
+ LOG.debug("Testing with request fan out: " + reqFanOut);
+ conf.setInt(HConstants.HBASE_RPCS_HEDGED_REQS_FANOUT_KEY, reqFanOut);
+ Interface stub = newStub(client, addresses);
+ BlockingRpcCallback<EchoResponseProto> done = new
BlockingRpcCallback<>();
+ stub.echo(new HBaseRpcControllerImpl(),
+ EchoRequestProto.newBuilder().setMessage("hello").build(), done);
+ TestProtos.EchoResponseProto responseProto = done.get();
+ assertNotNull(responseProto);
+ assertEquals("hello", responseProto.getMessage());
+ LOG.debug("Ended test with request fan out: " + reqFanOut);
+ }
+ } finally {
+ for (RpcServer rpcServer: rpcServers) {
+ rpcServer.stop();
+ }
+ }
+ }
+
+ @Test
+ public void testHedgedAsyncTimeouts() throws Exception {
+ List<RpcServer> rpcServers = new ArrayList<>();
+ List<InetSocketAddress> addresses = new ArrayList<>();
+ // Create a mix of running and failing servers.
Review comment:
done.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services