Skip to content

[SPARK-52613][CORE][SQL] Restore printing full stacktrace when HBase/Hive DelegationTokenProvider hit exception #51320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ private[security] class HBaseDelegationTokenProvider
creds.addToken(token.getService, token)
} catch {
case NonFatal(e) =>
logWarning(Utils.createFailedToGetTokenMessage(serviceName, e) + log" Retrying to fetch " +
log"HBase security token with ${MDC(SERVICE_NAME, serviceName)} connection parameter.")
logWarning(Utils.createFailedToGetTokenMessage(serviceName) + log" Retrying to fetch " +
log"HBase security token with ${MDC(SERVICE_NAME, serviceName)} connection parameter.", e)
// Seems to be spark is trying to get the token from HBase 2.x.x version or above where the
// obtainToken(Configuration conf) API has been removed. Lets try obtaining the token from
// another compatible API of HBase service.
Expand Down Expand Up @@ -98,7 +98,7 @@ private[security] class HBaseDelegationTokenProvider
creds.addToken(token.getService, token)
} catch {
case NonFatal(e) =>
logWarning(Utils.createFailedToGetTokenMessage(serviceName, e))
logWarning(Utils.createFailedToGetTokenMessage(serviceName), e)
} finally {
if (null != hbaseConnection) {
hbaseConnection.close()
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/scala/org/apache/spark/util/Utils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3060,9 +3060,9 @@ private[spark] object Utils
}

/** Returns a string message about delegation token generation failure */
def createFailedToGetTokenMessage(serviceName: String, e: scala.Throwable): MessageWithContext = {
log"Failed to get token from service ${MDC(SERVICE_NAME, serviceName)} " +
log"due to ${MDC(ERROR, e)}. If ${MDC(SERVICE_NAME, serviceName)} is not used, " +
def createFailedToGetTokenMessage(serviceName: String): MessageWithContext = {
log"Failed to get token from service ${MDC(SERVICE_NAME, serviceName)}. " +
log"If ${MDC(SERVICE_NAME, serviceName)} is not used, " +
log"set spark.security.credentials.${MDC(SERVICE_NAME, serviceName)}.enabled to false."
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private[spark] class HiveDelegationTokenProvider
None
} catch {
case NonFatal(e) =>
logWarning(Utils.createFailedToGetTokenMessage(serviceName, e))
logWarning(Utils.createFailedToGetTokenMessage(serviceName), e)
None
case e: NoClassDefFoundError =>
logWarning(classNotFoundErrorStr)
Expand Down