Skip to content

Commit

Permalink
HBASE-21723 Remove ConnectionImplementation and related classes
Browse files Browse the repository at this point in the history
  • Loading branch information
Apache9 committed May 21, 2019
1 parent 0f01a02 commit 1979bcf
Show file tree
Hide file tree
Showing 105 changed files with 719 additions and 23,815 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
import static org.apache.hadoop.hbase.HConstants.HBASE_RPC_READ_TIMEOUT_KEY;
import static org.apache.hadoop.hbase.HConstants.HBASE_RPC_TIMEOUT_KEY;
import static org.apache.hadoop.hbase.HConstants.HBASE_RPC_WRITE_TIMEOUT_KEY;
import static org.apache.hadoop.hbase.client.AsyncProcess.DEFAULT_START_LOG_ERRORS_AFTER_COUNT;
import static org.apache.hadoop.hbase.client.AsyncProcess.START_LOG_ERRORS_AFTER_COUNT_KEY;
import static org.apache.hadoop.hbase.client.ConnectionConfiguration.MAX_KEYVALUE_SIZE_DEFAULT;
import static org.apache.hadoop.hbase.client.ConnectionConfiguration.MAX_KEYVALUE_SIZE_KEY;
import static org.apache.hadoop.hbase.client.ConnectionConfiguration.PRIMARY_CALL_TIMEOUT_MICROSECOND;
Expand All @@ -66,6 +64,16 @@ class AsyncConnectionConfiguration {

private static final Logger LOG = LoggerFactory.getLogger(AsyncConnectionConfiguration.class);

/**
* Configure the number of failures after which the client will start logging. A few failures
* is fine: region moved, then is not opened, then is overloaded. We try to have an acceptable
* heuristic for the number of errors we don't log. 5 was chosen because we wait for 1s at
* this stage.
*/
public static final String START_LOG_ERRORS_AFTER_COUNT_KEY =
"hbase.client.start.log.errors.counter";
public static final int DEFAULT_START_LOG_ERRORS_AFTER_COUNT = 5;

private final long metaOperationTimeoutNs;

// timeout for a whole operation such as get, put or delete. Notice that scan will not be effected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import org.apache.hadoop.hbase.ServerName;
import org.apache.yetus.audience.InterfaceAudience;

import org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;

/**
* The asynchronous locator for meta region.
*/
Expand Down Expand Up @@ -133,4 +135,17 @@ void clearCache(ServerName serverName) {
}
}
}

// only used for testing whether we have cached the location for a region.
@VisibleForTesting
RegionLocations getRegionLocationInCache() {
return metaRegionLocations.get();
}

// only used for testing whether we have cached the location for a table.
@VisibleForTesting
int getNumberOfCachedRegionLocations() {
RegionLocations locs = metaRegionLocations.get();
return locs != null ? locs.numNonNullElements() : 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -654,4 +654,14 @@ RegionLocations getRegionLocationInCache(TableName tableName, byte[] row) {
}
return locateRowInCache(tableCache, tableName, row, RegionReplicaUtil.DEFAULT_REPLICA_ID);
}

// only used for testing whether we have cached the location for a table.
@VisibleForTesting
int getNumberOfCachedRegionLocations(TableName tableName) {
TableCache tableCache = cache.get(tableName);
if (tableCache == null) {
return 0;
}
return tableCache.cache.values().stream().mapToInt(RegionLocations::numNonNullElements).sum();
}
}
Loading

0 comments on commit 1979bcf

Please sign in to comment.