sadanand48 commented on a change in pull request #2463:
URL: https://github.com/apache/ozone/pull/2463#discussion_r680680029
##########
File path:
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueHandler.java
##########
@@ -427,6 +429,17 @@ ContainerCommandResponseProto handlePutBlock(
ContainerProtos.BlockData data = request.getPutBlock().getBlockData();
BlockData blockData = BlockData.getFromProtoBuf(data);
Preconditions.checkNotNull(blockData);
+ ChunkLayOutVersion layoutVersion =
+ ChunkLayOutVersion.getConfiguredVersion(conf);
+ if (layoutVersion == FILE_PER_BLOCK) {
+ File blockFile = layoutVersion
+ .getChunkFile(kvContainer.getContainerData(),
+ blockData.getBlockID(), null);
+ // ensure that the putBlock length <= blockFile length
+ Preconditions.checkArgument(blockFile.length() >= blockData.getSize(),
Review comment:
@smengcl This is just a safety check. The ozone streaming write path
will not use the current ratisAsyncApi which ensures sequential transactions
i.e putBlock would always occur after writeChunk. To be on a safer side, this
check is added. We may remove this after the complete streaming implementation
if this check is redundant
cc : @mukul1987
--
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]