Amend HBASE-5162 Basic client pushback mechanism (Jesse Yates)

Applied hbase-5162-trunk-addendum.patch
This commit is contained in:
Andrew Purtell 2014-12-16 22:15:44 -08:00
parent 6a042c381a
commit 99a11390b4
3 changed files with 13 additions and 10 deletions

View File

@ -90,11 +90,14 @@ public class RpcRetryingCallerFactory {
String clazzName = RpcRetryingCallerFactory.class.getName(); String clazzName = RpcRetryingCallerFactory.class.getName();
String rpcCallerFactoryClazz = String rpcCallerFactoryClazz =
configuration.get(RpcRetryingCallerFactory.CUSTOM_CALLER_CONF_KEY, clazzName); configuration.get(RpcRetryingCallerFactory.CUSTOM_CALLER_CONF_KEY, clazzName);
RpcRetryingCallerFactory factory;
if (rpcCallerFactoryClazz.equals(clazzName)) { if (rpcCallerFactoryClazz.equals(clazzName)) {
return new RpcRetryingCallerFactory(configuration, interceptor); factory = new RpcRetryingCallerFactory(configuration, interceptor);
} else {
factory = ReflectionUtils.instantiateWithCustomCtor(
rpcCallerFactoryClazz, new Class[] { Configuration.class },
new Object[] { configuration });
} }
RpcRetryingCallerFactory factory = ReflectionUtils.instantiateWithCustomCtor(
rpcCallerFactoryClazz, new Class[] { Configuration.class }, new Object[] { configuration });
// setting for backwards compat with existing caller factories, rather than in the ctor // setting for backwards compat with existing caller factories, rather than in the ctor
factory.setStatisticTracker(stats); factory.setStatisticTracker(stats);

View File

@ -64,7 +64,7 @@ public class StatsTrackingRpcRetryingCaller<T> implements RpcRetryingCaller<T> {
// mutli-server callables span multiple regions, so they don't have a location, // mutli-server callables span multiple regions, so they don't have a location,
// but they are region server callables, so we have to handle them when we process the // but they are region server callables, so we have to handle them when we process the
// result, not in here // result in AsyncProcess#receiveMultiAction, not in here
if (callable instanceof MultiServerCallable) { if (callable instanceof MultiServerCallable) {
return result; return result;
} }

View File

@ -50,8 +50,7 @@ public class TestClientPushback {
conf.setBoolean(HConstants.ENABLE_CLIENT_BACKPRESSURE, true); conf.setBoolean(HConstants.ENABLE_CLIENT_BACKPRESSURE, true);
// turn the memstore size way down so we don't need to write a lot to see changes in memstore // turn the memstore size way down so we don't need to write a lot to see changes in memstore
// load // load
conf.setLong(HConstants.HREGION_MEMSTORE_FLUSH_SIZE, conf.setLong(HConstants.HREGION_MEMSTORE_FLUSH_SIZE, flushSizeBytes);
flushSizeBytes);
// ensure we block the flushes when we are double that flushsize // ensure we block the flushes when we are double that flushsize
conf.setLong("hbase.hregion.memstore.block.multiplier", 2); conf.setLong("hbase.hregion.memstore.block.multiplier", 2);
@ -65,10 +64,11 @@ public class TestClientPushback {
} }
@Test @Test
public void testClientTrackesServerPushback() throws Exception{ public void testClientTracksServerPushback() throws Exception{
Configuration conf = UTIL.getConfiguration(); Configuration conf = UTIL.getConfiguration();
TableName tablename = TableName.valueOf(tableName); TableName tablename = TableName.valueOf(tableName);
HTable table = new HTable(conf, tablename); Connection conn = ConnectionFactory.createConnection(conf);
HTable table = (HTable) conn.getTable(tablename);
//make sure we flush after each put //make sure we flush after each put
table.setAutoFlushTo(true); table.setAutoFlushTo(true);
@ -78,8 +78,8 @@ public class TestClientPushback {
table.put(p); table.put(p);
// get the stats for the region hosting our table // get the stats for the region hosting our table
ClusterConnection conn = ConnectionManager.getConnectionInternal(conf); ClusterConnection connection = table.connection;
ServerStatisticTracker stats = conn.getStatisticsTracker(); ServerStatisticTracker stats = connection.getStatisticsTracker();
assertNotNull( "No stats configured for the client!", stats); assertNotNull( "No stats configured for the client!", stats);
// get the names so we can query the stats // get the names so we can query the stats
ServerName server = UTIL.getHBaseCluster().getRegionServer(0).getServerName(); ServerName server = UTIL.getHBaseCluster().getRegionServer(0).getServerName();