Copilot commented on code in PR #11386:
URL: https://github.com/apache/ozone/pull/11386#discussion_r4167433147
##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestQuotaRepairTask.java:
##########
@@ -355,6 +358,95 @@ public void testQuotaRepairSnapshotDbDeletedTableQuota()
throws Exception {
assertEquals(1, repaired.getSnapshotUsedNamespace());
}
+ @Test
+ public void testQuotaRepairCountsDeletedDirectories() throws Exception {
+ AtomicReference<OzoneManagerProtocolProtos.OMRequest> request =
mockQuotaRepairRequest();
+ OMRequestTestUtils.addVolumeAndBucketToDB(volumeName, bucketName,
+ omMetadataManager, BucketLayout.FILE_SYSTEM_OPTIMIZED);
+ long volumeId = omMetadataManager.getVolumeId(volumeName);
+ long bucketId = omMetadataManager.getBucketTable()
+ .get(omMetadataManager.getBucketKey(volumeName,
bucketName)).getObjectID();
+
+ int dirs = 3;
+ for (int i = 0; i < dirs; i++) {
+ String dirName = "dir" + i;
+ long objectId = 100L + i;
+ OmKeyInfo dirInfo = OMRequestTestUtils.createOmKeyInfo(volumeName,
bucketName, dirName, RATIS_ONE)
+ .setObjectID(objectId).setParentObjectID(bucketId).build();
+
omMetadataManager.getDeletedDirTable().put(omMetadataManager.getOzoneDeletePathKey(objectId,
+ omMetadataManager.getOzonePathKey(volumeId, bucketId, bucketId,
dirName)), dirInfo);
+ }
Review Comment:
This test only writes valid `OmKeyInfo` values, so it still passes if the
scan starts decoding values again and does not cover the promised tolerance for
corrupt `deletedDirectoryTable` values. Store one row through the raw table
with an undecodable value and verify it is still counted.
--
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]