You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by me...@apache.org on 2021/02/26 13:10:40 UTC

[hbase] branch branch-2 updated: HBASE-25586 Fix HBASE-22492 on branch-2 (SASL GapToken) (#2961)

This is an automated email from the ASF dual-hosted git repository.

meszibalu pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2 by this push:
     new f2f4b3f  HBASE-25586 Fix HBASE-22492 on branch-2 (SASL GapToken) (#2961)
f2f4b3f is described below

commit f2f4b3f3adff74eb2e45325a03ae6ab96b8c31a5
Author: Balazs Meszaros <me...@apache.org>
AuthorDate: Fri Feb 26 14:05:59 2021 +0100

    HBASE-25586 Fix HBASE-22492 on branch-2 (SASL GapToken) (#2961)
    
    ServerCall.java: calling wrapWithSasl() was moved to getResponse(), so
    the SASL wrapping is delayed until the reply is sent back to the client.
    
    Signed-off-by: Peter Somogyi <ps...@apache.org>
---
 .../java/org/apache/hadoop/hbase/ipc/ServerCall.java  | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ServerCall.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ServerCall.java
index a5c8a39..b53c770 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ServerCall.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ServerCall.java
@@ -281,9 +281,6 @@ public abstract class ServerCall<T extends ServerRpcConnection> implements RpcCa
         }
       }
       bc = new BufferChain(responseBufs);
-      if (connection.useWrap) {
-        bc = wrapWithSasl(bc);
-      }
     } catch (IOException e) {
       RpcServer.LOG.warn("Exception while creating response " + e);
     }
@@ -547,6 +544,20 @@ public abstract class ServerCall<T extends ServerRpcConnection> implements RpcCa
 
   @Override
   public synchronized BufferChain getResponse() {
-    return response;
+    if (connection.useWrap) {
+      /*
+       * wrapping result with SASL as the last step just before sending it out, so
+       * every message must have the right increasing sequence number
+       */
+      try {
+        return wrapWithSasl(response);
+      } catch (IOException e) {
+        /* it is exactly the same what setResponse() does */
+        RpcServer.LOG.warn("Exception while creating response " + e);
+        return null;
+      }
+    } else {
+      return response;
+    }
   }
 }