[
https://issues.apache.org/jira/browse/HDDS-16327?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18130501#comment-18130501
]
Siyao Meng commented on HDDS-16327:
-----------------------------------
[Jira cleanup 2026-10-22] Resolving as Implemented. WriteChunk reads the length
once and passes it to the validation helpers.
Evidence:
* https://github.com/apache/ozone/pull/11150
*
https://github.com/apache/ozone/commit/cf30cd7825791592a640d7bee0437fd329fa9648
*
https://github.com/apache/ozone/blob/bf3829e6c8ac69ae17585585703f91426dcdf6b3/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/impl/FilePerBlockStrategy.java#L170
Feel free to reopen if further work is needed.
> 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
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]