Skip to content
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 @@ -42,7 +42,7 @@ import org.apache.spark.internal.Logging
private[spark] class HadoopDelegationTokenManager(
sparkConf: SparkConf,
hadoopConf: Configuration,
fileSystems: Set[FileSystem])
fileSystems: Configuration => Set[FileSystem])
extends Logging {

private val deprecatedProviderEnabledConfigs = List(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdenti
import org.apache.spark.SparkException
import org.apache.spark.internal.Logging

private[deploy] class HadoopFSDelegationTokenProvider(fileSystems: Set[FileSystem])
private[deploy] class HadoopFSDelegationTokenProvider(fileSystems: Configuration => Set[FileSystem])
extends HadoopDelegationTokenProvider with Logging {

// This tokenRenewalInterval will be set in the first call to obtainDelegationTokens.
Expand All @@ -43,13 +43,14 @@ private[deploy] class HadoopFSDelegationTokenProvider(fileSystems: Set[FileSyste
hadoopConf: Configuration,
creds: Credentials): Option[Long] = {

val fsToGetTokens = fileSystems(hadoopConf)
val newCreds = fetchDelegationTokens(
getTokenRenewer(hadoopConf),
fileSystems)
fsToGetTokens)

// Get the token renewal interval if it is not set. It will only be called once.
if (tokenRenewalInterval == null) {
tokenRenewalInterval = getTokenRenewalInterval(hadoopConf, fileSystems)
tokenRenewalInterval = getTokenRenewalInterval(hadoopConf, fsToGetTokens)
}

// Get the time of next renewal.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class HadoopDelegationTokenManagerSuite extends SparkFunSuite with Matchers {
delegationTokenManager = new HadoopDelegationTokenManager(
sparkConf,
hadoopConf,
hadoopFSsToAccess(hadoopConf))
hadoopFSsToAccess)

delegationTokenManager.getServiceDelegationTokenProvider("hadoopfs") should not be (None)
delegationTokenManager.getServiceDelegationTokenProvider("hbase") should not be (None)
Expand All @@ -53,7 +53,7 @@ class HadoopDelegationTokenManagerSuite extends SparkFunSuite with Matchers {
delegationTokenManager = new HadoopDelegationTokenManager(
sparkConf,
hadoopConf,
hadoopFSsToAccess(hadoopConf))
hadoopFSsToAccess)

delegationTokenManager.getServiceDelegationTokenProvider("hadoopfs") should not be (None)
delegationTokenManager.getServiceDelegationTokenProvider("hbase") should not be (None)
Expand All @@ -66,7 +66,7 @@ class HadoopDelegationTokenManagerSuite extends SparkFunSuite with Matchers {
delegationTokenManager = new HadoopDelegationTokenManager(
sparkConf,
hadoopConf,
hadoopFSsToAccess(hadoopConf))
hadoopFSsToAccess)

delegationTokenManager.getServiceDelegationTokenProvider("hadoopfs") should be (None)
delegationTokenManager.getServiceDelegationTokenProvider("hive") should be (None)
Expand All @@ -77,7 +77,7 @@ class HadoopDelegationTokenManagerSuite extends SparkFunSuite with Matchers {
delegationTokenManager = new HadoopDelegationTokenManager(
sparkConf,
hadoopConf,
hadoopFSsToAccess(hadoopConf))
hadoopFSsToAccess)
val creds = new Credentials()

// Tokens cannot be obtained from HDFS, Hive, HBase in unit tests.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ private[spark] class ApplicationMaster(
val credentialManager = new YARNHadoopDelegationTokenManager(
sparkConf,
yarnConf,
YarnSparkHadoopUtil.get.hadoopFSsToAccess(sparkConf, yarnConf))
conf => YarnSparkHadoopUtil.get.hadoopFSsToAccess(sparkConf, conf))

val credentialRenewer =
new AMCredentialRenewer(sparkConf, yarnConf, credentialManager)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private[spark] class Client(
private val credentialManager = new YARNHadoopDelegationTokenManager(
sparkConf,
hadoopConf,
YarnSparkHadoopUtil.get.hadoopFSsToAccess(sparkConf, hadoopConf))
conf => YarnSparkHadoopUtil.get.hadoopFSsToAccess(sparkConf, conf))

def reportLauncherState(state: SparkAppHandle.State): Unit = {
launcherBackend.setState(state)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class YarnSparkHadoopUtil extends SparkHadoopUtil {
val credentialManager = new YARNHadoopDelegationTokenManager(
sparkConf,
hadoopConf,
YarnSparkHadoopUtil.get.hadoopFSsToAccess(sparkConf, hadoopConf))
conf => YarnSparkHadoopUtil.get.hadoopFSsToAccess(sparkConf, conf))
credentialUpdater = new CredentialUpdater(sparkConf, hadoopConf, credentialManager)
credentialUpdater.start()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import org.apache.spark.util.Utils
private[yarn] class YARNHadoopDelegationTokenManager(
sparkConf: SparkConf,
hadoopConf: Configuration,
fileSystems: Set[FileSystem]) extends Logging {
fileSystems: Configuration => Set[FileSystem]) extends Logging {

private val delegationTokenManager =
new HadoopDelegationTokenManager(sparkConf, hadoopConf, fileSystems)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class YARNHadoopDelegationTokenManagerSuite extends SparkFunSuite with Matchers
credentialManager = new YARNHadoopDelegationTokenManager(
sparkConf,
hadoopConf,
YarnSparkHadoopUtil.get.hadoopFSsToAccess(sparkConf, hadoopConf))
conf => YarnSparkHadoopUtil.get.hadoopFSsToAccess(sparkConf, conf))

credentialManager.credentialProviders.get("yarn-test") should not be (None)
}
Expand Down