Skip to content

Commit 3c52912

Browse files
committed
HBASE-21723 Remove ConnectionImplementation and related classes
1 parent dfa4f47 commit 3c52912

File tree

105 files changed

+721
-23826
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+721
-23826
lines changed

hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncConnectionConfiguration.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@
3838
import static org.apache.hadoop.hbase.HConstants.HBASE_RPC_READ_TIMEOUT_KEY;
3939
import static org.apache.hadoop.hbase.HConstants.HBASE_RPC_TIMEOUT_KEY;
4040
import static org.apache.hadoop.hbase.HConstants.HBASE_RPC_WRITE_TIMEOUT_KEY;
41-
import static org.apache.hadoop.hbase.client.AsyncProcess.DEFAULT_START_LOG_ERRORS_AFTER_COUNT;
42-
import static org.apache.hadoop.hbase.client.AsyncProcess.START_LOG_ERRORS_AFTER_COUNT_KEY;
4341
import static org.apache.hadoop.hbase.client.ConnectionConfiguration.MAX_KEYVALUE_SIZE_DEFAULT;
4442
import static org.apache.hadoop.hbase.client.ConnectionConfiguration.MAX_KEYVALUE_SIZE_KEY;
4543
import static org.apache.hadoop.hbase.client.ConnectionConfiguration.PRIMARY_CALL_TIMEOUT_MICROSECOND;
@@ -61,6 +59,16 @@
6159
@InterfaceAudience.Private
6260
class AsyncConnectionConfiguration {
6361

62+
/**
63+
* Configure the number of failures after which the client will start logging. A few failures
64+
* is fine: region moved, then is not opened, then is overloaded. We try to have an acceptable
65+
* heuristic for the number of errors we don't log. 5 was chosen because we wait for 1s at
66+
* this stage.
67+
*/
68+
public static final String START_LOG_ERRORS_AFTER_COUNT_KEY =
69+
"hbase.client.start.log.errors.counter";
70+
public static final int DEFAULT_START_LOG_ERRORS_AFTER_COUNT = 5;
71+
6472
private final long metaOperationTimeoutNs;
6573

6674
// timeout for a whole operation such as get, put or delete. Notice that scan will not be effected

hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncMetaRegionLocator.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
import org.apache.hadoop.hbase.ServerName;
3232
import org.apache.yetus.audience.InterfaceAudience;
3333

34+
import org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;
35+
3436
/**
3537
* The asynchronous locator for meta region.
3638
*/
@@ -133,4 +135,17 @@ void clearCache(ServerName serverName) {
133135
}
134136
}
135137
}
138+
139+
// only used for testing whether we have cached the location for a region.
140+
@VisibleForTesting
141+
RegionLocations getRegionLocationInCache() {
142+
return metaRegionLocations.get();
143+
}
144+
145+
// only used for testing whether we have cached the location for a table.
146+
@VisibleForTesting
147+
int getNumberOfCachedRegionLocations() {
148+
RegionLocations locs = metaRegionLocations.get();
149+
return locs != null ? locs.numNonNullElements() : 0;
150+
}
136151
}

hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncNonMetaRegionLocator.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,4 +645,14 @@ RegionLocations getRegionLocationInCache(TableName tableName, byte[] row) {
645645
}
646646
return locateRowInCache(tableCache, tableName, row, RegionReplicaUtil.DEFAULT_REPLICA_ID);
647647
}
648+
649+
// only used for testing whether we have cached the location for a table.
650+
@VisibleForTesting
651+
int getNumberOfCachedRegionLocations(TableName tableName) {
652+
TableCache tableCache = cache.get(tableName);
653+
if (tableCache == null) {
654+
return 0;
655+
}
656+
return tableCache.cache.values().stream().mapToInt(RegionLocations::numNonNullElements).sum();
657+
}
648658
}

0 commit comments

Comments
 (0)