[
https://issues.apache.org/jira/browse/HDFS-17384?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17908234#comment-17908234
]
ASF GitHub Bot commented on HDFS-17384:
---------------------------------------
hfutatzhanghb commented on code in PR #6762:
URL: https://github.com/apache/hadoop/pull/6762#discussion_r1897587322
##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java:
##########
@@ -2031,7 +2053,7 @@ BatchedListEntries<OpenFileEntry> listOpenFiles(long
prevId,
BatchedListEntries<OpenFileEntry> batchedListEntries;
String normalizedPath = new Path(path).toString(); // normalize path.
try {
- readLock();
+ readLock(RwLockMode.FS);
Review Comment:
Also use GLOBAL mode here, because it invoke getFilesBlockingDecom method.
##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java:
##########
@@ -2058,7 +2080,7 @@ BatchedListEntries<OpenFileEntry> listOpenFiles(long
prevId,
public BatchedListEntries<OpenFileEntry> getFilesBlockingDecom(long prevId,
String path) {
- assert hasReadLock();
+ assert hasReadLock(RwLockMode.FS);
Review Comment:
I think we should use GLOBAL mode here, because below codes contain iterate
`blockManager.getDatanodeManager().getDatanodes()`
> [FGL] Replace the global lock with global FS Lock and global BM lock
> --------------------------------------------------------------------
>
> Key: HDFS-17384
> URL: https://issues.apache.org/jira/browse/HDFS-17384
> Project: Hadoop HDFS
> Issue Type: Improvement
> Reporter: ZanderXu
> Assignee: ZanderXu
> Priority: Major
> Labels: FGL, pull-request-available
>
> First, we can replace the current global lock with two locks, global FS lock
> and global BM lock.
> The global FS lock is used to make directory tree-related operations
> thread-safe.
> The global BM lock is used to make block-related operations and DN-related
> operations thread-safe.
>
> For some operations involving both directory tree and block or DN, the global
> FS lock and the global BM lock are acquired.
>
> The lock order should be:
> * The global FS lock
> * The global BM lock
>
> There are some special requirements for this ticket.
> * End-user can choose to use global lock or fine-grained lock through
> configuration.
> * Try not to modify the current implementation logic as much as possible.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]