This is an automated email from the ASF dual-hosted git repository. ferhui pushed a commit to branch HDFS-17384 in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/HDFS-17384 by this push: new 1e45a04b5c14 HDFS-17424 [FGL] DelegationTokenSecretManager supports fine-grained lock (#6696) 1e45a04b5c14 is described below commit 1e45a04b5c14e95907302dfa57e561bc78f5242c Author: Yuanbo Liu <yua...@apache.org> AuthorDate: Tue Apr 16 11:51:02 2024 +0800 HDFS-17424 [FGL] DelegationTokenSecretManager supports fine-grained lock (#6696) --- .../security/token/delegation/DelegationTokenSecretManager.java | 9 +++++---- .../org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/security/token/delegation/DelegationTokenSecretManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/security/token/delegation/DelegationTokenSecretManager.java index b89998d98958..5ac5d29d9a2c 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/security/token/delegation/DelegationTokenSecretManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/security/token/delegation/DelegationTokenSecretManager.java @@ -27,6 +27,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map.Entry; +import org.apache.hadoop.hdfs.server.namenode.fgl.FSNamesystemLockMode; import org.apache.hadoop.util.Lists; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -372,7 +373,7 @@ public class DelegationTokenSecretManager // closes the edit log files. Doing this inside the // fsn lock will prevent being interrupted when stopping // the secret manager. - namesystem.readLockInterruptibly(); + namesystem.readLockInterruptibly(FSNamesystemLockMode.FS); try { // this monitor isn't necessary if stopped while holding write lock // but for safety, guard against a stop with read lock. @@ -383,7 +384,7 @@ public class DelegationTokenSecretManager namesystem.logUpdateMasterKey(key); } } finally { - namesystem.readUnlock("logUpdateMasterKey"); + namesystem.readUnlock(FSNamesystemLockMode.FS, "logUpdateMasterKey"); } } catch (InterruptedException ie) { // AbstractDelegationTokenManager may crash if an exception is thrown. @@ -401,7 +402,7 @@ public class DelegationTokenSecretManager // closes the edit log files. Doing this inside the // fsn lock will prevent being interrupted when stopping // the secret manager. - namesystem.readLockInterruptibly(); + namesystem.readLockInterruptibly(FSNamesystemLockMode.FS); try { // this monitor isn't necessary if stopped while holding write lock // but for safety, guard against a stop with read lock. @@ -412,7 +413,7 @@ public class DelegationTokenSecretManager namesystem.logExpireDelegationToken(dtId); } } finally { - namesystem.readUnlock("logExpireToken"); + namesystem.readUnlock(FSNamesystemLockMode.FS, "logExpireToken"); } } catch (InterruptedException ie) { // AbstractDelegationTokenManager may crash if an exception is thrown. diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java index 1f1fe25f15f9..17f2080a4d11 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java @@ -6486,7 +6486,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean, "the DT manager before entering safemode!"; // edit log rolling is not thread-safe and must be protected by the // fsn lock. not updating namespace so read lock is sufficient. - assert hasReadLock(); + assert hasReadLock(FSNamesystemLockMode.FS); getEditLog().logUpdateMasterKey(key); getEditLog().logSync(); } @@ -6502,7 +6502,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean, "the DT manager before entering safemode!"; // edit log rolling is not thread-safe and must be protected by the // fsn lock. not updating namespace so read lock is sufficient. - assert hasReadLock(); + assert hasReadLock(FSNamesystemLockMode.FS); // do not logSync so expiration edits are batched getEditLog().logCancelDelegationToken(id); } --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org