chungen0126 commented on code in PR #11150:
URL: https://github.com/apache/ozone/pull/11150#discussion_r4069846800
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/impl/FilePerBlockStrategy.java:
##########
@@ -157,31 +157,33 @@ public void writeChunk(Container container, BlockID
blockID, ChunkInfo info,
HddsVolume volume = containerData.getVolume();
FileChannel channel = null;
- boolean overwrite;
try {
channel = files.getChannel(chunkFile, doSyncWrite);
- overwrite = validateChunkForOverwrite(channel, info);
} catch (IOException e) {
onFailure(volume);
throw e;
}
+ // Read the block file length once and reuse it for the overwrite check,
+ // the offset validation and the space accounting below.
+ long fileLengthBeforeWrite;
+ try {
+ fileLengthBeforeWrite = channel.size();
+ } catch (IOException e) {
+ throw new StorageContainerException("Encountered an error while getting
the file size for "
+ + chunkFile.getName(), e, CONTAINER_INTERNAL_ERROR);
Review Comment:
Thanks @rich7420 for working on this. Could you explain why
`CONTAINER_INTERNAL_ERROR` is used as the result code here instead of the
original `CHUNK_FILE_INCONSISTENCY`?
--
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]