From 29ffcbfcf5720cb91b36dfd22b923dbb1a564cbe Mon Sep 17 00:00:00 2001 From: Ankit Singhal Date: Wed, 30 Oct 2019 14:49:04 -0700 Subject: [PATCH] HBASE-23175 Yarn unable to acquire delegation token for HBase Spark jobs --- .../hadoop/hbase/security/token/TokenUtil.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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 bb5dd244ce92..6dd5587802d5 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 @@ -21,6 +21,7 @@ import java.lang.reflect.UndeclaredThrowableException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.client.Connection; +import org.apache.hadoop.hbase.client.ConnectionFactory; import org.apache.hadoop.hbase.protobuf.generated.AuthenticationProtos; import org.apache.hadoop.hbase.security.User; import org.apache.hadoop.hbase.zookeeper.ZKClusterId; @@ -43,6 +44,19 @@ public class TokenUtil { // This class is referenced indirectly by User out in common; instances are created by reflection private static final Logger LOG = LoggerFactory.getLogger(TokenUtil.class); + /** + * 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 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