devmadhuu commented on code in PR #11223:
URL: https://github.com/apache/ozone/pull/11223#discussion_r3986566449


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueHandler.java:
##########
@@ -692,6 +692,12 @@ ContainerCommandResponseProto handlePutBlock(
       ContainerProtos.BlockData data = request.getPutBlock().getBlockData();
       BlockData blockData = BlockData.getFromProtoBuf(data);
       Objects.requireNonNull(blockData, "blockData == null");
+      Objects.requireNonNull(blockData.getBlockID());
+      if (blockData.getBlockID().getStorageType() != null
+          && kvContainer.getContainerData().getStorageType() != null) {
+        Preconditions.checkArgument(blockData.getBlockID().getStorageType() ==

Review Comment:
   I think , the mismatch is enforced with `Preconditions.checkArgument` which 
throws `IllegalArgumentException`. That method's try/catch doesn't catch it, so 
it bubbles up to `handle()'s` `catch (RuntimeException) `and becomes 
`CONTAINER_INTERNAL_ERROR`. Since that result isn't in `canIgnoreException()`, 
the container gets marked `UNHEALTHY` (and re-replicated).



##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/impl/BlockManagerImpl.java:
##########
@@ -187,6 +187,11 @@ public long persistPutBlock(KeyValueContainer container,
     Objects.requireNonNull(data, "data == null");
     Preconditions.checkState(data.getContainerID() >= 0, "Container Id " +
         "cannot be negative");
+    if (data.getBlockID().getStorageType() != null
+        && container.getContainerData().getStorageType() != null) {
+      Preconditions.checkArgument(data.getBlockID().getStorageType() ==

Review Comment:
   same issue here.



##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueHandler.java:
##########
@@ -1114,6 +1120,11 @@ ContainerCommandResponseProto handleWriteChunk(
 
       WriteChunkRequestProto writeChunk = request.getWriteChunk();
       BlockID blockID = BlockID.getFromProtobuf(writeChunk.getBlockID());
+      if (blockID.getStorageType() != null
+          && kvContainer.getContainerData().getStorageType() != null) {
+        Preconditions.checkArgument(blockID.getStorageType() ==

Review Comment:
   same comment as above here also.



-- 
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