Copilot commented on code in PR #8887:
URL: https://github.com/apache/ozone/pull/8887#discussion_r2251895122


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/ozoneimpl/ContainerReader.java:
##########
@@ -261,6 +268,29 @@ public void verifyAndFixupContainerData(ContainerData 
containerData)
     }
   }
 
+  private boolean isMatchedLastLoadedECContainer(
+      KeyValueContainer kvContainer, WitnessedContainerMetadataStore 
containerMetadataStore) throws IOException {
+    if (null != containerMetadataStore && 
kvContainer.getContainerData().getReplicaIndex() != 0) {
+      ContainerCreateInfo containerCreateInfo = 
containerMetadataStore.getContainerCreateInfoTable()
+          
.get(ContainerID.valueOf(kvContainer.getContainerData().getContainerID()));
+      // check for EC container replica index matching if db entry is present 
for container as last loaded,
+      // and delete if not matched, ignoring replica index -1 as no previous 
replica index information
+      if (null != containerCreateInfo && containerCreateInfo.getReplicaIndex() 
>= 0

Review Comment:
   The magic number -1 is used to indicate 'no previous replica index 
information' but should be defined as a constant (e.g., NO_REPLICA_INDEX) to 
improve code readability and maintainability.
   ```suggestion
         if (null != containerCreateInfo && 
containerCreateInfo.getReplicaIndex() != NO_REPLICA_INDEX
   ```



##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/ozoneimpl/ContainerReader.java:
##########
@@ -261,6 +268,29 @@ public void verifyAndFixupContainerData(ContainerData 
containerData)
     }
   }
 
+  private boolean isMatchedLastLoadedECContainer(
+      KeyValueContainer kvContainer, WitnessedContainerMetadataStore 
containerMetadataStore) throws IOException {
+    if (null != containerMetadataStore && 
kvContainer.getContainerData().getReplicaIndex() != 0) {

Review Comment:
   The condition checks for replica index != 0 to identify EC containers, but 
this magic number should be documented or extracted to a constant to clarify 
that 0 represents non-EC containers.
   ```suggestion
       if (null != containerMetadataStore && 
kvContainer.getContainerData().getReplicaIndex() != 
NON_EC_CONTAINER_REPLICA_INDEX) {
   ```



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