peterxcli opened a new pull request, #11465: URL: https://github.com/apache/ozone/pull/11465
## What changes were proposed in this pull request? #11150 made `FilePerBlockStrategy` pass the block file length it already has into the new `ChunkUtils.validateChunkForOverwrite(long fileLen, ChunkInfo)`. The older `File` overloads of `validateChunkForOverwrite` and `isOverWriteRequested` were left in place. Their bodies are copies of the `long` versions, down to the same "Duplicate write chunk request" warning and the same TODO. With this change: - `ChunkUtils` keeps a single `validateChunkForOverwrite(long fileLen, ChunkInfo)`, with the `info.getOffset() < fileLen` check written inline. - Both `isOverWriteRequested` overloads are removed. Nothing outside `ChunkUtils` called them. - `FilePerChunkStrategy.writeChunk` passes `chunkFile.length()` to the `long` version. This does not change behavior for real requests. `File.length()` returns 0 for a file that does not exist, so the old `exists()` check made no difference for any offset of 0 or more. `File.length()` also returns 0 on an I/O error, which the old code already relied on. As a side effect, each write in the FilePerChunk layout does one fewer file system call. The only input that behaves differently is a negative offset on a chunk file that does not exist yet. It now counts as an overwrite, where before it did not. The offset is a `uint64` on the wire, and `FilePerBlockStrategy` already treats this case the same way. ## What is the link to the Apache JIRA https://issues.apache.org/jira/browse/HDDS-16844 ## How was this patch tested? `TestChunkUtils.validateChunkForOverwrite` now checks only the `long` method. Its file-based asserts used the same length and offsets as the `long` cases that were already there. Ran `TestChunkUtils`, `TestFilePerChunkStrategy`, `TestFilePerBlockStrategy`, `TestChunkManagerDummyImpl` and `TestKeyValueHandler` locally: 79 tests, all pass. Checkstyle and PMD on `hdds-container-service` are 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]
