-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-28428 : Zookeeper ConnectionRegistry APIs should have timeout #5837
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
d201c95
9891a83
8ad5b53
ab55498
7dae201
7af1c80
21fc435
3001cba
44c2254
a1027f5
3df4556
0e96e4c
5f1752b
df28809
afdffae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,7 @@ | |
|
|
||
| import java.util.concurrent.CompletableFuture; | ||
| import java.util.concurrent.atomic.AtomicReference; | ||
| import org.apache.hadoop.conf.Configuration; | ||
|
||
| import org.apache.hadoop.hbase.HRegionLocation; | ||
| import org.apache.hadoop.hbase.RegionLocations; | ||
| import org.apache.hadoop.hbase.ServerName; | ||
|
|
@@ -56,9 +57,9 @@ class AsyncMetaRegionLocator { | |
| * replicas. If we do not check the location for the given replica, we will always return the | ||
| * cached region locations and cause an infinite loop. | ||
| */ | ||
| CompletableFuture<RegionLocations> getRegionLocations(int replicaId, boolean reload) { | ||
| CompletableFuture<RegionLocations> getRegionLocations(int replicaId, boolean reload, Configuration conf) { | ||
| return ConnectionUtils.getOrFetch(metaRegionLocations, metaRelocateFuture, reload, | ||
| registry::getMetaRegionLocations, locs -> isGood(locs, replicaId), "meta region location"); | ||
| registry::getMetaRegionLocations, locs -> isGood(locs, replicaId), "meta region location", conf); | ||
| } | ||
|
|
||
| private HRegionLocation getCacheLocation(HRegionLocation loc) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,9 @@ | |
| import java.io.IOException; | ||
| import java.net.SocketAddress; | ||
| import java.security.PrivilegedExceptionAction; | ||
| import java.util.concurrent.TimeUnit; | ||
| import org.apache.hadoop.conf.Configuration; | ||
| import org.apache.hadoop.hbase.HConstants; | ||
| import org.apache.hadoop.hbase.security.User; | ||
| import org.apache.hadoop.hbase.util.FutureUtils; | ||
| import org.apache.hadoop.hbase.util.ReflectionUtils; | ||
|
|
@@ -39,8 +41,10 @@ private ClusterConnectionFactory() { | |
| } | ||
|
|
||
| private static AsyncClusterConnection createAsyncClusterConnection(Configuration conf, | ||
| ConnectionRegistry registry, SocketAddress localAddress, User user) throws IOException { | ||
| String clusterId = FutureUtils.get(registry.getClusterId()); | ||
| ConnectionRegistry registry, SocketAddress localAddress, User user ) throws IOException { | ||
|
||
| String clusterId = FutureUtils.get(registry.getClusterId(), | ||
| conf.getInt(HConstants.CONNECTION_REGISTRY_API_TIMEOUT, | ||
| HConstants.DEFAULT_CONNECTION_REGISTRY_API_TIMEOUT), TimeUnit.MILLISECONDS); | ||
| Class<? extends AsyncClusterConnection> clazz = | ||
| conf.getClass(HBASE_SERVER_CLUSTER_CONNECTION_IMPL, AsyncClusterConnectionImpl.class, | ||
| AsyncClusterConnection.class); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -174,7 +174,8 @@ public void updateCachedLocationOnError(HRegionLocation loc, Throwable error) { | |
| @Override | ||
| public RegionLocations getRegionLocations(TableName tableName, int replicaId, | ||
| boolean reload) throws Exception { | ||
| return locator.getRegionLocations(replicaId, reload).get(); | ||
| final Configuration conf = HBaseConfiguration.create(); | ||
|
||
| return locator.getRegionLocations(replicaId, reload, conf).get(); | ||
| } | ||
| }); | ||
| } catch (Exception e) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think this is the correct place to put these timeout configurations.
We should place them into the connection registry implementation.