Skip to content

Commit

Permalink
Fix using unavailable worker cached in client-pool to resolve Alluxio…
Browse files Browse the repository at this point in the history
  • Loading branch information
yws-tracy committed Dec 1, 2024
1 parent 6d99656 commit dc4f207
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ private CloseableResource<BlockWorkerClient> acquireBlockWorkerClientInternal(
.getRpcPortSocketAddress(workerNetAddress, context.getClusterConf());
GrpcServerAddress serverAddress = GrpcServerAddress.create(workerNetAddress.getHost(), address);
final ClientPoolKey key = new ClientPoolKey(address, AuthenticationUtils
.getImpersonationUser(userState.getSubject(), context.getClusterConf()));
.getImpersonationUser(userState.getSubject(), context.getClusterConf()), workerNetAddress.getHost());
final ConcurrentHashMap<ClientPoolKey, BlockWorkerClientPool> poolMap =
mBlockWorkerClientPoolMap;
BlockWorkerClientPool pool = poolMap.computeIfAbsent(
Expand Down Expand Up @@ -1035,10 +1035,14 @@ private List<WorkerNetAddress> getWorkerAddresses() throws IOException {
protected static class ClientPoolKey {
private final SocketAddress mSocketAddress;
private final String mUsername;
private final String mHostname;

public ClientPoolKey(SocketAddress socketAddress, String username) {

public ClientPoolKey(SocketAddress socketAddress, String username, String hostname) {
mSocketAddress = socketAddress;
mUsername = username;
mHostname = hostname;

}

@Override
Expand All @@ -1056,7 +1060,8 @@ public boolean equals(Object o) {
}
ClientPoolKey that = (ClientPoolKey) o;
return Objects.equal(mSocketAddress, that.mSocketAddress)
&& Objects.equal(mUsername, that.mUsername);
&& Objects.equal(mUsername, that.mUsername)
&& Objects.equal(mHostname, that.mHostname);
}

@Override
Expand Down

0 comments on commit dc4f207

Please sign in to comment.