Russole commented on code in PR #12190:
URL: https://github.com/apache/ozone/pull/12190#discussion_r4741528384


##########
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueHandler.java:
##########
@@ -891,6 +892,28 @@ public void 
testContainerChecksumInvocation(ContainerLayoutVersion layoutVersion
     Assertions.assertEquals(1, icrCount.get());
   }
 
+  @ParameterizedTest
+  @EnumSource(value = ContainerLayoutVersion.class, names = {"FILE_PER_CHUNK", 
"FILE_PER_BLOCK"})
+  public void 
testDeleteUnreferencedPreservesOtherBlocks(ContainerLayoutVersion 
layoutVersion) throws Exception {
+    KeyValueHandler keyValueHandler = new KeyValueHandler(conf,
+        DATANODE_UUID, newContainerSet(), mock(MutableVolumeSet.class),
+        mock(ContainerMetrics.class), c -> { },
+        new ContainerChecksumTreeManager(conf));
+    Path chunkDir = Files.createDirectory(tempDir.resolve("chunks"));
+    Path target = 
Files.createFile(chunkDir.resolve(getUnreferencedChunkName(layoutVersion, 1L)));
+    Path other = 
Files.createFile(chunkDir.resolve(getUnreferencedChunkName(layoutVersion, 2L)));

Review Comment:
   Could we use `1.block.extra` instead of `2.block` for the `FILE_PER_BLOCK` 
case? The old prefix matching would also preserve `2.block`, so the current 
test doesn't verify the exact-filename behavior described in this PR. Using 
`1.block.extra` would cover that change.



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