smengcl commented on a change in pull request #2463:
URL: https://github.com/apache/ozone/pull/2463#discussion_r677896200
##########
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:
Under what conditions could this be violated?
--
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]