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


##########
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:
   Thanks @xichen01, I have a small quesiton.
   Could this cause a healthy container to be marked unhealthy when the storage 
types differ? 
   Because [checkArgument throws IllegalArgumentException when the condition is 
false](https://github.com/google/guava/blob/de1d87eabff93cb4a7fa8e52df5fc46802c95b17/guava/src/com/google/common/base/Preconditions.java#L119-L129),
 and [IllegalArgumentException extends 
RuntimeException](https://github.com/openjdk/jdk/blob/jdk-17-ga/src/java.base/share/classes/java/lang/IllegalArgumentException.java#L31-L34).
 [KeyValueHandler.handle() wraps RuntimeException as 
CONTAINER_INTERNAL_ERROR](https://github.com/apache/ozone/blob/0b9d22c9f830742ca25cd786b8a8c8c204db8bde/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueHandler.java#L313-L326),
 which is not ignored by 
[HddsDispatcher](https://github.com/apache/ozone/blob/0b9d22c9f830742ca25cd786b8a8c8c204db8bde/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/HddsDispatcher.java#L172-L186)
 when deciding whether to [mark the container unhealthy](https://github.co
 
m/apache/ozone/blob/0b9d22c9f830742ca25cd786b8a8c8c204db8bde/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/HddsDispatcher.java#L406-L435).



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