rakeshadr commented on code in PR #10849:
URL: https://github.com/apache/ozone/pull/10849#discussion_r3649353606
##########
hadoop-ozone/cli-debug/src/test/java/org/apache/hadoop/ozone/debug/om/TestContainerToKeyMapping.java:
##########
@@ -189,6 +192,18 @@ public void
testContainerToKeyMappingWithMPUOnlyFileNames() {
assertThat(output).contains("/vol1/obs-bucket/mpuKey/test-upload-id");
}
+ @Test
+ public void testContainerToKeyMappingWithSplitSchemaMPU() {
+ int exitCode = execute("--containers", String.valueOf(CONTAINER_ID_4),
"--in-progress");
Review Comment:
Not a bug, but using a distinct `CONTAINER_ID_5` for the new tests would
make the split-schema test self-contained and easier to reason about in future.
`CONTAINER_ID_4` for both legacy and split MPU
`testContainerToKeyMappingWithSplitSchemaMPU`
##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestKeyLifecycleService.java:
##########
@@ -3340,4 +3350,111 @@ private OmMultipartInfo
createTestMultipartUpload(String volumeName, String buck
public static String uniqueObjectName(String prefix) {
return prefix + OBJECT_COUNTER.getAndIncrement();
}
+
+ @Test
+ public void testPartCountIoExceptionSkipsUploadContinuesBucket(@TempDir File
tempDir)
+ throws Exception {
+ OzoneConfiguration omConf = new OzoneConfiguration();
+ omConf.set(OZONE_OM_DB_DIRS, tempDir.getAbsolutePath());
+ OMMetadataManager omMetadataManager = new OmMetadataManagerImpl(omConf,
null);
+ try {
+ String uploadA = OMMultipartUploadUtils.getMultipartUploadId();
+ String uploadB = OMMultipartUploadUtils.getMultipartUploadId();
+ String uploadC = OMMultipartUploadUtils.getMultipartUploadId();
+
+ addSplitSchemaPart(omMetadataManager, uploadA, 1);
+ addSplitSchemaPart(omMetadataManager, uploadA, 2);
+ addSplitSchemaPart(omMetadataManager, uploadC, 1);
+
+ OMMetadataManager mockMM = Mockito.spy(omMetadataManager);
+ Table<OmMultipartPartKey, OmMultipartPartInfo> mockPartsTable =
+ Mockito.spy(omMetadataManager.getMultipartPartsTable());
+ when(mockMM.getMultipartPartsTable()).thenReturn(mockPartsTable);
+ when(mockPartsTable.iterator(eq(OmMultipartPartKey.prefix(uploadB))))
+ .thenThrow(new IOException("simulated corruption"));
+
+ assertEquals(2, OMMultipartUploadUtils.countParts(mockMM, uploadA));
+ assertThrows(IOException.class,
+ () -> OMMultipartUploadUtils.countParts(mockMM, uploadB));
+
+ KeyLifecycleService.PartCountLimitedList list =
+ new KeyLifecycleService.PartCountLimitedList(10);
+ for (String uploadId : Arrays.asList(uploadA, uploadB, uploadC)) {
+ try {
+ int partCount = OMMultipartUploadUtils.countParts(mockMM, uploadId);
+ list.add(new OmMultipartUpload("v", "b", "k", uploadId), partCount);
+ } catch (IOException e) {
+ // per-MPU skip — bucket loop continues
+ }
+ }
+ assertEquals(2, list.size());
Review Comment:
Can you please add comments to help maintainers.
```
// A (2 parts) and C (1 part) are added; B is skipped due to IOException
assertEquals(2, list.size()); // uploadA and uploadC only
assertEquals(3, list.getPartCount()); // 2 (uploadA) + 1 (uploadC)
```
--
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]