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


##########
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/ozoneimpl/TestContainerReader.java:
##########
@@ -521,6 +546,13 @@ public void 
testMultipleContainerReader(ContainerTestVersionInfo versionInfo)
     
assertTrue(Files.exists(Paths.get(ec2.getContainerData().getContainerPath())));
     assertNotNull(containerSet.getContainer(3));
 
+    // For EC conflict with different replica index, one with matching db 
replica should exist
+    
assertTrue(Files.exists(Paths.get(ec3.getContainerData().getContainerPath())));
+    
assertTrue(!Files.exists(Paths.get(ec4.getContainerData().getContainerPath())));
+
+    
assertTrue(!Files.exists(Paths.get(ec5.getContainerData().getContainerPath())));

Review Comment:
   Use assertFalse() instead of assertTrue(!condition) for better readability 
and clearer failure messages.
   ```suggestion
       
assertFalse(Files.exists(Paths.get(ec5.getContainerData().getContainerPath())));
   ```



##########
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/ozoneimpl/TestContainerReader.java:
##########
@@ -521,6 +546,13 @@ public void 
testMultipleContainerReader(ContainerTestVersionInfo versionInfo)
     
assertTrue(Files.exists(Paths.get(ec2.getContainerData().getContainerPath())));
     assertNotNull(containerSet.getContainer(3));
 
+    // For EC conflict with different replica index, one with matching db 
replica should exist
+    
assertTrue(Files.exists(Paths.get(ec3.getContainerData().getContainerPath())));
+    
assertTrue(!Files.exists(Paths.get(ec4.getContainerData().getContainerPath())));
+
+    
assertTrue(!Files.exists(Paths.get(ec5.getContainerData().getContainerPath())));

Review Comment:
   Use assertFalse() instead of assertTrue(!condition) for better readability 
and clearer failure messages.
   ```suggestion
       
assertFalse(Files.exists(Paths.get(ec4.getContainerData().getContainerPath())));
   
       
assertFalse(Files.exists(Paths.get(ec5.getContainerData().getContainerPath())));
   ```



##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/metadata/ContainerCreateInfo.java:
##########
@@ -47,30 +48,37 @@ public static Codec<ContainerCreateInfo> getNewCodec() {
     return CODEC;
   }
 
-  private ContainerCreateInfo(ContainerProtos.ContainerDataProto.State state) {
+  private ContainerCreateInfo(ContainerProtos.ContainerDataProto.State state, 
int replicaIndex) {
     this.state = state;
+    this.replicaIndex = replicaIndex;
     this.proto = MemoizedSupplier.valueOf(
         () -> 
ContainerProtos.ContainerCreateInfo.newBuilder().setState(state).build());

Review Comment:
   The protobuf builder is not setting the replicaIndex field, which means the 
protobuf representation will always have the default value (-1) regardless of 
the actual replicaIndex value stored in the object.
   ```suggestion
           () -> ContainerProtos.ContainerCreateInfo.newBuilder()
               .setState(state)
               .setReplicaIndex(replicaIndex)
               .build());
   ```



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