File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
yarn/src/main/scala/org/apache/spark/deploy/yarn Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 1818package org .apache .spark .deploy .yarn
1919
2020import java .io ._
21- import java .util
2221import java .util .Arrays
2322import java .util .Comparator
2423import java .util .concurrent .{Executors , TimeUnit }
@@ -162,6 +161,20 @@ class YarnSparkHadoopUtil extends SparkHadoopUtil {
162161 principal, keytab)
163162 logInfo(" Successfully logged into KDC." )
164163 loggedInViaKeytab = true
164+ // Not exactly sure when HDFS re-logs in, be safe and do it ourselves.
165+ // Periodically check and relogin this keytab. The UGI will take care of not relogging in
166+ // if it is not necessary to relogin.
167+ val reloginRunnable = new Runnable {
168+ override def run (): Unit = {
169+ try {
170+ loggedInUGI.checkTGTAndReloginFromKeytab()
171+ } catch {
172+ case e : Exception =>
173+ logError(" Error while attempting tp relogin to KDC" , e)
174+ }
175+ }
176+ }
177+ delegationTokenRenewer.schedule(reloginRunnable, 6 , TimeUnit .HOURS )
165178 }
166179 val nns = getNameNodesToAccess(sparkConf)
167180 val newCredentials = loggedInUGI.getCredentials
You can’t perform that action at this time.
0 commit comments