[ 
https://issues.apache.org/jira/browse/HDDS-16327?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ASF GitHub Bot updated HDDS-16327:
----------------------------------
    Labels: pull-request-available  (was: )

> Read the block file length once per WriteChunk instead of three fstat calls
> ---------------------------------------------------------------------------
>
>                 Key: HDDS-16327
>                 URL: https://issues.apache.org/jira/browse/HDDS-16327
>             Project: Apache Ozone
>          Issue Type: Improvement
>            Reporter: Huang Kuan Hao
>            Assignee: Huang Kuan Hao
>            Priority: Major
>              Labels: pull-request-available
>
> FilePerBlockStrategy.writeChunk resolves the block file length via
> FileChannel.size() three times per WriteChunk (twice on an overwrite), each an
> uncached fstat:
> 1. validateChunkForOverwrite(channel, info)
>      -> ChunkUtils.isOverWriteRequested (ChunkUtils.java:419)
> 2. ChunkUtils.validateChunkSize(channel, info, ...) (ChunkUtils.java:537),
>      skipped when it is an overwrite
> 3. fileLengthBeforeWrite = channel.size() (FilePerBlockStrategy.java:181)
> All three run before ChunkUtils.writeData, and WriteChunk apply for a given
> block file is serialized, so the length is stable across them. WriteChunk is
> the hottest datanode write path (once per chunk of every write, default
> FILE_PER_BLOCK layout).
> Fix: read channel.size() once after obtaining the channel and pass it into
> isOverWriteRequested / validateChunkSize / fileLengthBeforeWrite (adding an
> overload that takes the already-read length) instead of re-stat-ing. Behavior
> unchanged.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to