You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-dev@hadoop.apache.org by "ZanderXu (Jira)" <ji...@apache.org> on 2024/04/18 10:24:00 UTC

[jira] [Created] (HDFS-17481) [FGL] ComputeFileSize in INodeFile should avoid BM lock

ZanderXu created HDFS-17481:
-------------------------------

             Summary: [FGL] ComputeFileSize in INodeFile should avoid BM lock
                 Key: HDFS-17481
                 URL: https://issues.apache.org/jira/browse/HDFS-17481
             Project: Hadoop HDFS
          Issue Type: Sub-task
            Reporter: ZanderXu
            Assignee: ZanderXu


GetFileInfo is a very common used operations. The result FileStatus contains the file size, which is computed by computeFileSize in InodeFile.

 

Since it involves the states of block, it needs to hold the BM readLock. But holding the BM readLock will impact the performance, since getFileInfo is very common used RPC.

 

As we all known, block size may be changed only by the following operations:
 # fsync
 # updatePipeline
 # commit block
 # commitBlockSynchronization
 # truncate
 # updates block in FSEditLogLoader
 # forceCompleteBlock in FSEditLogLoader

 

All these above operations will be locked by the directory tree or global write lock, so computeFileSize can be handled without holding BM Lock.

But the BR and IBM may change the block status from COMMIT to COMPLETE even through the block size is not changed. So computeFileSize cannot using isComplete to compute the size of last block.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-dev-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-dev-help@hadoop.apache.org