This is an automated email from the ASF dual-hosted git repository.

gallardot pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new 1c361bbac4 [Fix-17036] Fix kerberos will not refresh in 
HdfsStorageOperator (#17039)
1c361bbac4 is described below

commit 1c361bbac4643f0510a34f492d6d684949a1b0c2
Author: Wenjun Ruan <[email protected]>
AuthorDate: Fri Mar 7 20:13:48 2025 +0800

    [Fix-17036] Fix kerberos will not refresh in HdfsStorageOperator (#17039)
---
 .../plugin/storage/hdfs/HdfsStorageOperator.java         | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git 
a/dolphinscheduler-storage-plugin/dolphinscheduler-storage-hdfs/src/main/java/org/apache/dolphinscheduler/plugin/storage/hdfs/HdfsStorageOperator.java
 
b/dolphinscheduler-storage-plugin/dolphinscheduler-storage-hdfs/src/main/java/org/apache/dolphinscheduler/plugin/storage/hdfs/HdfsStorageOperator.java
index 3a1092077b..cf6bb78557 100644
--- 
a/dolphinscheduler-storage-plugin/dolphinscheduler-storage-hdfs/src/main/java/org/apache/dolphinscheduler/plugin/storage/hdfs/HdfsStorageOperator.java
+++ 
b/dolphinscheduler-storage-plugin/dolphinscheduler-storage-hdfs/src/main/java/org/apache/dolphinscheduler/plugin/storage/hdfs/HdfsStorageOperator.java
@@ -17,7 +17,10 @@
 
 package org.apache.dolphinscheduler.plugin.storage.hdfs;
 
+import org.apache.dolphinscheduler.common.thread.ThreadUtils;
 import org.apache.dolphinscheduler.common.utils.FileUtils;
+import org.apache.dolphinscheduler.common.utils.PropertyUtils;
+import 
org.apache.dolphinscheduler.plugin.datasource.api.constants.DataSourceConstants;
 import org.apache.dolphinscheduler.plugin.datasource.api.utils.CommonUtils;
 import org.apache.dolphinscheduler.plugin.storage.api.AbstractStorageOperator;
 import org.apache.dolphinscheduler.plugin.storage.api.ResourceMetadata;
@@ -51,6 +54,7 @@ import java.util.Collections;
 import java.util.Date;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
 import lombok.SneakyThrows;
@@ -102,6 +106,18 @@ public class HdfsStorageOperator extends 
AbstractStorageOperator implements Clos
 
         if (CommonUtils.getKerberosStartupState()) {
             CommonUtils.loadKerberosConf(configuration);
+            final Long kerberosExpireTimeInHour = 
PropertyUtils.getLong(DataSourceConstants.KERBEROS_EXPIRE_TIME, -1L);
+            if (kerberosExpireTimeInHour > 0) {
+                
ThreadUtils.newDaemonScheduledExecutorService("ds-hdfs-kerberos-refresh-%s", 1)
+                        .scheduleWithFixedDelay(() -> {
+                            try {
+                                
UserGroupInformation.getLoginUser().checkTGTAndReloginFromKeytab();
+                                log.info("checkTGTAndReloginFromKeytab 
finished");
+                            } catch (Exception e) {
+                                log.error("checkTGTAndReloginFromKeytab 
Error", e);
+                            }
+                        }, kerberosExpireTimeInHour, kerberosExpireTimeInHour, 
TimeUnit.MINUTES);
+            }
             fs = FileSystem.get(configuration);
             log.info("Initialize HdfsStorageOperator with kerberos");
             return;

Reply via email to