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

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


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 97879d2  HBASE-23175 Yarn unable to acquire delegation token for HBase 
Spark jobs
97879d2 is described below

commit 97879d2b3e1733063453adadd55b1e9e0a42a04c
Author: Ankit Singhal <[email protected]>
AuthorDate: Wed Oct 30 14:49:04 2019 -0700

    HBASE-23175 Yarn unable to acquire delegation token for HBase Spark jobs
---
 .../hadoop/hbase/security/token/TokenUtil.java     | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/TokenUtil.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/TokenUtil.java
index c54d905..97a9ab1 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/TokenUtil.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/TokenUtil.java
@@ -31,6 +31,7 @@ import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.Connection;
 import org.apache.hadoop.hbase.client.Table;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
 import org.apache.hadoop.hbase.ipc.CoprocessorRpcChannel;
 import org.apache.hadoop.hbase.protobuf.generated.AuthenticationProtos;
 import org.apache.hadoop.hbase.security.User;
@@ -64,10 +65,25 @@ public class TokenUtil {
 
   /**
    * Obtain and return an authentication token for the current user.
-   * @param conn The HBase cluster connection
-   * @throws IOException if a remote error or serialization problem occurs.
-   * @return the authentication token instance
+   * It was removed in HBase-2.0 but added again as spark code relies on this 
method to obtain
+   * delegation token
+   * @deprecated Since 2.0.0.
+   */
+  @Deprecated
+  public static Token<AuthenticationTokenIdentifier> obtainToken(Configuration 
conf)
+      throws IOException {
+    try (Connection connection = ConnectionFactory.createConnection(conf)) {
+      return obtainToken(connection);
+    }
+  }
+
+  /**
+   * See {@link 
ClientTokenUtil#obtainToken(org.apache.hadoop.hbase.client.Connection)}.
+   * @deprecated External users should not use this method. Please post on
+   *   the HBase dev mailing list if you need this method. Internal
+   *   HBase code should use {@link ClientTokenUtil} instead.
    */
+  @Deprecated
   public static Token<AuthenticationTokenIdentifier> obtainToken(
       Connection conn) throws IOException {
     Table meta = null;

Reply via email to