sadanand48 commented on code in PR #3964:
URL: https://github.com/apache/ozone/pull/3964#discussion_r1024196317
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java:
##########
@@ -1242,24 +1239,13 @@ public List<BlockGroup> getPendingDeletionKeys(final
int keyCount)
if (kv != null) {
RepeatedOmKeyInfo infoList = kv.getValue();
for (OmKeyInfo info : infoList.cloneOmKeyInfoList()) {
Review Comment:
for loop can be avoided here, we can use list.addAll() . currrentCount will
be size of the list.
##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestKeyDeletingService.java:
##########
@@ -274,9 +271,9 @@ public void checkDeletionForPartiallyCommitKey()
try {
return keyManager.getPendingDeletionKeys(Integer.MAX_VALUE)
.stream()
- .map(BlockGroup::getBlockIDList)
- .flatMap(Collection::stream)
- .collect(Collectors.toList()).size() == 3;
+ .mapToInt(e -> e.getKeyLocationVersions().stream()
+ .map(OmKeyLocationInfoGroup::getLocationList).
+ mapToInt(List::size).sum()).sum() == 3;
} catch (IOException e) {
Review Comment:
Can we also add a unit test to verify updation of the usedBytes and
namespace after key cleanup.
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyPurgeRequest.java:
##########
@@ -51,17 +54,28 @@ public OMClientResponse validateAndUpdateCache(OzoneManager
ozoneManager,
PurgeKeysRequest purgeKeysRequest = getOmRequest().getPurgeKeysRequest();
List<DeletedKeys> bucketDeletedKeysList = purgeKeysRequest
.getDeletedKeysList();
- List<String> keysToBePurgedList = new ArrayList<>();
+ List<Pair<OmBucketInfo, List<String>>> keysToBePurgedList
+ = new ArrayList<>();
OMResponse.Builder omResponse = OmResponseUtil.getOMResponseBuilder(
getOmRequest());
OMClientResponse omClientResponse = null;
+ OMMetadataManager omMetadataManager = ozoneManager.getMetadataManager();
for (DeletedKeys bucketWithDeleteKeys : bucketDeletedKeysList) {
+ String volumeName = bucketWithDeleteKeys.getVolumeName();
+ String bucketName = bucketWithDeleteKeys.getBucketName();
+ OmBucketInfo omBucketInfo = getBucketInfo(omMetadataManager, volumeName,
Review Comment:
Since we are updating bucketTable metadata here , bucket lock needs to be
acquired, else someone can delete the bucket.
--
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]