Skip to content

Commit

Permalink
HDDS-10241. Improve the response for the Deleted Directories Insight …
Browse files Browse the repository at this point in the history
…Endpoint. (apache#6124)
  • Loading branch information
ArafatKhan2198 authored Jan 31, 2024
1 parent b3e8069 commit c9847df
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import java.util.List;
import java.util.Map;

import static org.apache.hadoop.ozone.OzoneConsts.OM_KEY_PREFIX;
import static org.apache.hadoop.ozone.om.OmMetadataManagerImpl.OPEN_FILE_TABLE;
import static org.apache.hadoop.ozone.om.OmMetadataManagerImpl.OPEN_KEY_TABLE;
import static org.apache.hadoop.ozone.om.OmMetadataManagerImpl.DELETED_TABLE;
Expand Down Expand Up @@ -536,8 +537,8 @@ private void getPendingForDeletionDirInfo(
continue;
}
KeyEntityInfo keyEntityInfo = new KeyEntityInfo();
keyEntityInfo.setKey(key);
keyEntityInfo.setPath(omKeyInfo.getKeyName());
keyEntityInfo.setKey(omKeyInfo.getFileName());
keyEntityInfo.setPath(createPath(omKeyInfo));
keyEntityInfo.setInStateSince(omKeyInfo.getCreationTime());
keyEntityInfo.setSize(
fetchSizeForDeletedDirectory(omKeyInfo.getObjectID()));
Expand Down Expand Up @@ -664,6 +665,12 @@ private void updateReplicatedAndUnReplicatedTotal(
});
}

private String createPath(OmKeyInfo omKeyInfo) {
return omKeyInfo.getVolumeName() + OM_KEY_PREFIX +
omKeyInfo.getBucketName() + OM_KEY_PREFIX + omKeyInfo.getKeyName();
}


@VisibleForTesting
public GlobalStatsDao getDao() {
return this.globalStatsDao;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ public void testGetDeletedDirInfoLimitParam() throws Exception {
assertNotNull(keyInsightInfoResp);
assertEquals(2,
keyInsightInfoResp.getDeletedDirInfoList().size());
assertEquals("/sampleVol/bucketOne/dir_one",
assertEquals("dir_one",
keyInsightInfoResp.getDeletedDirInfoList().get(0).getKey());
}

Expand Down Expand Up @@ -696,7 +696,7 @@ public void testGetDeletedDirInfoPrevKeyParam() throws Exception {
assertNotNull(keyInsightInfoResp);
assertEquals(2,
keyInsightInfoResp.getDeletedDirInfoList().size());
assertEquals("/sampleVol/bucketOne/dir_three",
assertEquals("dir_three",
keyInsightInfoResp.getDeletedDirInfoList().get(0).getKey());
assertEquals("/sampleVol/bucketOne/dir_two",
keyInsightInfoResp.getLastKey());
Expand Down Expand Up @@ -729,7 +729,9 @@ public void testGetDeletedDirInfo() throws Exception {
assertNotNull(keyInsightInfoResp);
assertEquals(3,
keyInsightInfoResp.getDeletedDirInfoList().size());
assertEquals("/sampleVol/bucketOne/dir_one",
assertEquals("sampleVol/bucketOne/dir_one", keyInsightInfoResp
.getDeletedDirInfoList().get(0).getPath());
assertEquals("dir_one",
keyInsightInfoResp.getDeletedDirInfoList().get(0).getKey());
assertEquals("/sampleVol/bucketOne/dir_two",
keyInsightInfoResp.getLastKey());
Expand Down

0 comments on commit c9847df

Please sign in to comment.