HBASE-19359 Revisit the default config of hbase client retries number

This commit is contained in:
Guanghao Zhang 2017-11-28 21:08:19 +08:00 committed by Michael Stack
parent 22b90c4a64
commit 9e7ab9ffe2
No known key found for this signature in database
GPG Key ID: 9816C7FC8ACC93D2
9 changed files with 18 additions and 10 deletions

View File

@ -2628,4 +2628,4 @@ public interface Admin extends Abortable, Closeable {
* @return List of servers that are not cleared * @return List of servers that are not cleared
*/ */
List<ServerName> clearDeadServers(final List<ServerName> servers) throws IOException; List<ServerName> clearDeadServers(final List<ServerName> servers) throws IOException;
} }

View File

@ -116,7 +116,8 @@ public final class ConnectionUtils {
HConstants.DEFAULT_HBASE_CLIENT_RETRIES_NUMBER); HConstants.DEFAULT_HBASE_CLIENT_RETRIES_NUMBER);
// Go big. Multiply by 10. If we can't get to meta after this many retries // Go big. Multiply by 10. If we can't get to meta after this many retries
// then something seriously wrong. // then something seriously wrong.
int serversideMultiplier = c.getInt("hbase.client.serverside.retries.multiplier", 10); int serversideMultiplier = c.getInt(HConstants.HBASE_CLIENT_SERVERSIDE_RETRIES_MULTIPLIER,
HConstants.DEFAULT_HBASE_CLIENT_SERVERSIDE_RETRIES_MULTIPLIER);
int retries = hcRetries * serversideMultiplier; int retries = hcRetries * serversideMultiplier;
c.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, retries); c.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, retries);
log.info(sn + " server-side Connection retries=" + retries); log.info(sn + " server-side Connection retries=" + retries);

View File

