Skip to content

Commit d89d032

Browse files
committed
HBASE-21723 Remove ConnectionImplementation and related classes
1 parent 50d1a70 commit d89d032

File tree

105 files changed

+719
-23815
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

+719
-23815
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
@@ -39,8 +39,6 @@
3939
import static org.apache.hadoop.hbase.HConstants.HBASE_RPC_READ_TIMEOUT_KEY;
4040
import static org.apache.hadoop.hbase.HConstants.HBASE_RPC_TIMEOUT_KEY;
4141
import static org.apache.hadoop.hbase.HConstants.HBASE_RPC_WRITE_TIMEOUT_KEY;
42-
import static org.apache.hadoop.hbase.client.AsyncProcess.DEFAULT_START_LOG_ERRORS_AFTER_COUNT;
43-
import static org.apache.hadoop.hbase.client.AsyncProcess.START_LOG_ERRORS_AFTER_COUNT_KEY;
4442
import static org.apache.hadoop.hbase.client.ConnectionConfiguration.MAX_KEYVALUE_SIZE_DEFAULT;
4543
import static org.apache.hadoop.hbase.client.ConnectionConfiguration.MAX_KEYVALUE_SIZE_KEY;
4644
import static org.apache.hadoop.hbase.client.ConnectionConfiguration.PRIMARY_CALL_TIMEOUT_MICROSECOND;
@@ -66,6 +64,16 @@ class AsyncConnectionConfiguration {
6664

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

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

7179
// 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
@@ -654,4 +654,14 @@ RegionLocations getRegionLocationInCache(TableName tableName, byte[] row) {
654654
}
655655
return locateRowInCache(tableCache, tableName, row, RegionReplicaUtil.DEFAULT_REPLICA_ID);
656656
}
657+
658+
// only used for testing whether we have cached the location for a table.
659+
@VisibleForTesting
660+
int getNumberOfCachedRegionLocations(TableName tableName) {
661+
TableCache tableCache = cache.get(tableName);
662+
if (tableCache == null) {
663+
return 0;
664+
}
665+
return tableCache.cache.values().stream().mapToInt(RegionLocations::numNonNullElements).sum();
666+
}
657667
}

0 commit comments

Comments
 (0)