rich7420 opened a new pull request, #11150:
URL: https://github.com/apache/ozone/pull/11150

   ## What changes were proposed in this pull request?
   
   `FilePerBlockStrategy.writeChunk` resolved the block file length via 
`FileChannel.size()` three times per WriteChunk (twice on an overwrite), each 
an uncached `fstat`: the overwrite check, the offset validation, and the space 
accounting. All three run before the write, and WriteChunk apply for a given 
block file is serialized, so the length is stable across them.
   
   This reads `channel.size()` once and reuses it for all three. The 
`FileChannel`-based `ChunkUtils` helpers (`validateChunkForOverwrite`, 
`isOverWriteRequested`, `validateChunkSize`) now take the already-read length 
instead of re-stat-ing; the `File`-based overloads used by 
`FilePerChunkStrategy` are unchanged.
   
   One behavioral note: previously a `size()` failure in the overwrite check 
surfaced as an `UncheckedIOException` (which `writeChunk` did not catch, so 
`onFailure` was not called); the single read now throws 
`StorageContainerException(CHUNK_FILE_INCONSISTENCY)`, matching the other two 
size-read sites. `onFailure(volume)` semantics are unchanged on every path.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-16327
   
   ## How was this patch tested?
   
   Behavior-preserving refactor, so no new test is added; the affected paths 
(overwrite / append / new-file and the space-accounting delta) are covered by 
the existing tests.
   
   - Unit: `mvn -pl :hdds-container-service test 
-Dtest=TestFilePerBlockStrategy,TestChunkUtils` — 25 run, 0 failed
   - `checkstyle` and `pmd` clean
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to