@ -790,7 +790,12 @@ public final class HConstants {
/** /**
* Default value of {@link #HBASE_CLIENT_RETRIES_NUMBER}. * Default value of {@link #HBASE_CLIENT_RETRIES_NUMBER}.
*/ */
public static final int DEFAULT_HBASE_CLIENT_RETRIES_NUMBER = 35; public static final int DEFAULT_HBASE_CLIENT_RETRIES_NUMBER = 10;
public static final String HBASE_CLIENT_SERVERSIDE_RETRIES_MULTIPLIER =
"hbase.client.serverside.retries.multiplier";
public static final int DEFAULT_HBASE_CLIENT_SERVERSIDE_RETRIES_MULTIPLIER = 3;
/** /**
* Parameter name to set the default scanner caching for all clients. * Parameter name to set the default scanner caching for all clients.

View File

@ -488,7 +488,7 @@ possible configurations would overwhelm and obscure the important.
</property> </property>
<property> <property>
<name>hbase.client.retries.number</name> <name>hbase.client.retries.number</name>
<value>35</value> <value>10</value>
<description>Maximum retries. Used as maximum for all retryable <description>Maximum retries. Used as maximum for all retryable
operations such as the getting of a cell's value, starting a row update, operations such as the getting of a cell's value, starting a row update,
etc. Retry interval is a rough function based on hbase.client.pause. At etc. Retry interval is a rough function based on hbase.client.pause. At

View File

@ -3533,4 +3533,4 @@ public class HMaster extends HRegionServer implements MasterServices {
public SpaceQuotaSnapshotNotifier getSpaceQuotaSnapshotNotifier() { public SpaceQuotaSnapshotNotifier getSpaceQuotaSnapshotNotifier() {
return this.spaceQuotaSnapshotNotifier; return this.spaceQuotaSnapshotNotifier;
} }
} }

View File

@ -1957,7 +1957,7 @@ public class HRegionServer extends HasThread implements
conf.getInt("hbase.log.replay.retries.number", 8)); // 8 retries take about 23 seconds conf.getInt("hbase.log.replay.retries.number", 8)); // 8 retries take about 23 seconds
sinkConf.setInt(HConstants.HBASE_RPC_TIMEOUT_KEY, sinkConf.setInt(HConstants.HBASE_RPC_TIMEOUT_KEY,
conf.getInt("hbase.log.replay.rpc.timeout", 30000)); // default 30 seconds conf.getInt("hbase.log.replay.rpc.timeout", 30000)); // default 30 seconds
sinkConf.setInt("hbase.client.serverside.retries.multiplier", 1); sinkConf.setInt(HConstants.HBASE_CLIENT_SERVERSIDE_RETRIES_MULTIPLIER, 1);
if (this.csm != null) { if (this.csm != null) {
// SplitLogWorker needs csm. If none, don't start this. // SplitLogWorker needs csm. If none, don't start this.
this.splitLogWorker = new SplitLogWorker(this, sinkConf, this, this.splitLogWorker = new SplitLogWorker(this, sinkConf, this,

View File

@ -96,7 +96,8 @@ public class RegionReplicaFlushHandler extends EventHandler {
int numRetries = conf.getInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, int numRetries = conf.getInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER,
HConstants.DEFAULT_HBASE_CLIENT_RETRIES_NUMBER); HConstants.DEFAULT_HBASE_CLIENT_RETRIES_NUMBER);
if (numRetries > 10) { if (numRetries > 10) {
int mult = conf.getInt("hbase.client.serverside.retries.multiplier", 10); int mult = conf.getInt(HConstants.HBASE_CLIENT_SERVERSIDE_RETRIES_MULTIPLIER,
HConstants.DEFAULT_HBASE_CLIENT_SERVERSIDE_RETRIES_MULTIPLIER);
numRetries = numRetries / mult; // reset if HRS has multiplied this already numRetries = numRetries / mult; // reset if HRS has multiplied this already
} }
return numRetries; return numRetries;

View File

@ -119,11 +119,12 @@ public class RegionReplicaReplicationEndpoint extends HBaseReplicationEndpoint {
int defaultNumRetries = conf.getInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, int defaultNumRetries = conf.getInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER,
HConstants.DEFAULT_HBASE_CLIENT_RETRIES_NUMBER); HConstants.DEFAULT_HBASE_CLIENT_RETRIES_NUMBER);
if (defaultNumRetries > 10) { if (defaultNumRetries > 10) {
int mult = conf.getInt("hbase.client.serverside.retries.multiplier", 10); int mult = conf.getInt(HConstants.HBASE_CLIENT_SERVERSIDE_RETRIES_MULTIPLIER,
HConstants.DEFAULT_HBASE_CLIENT_SERVERSIDE_RETRIES_MULTIPLIER);
defaultNumRetries = defaultNumRetries / mult; // reset if HRS has multiplied this already defaultNumRetries = defaultNumRetries / mult; // reset if HRS has multiplied this already
} }
conf.setInt("hbase.client.serverside.retries.multiplier", 1); conf.setInt(HConstants.HBASE_CLIENT_SERVERSIDE_RETRIES_MULTIPLIER, 1);
int numRetries = conf.getInt(CLIENT_RETRIES_NUMBER, defaultNumRetries); int numRetries = conf.getInt(CLIENT_RETRIES_NUMBER, defaultNumRetries);
conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, numRetries); conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, numRetries);

View File

@ -101,7 +101,7 @@ public class TestRegionReplicaReplicationEndpoint {
conf.setInt("replication.stats.thread.period.seconds", 5); conf.setInt("replication.stats.thread.period.seconds", 5);
conf.setBoolean("hbase.tests.use.shortcircuit.reads", false); conf.setBoolean("hbase.tests.use.shortcircuit.reads", false);
conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 5); // less number of retries is needed conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 5); // less number of retries is needed
conf.setInt("hbase.client.serverside.retries.multiplier", 1); conf.setInt(HConstants.HBASE_CLIENT_SERVERSIDE_RETRIES_MULTIPLIER, 1);
HTU.startMiniCluster(NB_SERVERS); HTU.startMiniCluster(NB_SERVERS);
} }