From 2a9fbaa9e9c4c8ec8960612724b2e81e34c2ec69 Mon Sep 17 00:00:00 2001 From: Andrew Purtell Date: Mon, 10 Oct 2022 18:43:07 -0700 Subject: [PATCH 1/3] HBASE-27339 Improve sasl connection failure log message to include server Include the remote server name in the logged exception message when the connection setup fails in BlockingRpcConnection. Add an equivalent log line in NettyRpcConnection. --- .../org/apache/hadoop/hbase/ipc/BlockingRpcConnection.java | 4 ++-- .../java/org/apache/hadoop/hbase/ipc/NettyRpcConnection.java | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/BlockingRpcConnection.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/BlockingRpcConnection.java index da032cbeb9d1..f5f1f27925df 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/BlockingRpcConnection.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/BlockingRpcConnection.java @@ -395,7 +395,7 @@ public Object run() throws IOException, InterruptedException { // A provider which failed authentication, but doesn't have the ability to relogin with // some external system (e.g. username/password, the password either works or it doesn't) if (!provider.canRetry()) { - LOG.warn("Exception encountered while connecting to the server : " + ex); + LOG.warn("Exception encountered while connecting to the server " + remoteId.getAddress(), ex); if (ex instanceof RemoteException) { throw (RemoteException) ex; } @@ -410,7 +410,7 @@ public Object run() throws IOException, InterruptedException { // Other providers, like kerberos, could request a new ticket from a keytab. Let // them try again. if (currRetries < maxRetries) { - LOG.debug("Exception encountered while connecting to the server", ex); + LOG.debug("Exception encountered while connecting to the server " + remoteId.getAddress(), ex); // Invoke the provider to perform the relogin provider.relogin(); diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcConnection.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcConnection.java index 3b5b6a5581cd..4b5b6b05df28 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcConnection.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcConnection.java @@ -314,7 +314,9 @@ private void succeed(Channel ch) throws IOException { } private void fail(Channel ch, Throwable error) { - failInit(ch, toIOE(error)); + IOException ex = toIOE(error); + LOG.warn("Exception encountered while connecting to the server " + remoteId.getAddress(), ex); + failInit(ch, toIOE(ex)); rpcClient.failedServers.addToFailedServers(remoteId.getAddress(), error); } From 93a23def5939579d45f83029a2f692d9c3e3ed8f Mon Sep 17 00:00:00 2001 From: Andrew Purtell Date: Tue, 11 Oct 2022 10:01:39 -0700 Subject: [PATCH 2/3] Fix pasto --- .../java/org/apache/hadoop/hbase/ipc/NettyRpcConnection.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcConnection.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcConnection.java index 4b5b6b05df28..7b2f1e3914d3 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcConnection.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcConnection.java @@ -316,7 +316,7 @@ private void succeed(Channel ch) throws IOException { private void fail(Channel ch, Throwable error) { IOException ex = toIOE(error); LOG.warn("Exception encountered while connecting to the server " + remoteId.getAddress(), ex); - failInit(ch, toIOE(ex)); + failInit(ch, ex); rpcClient.failedServers.addToFailedServers(remoteId.getAddress(), error); } From e14b2b56f48094cf0c8af3d6262dc65cfb1a421a Mon Sep 17 00:00:00 2001 From: Andrew Purtell Date: Tue, 11 Oct 2022 10:07:14 -0700 Subject: [PATCH 3/3] Spotless fixes --- .../org/apache/hadoop/hbase/ipc/BlockingRpcConnection.java | 6 ++++-- .../org/apache/hadoop/hbase/ipc/NettyRpcConnection.java | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/BlockingRpcConnection.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/BlockingRpcConnection.java index f5f1f27925df..d63d14940e78 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/BlockingRpcConnection.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/BlockingRpcConnection.java @@ -395,7 +395,8 @@ public Object run() throws IOException, InterruptedException { // A provider which failed authentication, but doesn't have the ability to relogin with // some external system (e.g. username/password, the password either works or it doesn't) if (!provider.canRetry()) { - LOG.warn("Exception encountered while connecting to the server " + remoteId.getAddress(), ex); + LOG.warn("Exception encountered while connecting to the server " + remoteId.getAddress(), + ex); if (ex instanceof RemoteException) { throw (RemoteException) ex; } @@ -410,7 +411,8 @@ public Object run() throws IOException, InterruptedException { // Other providers, like kerberos, could request a new ticket from a keytab. Let // them try again. if (currRetries < maxRetries) { - LOG.debug("Exception encountered while connecting to the server " + remoteId.getAddress(), ex); + LOG.debug("Exception encountered while connecting to the server " + remoteId.getAddress(), + ex); // Invoke the provider to perform the relogin provider.relogin(); diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcConnection.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcConnection.java index 7b2f1e3914d3..3ed259f2f286 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcConnection.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcConnection.java @@ -315,7 +315,8 @@ private void succeed(Channel ch) throws IOException { private void fail(Channel ch, Throwable error) { IOException ex = toIOE(error); - LOG.warn("Exception encountered while connecting to the server " + remoteId.getAddress(), ex); + LOG.warn("Exception encountered while connecting to the server " + remoteId.getAddress(), + ex); failInit(ch, ex); rpcClient.failedServers.addToFailedServers(remoteId.getAddress(), error); }