@@ -27,11 +27,8 @@ import org.apache.hadoop.yarn.api.ApplicationConstants
27
27
import org .apache .hadoop .yarn .api .records .{ApplicationAccessType , ContainerId , Priority }
28
28
import org .apache .hadoop .yarn .util .ConverterUtils
29
29
30
- import org .apache .spark .{SecurityManager , SparkConf , SparkException }
31
- import org .apache .spark .deploy .SparkHadoopUtil
30
+ import org .apache .spark .{SecurityManager , SparkConf }
32
31
import org .apache .spark .deploy .yarn .config ._
33
- import org .apache .spark .deploy .yarn .security .YARNHadoopDelegationTokenManager
34
- import org .apache .spark .internal .config ._
35
32
import org .apache .spark .launcher .YarnCommandBuilderUtils
36
33
import org .apache .spark .util .Utils
37
34
@@ -193,8 +190,7 @@ object YarnSparkHadoopUtil {
193
190
sparkConf : SparkConf ,
194
191
hadoopConf : Configuration ): Set [FileSystem ] = {
195
192
val filesystemsToAccess = sparkConf.get(FILESYSTEMS_TO_ACCESS )
196
- .map(new Path (_).getFileSystem(hadoopConf))
197
- .toSet
193
+ val requestAllDelegationTokens = filesystemsToAccess.isEmpty
198
194
199
195
val stagingFS = sparkConf.get(STAGING_DIR )
200
196
.map(new Path (_).getFileSystem(hadoopConf))
@@ -203,8 +199,8 @@ object YarnSparkHadoopUtil {
203
199
// Add the list of available namenodes for all namespaces in HDFS federation.
204
200
// If ViewFS is enabled, this is skipped as ViewFS already handles delegation tokens for its
205
201
// namespaces.
206
- val hadoopFilesystems = if (stagingFS.getScheme == " viewfs" ) {
207
- Set .empty
202
+ val hadoopFilesystems = if (! requestAllDelegationTokens || stagingFS.getScheme == " viewfs" ) {
203
+ filesystemsToAccess.map( new Path (_).getFileSystem(hadoopConf)).toSet
208
204
} else {
209
205
val nameservices = hadoopConf.getTrimmedStrings(" dfs.nameservices" )
210
206
// Retrieving the filesystem for the nameservices where HA is not enabled
@@ -222,7 +218,7 @@ object YarnSparkHadoopUtil {
222
218
(filesystemsWithoutHA ++ filesystemsWithHA).toSet
223
219
}
224
220
225
- filesystemsToAccess ++ hadoopFilesystems + stagingFS
221
+ hadoopFilesystems + stagingFS
226
222
}
227
223
228
224
}
0 commit comments