[KYUUBI #7433][SPARK] Preserve Hive delegation tokens with non-empty service#7518
Open
Sunwoo-Shin wants to merge 1 commit into
Open
[KYUUBI #7433][SPARK] Preserve Hive delegation tokens with non-empty service#7518Sunwoo-Shin wants to merge 1 commit into
Sunwoo-Shin wants to merge 1 commit into
Conversation
…empty service addHiveToken dropped Hive tokens whose service is non-empty, breaking auth against non-default metastores in multi-HMS setups. Partition tokens on the service field and add the signature-bound ones by alias.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why are the changes needed?
Closes #7433.
SparkTBinaryFrontendService#addHiveTokenkeeps only the Hive delegation token whoseservicefield is empty (the oneHiveMetaStoreClientselects by default) and silently drops every Hive token whoseserviceis non-empty.A Hive delegation token gets a non-empty
servicewhen it is bound to a specific metastore viahive.metastore.token.signature(the signature is stored in the token service). When an engine talks to multiple Hive metastores that use different Kerberos principals — e.g. two Iceberg catalogs, each backed by its own HMS — each metastore produces its own signature-bound token. Because these tokens are dropped before reaching the engine UGI, the engine fails to authenticate against the non-default metastore withDIGEST-MD5: IO error acquiring password.This is the engine-side counterpart of #1091 (renewing delegation tokens for multiple Hive metastore clusters): even when the server pushes per-metastore tokens, the engine drops them.
Affected versions: 1.11.1.
This change partitions the incoming Hive tokens by their
servicefield:serviceare added to the engine credentials keyed by their alias, reusing the same issue-date downgrade guard the default path already applies.service) tokens, so behavior for the common single-HMS case is unchanged.No matching Hive token found ...warning is emitted only when a default-servicetoken was actually expected, to avoid noise in metastore deployments that rely solely on signature-bound tokens.How was this patch tested?
Added unit tests in
SparkTBinaryFrontendServiceSuite(the token-merging logic was extracted intomergeHiveTokensso it can be exercised without aSparkContext):servicetokens is unchanged;servicepath.Was this patch authored or co-authored using generative AI tooling?
Assisted-by: Claude:claude-opus-4-8