ivandika3 commented on code in PR #8909:
URL: https://github.com/apache/ozone/pull/8909#discussion_r2282513671
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/KeyLifecycleService.java:
##########
@@ -339,47 +333,54 @@ private void evaluateFSOBucket(OmVolumeArgs volume,
OmBucketInfo bucket, String
continue;
}
// use last directory's object ID to iterate the keys
- String prefix = OzoneConsts.OM_KEY_PREFIX + volume.getObjectID() +
- OzoneConsts.OM_KEY_PREFIX + bucket.getObjectID() +
OzoneConsts.OM_KEY_PREFIX;
+ String prefix = OM_KEY_PREFIX + volume.getObjectID() +
+ OM_KEY_PREFIX + bucket.getObjectID() + OM_KEY_PREFIX;
StringBuffer directoryPath = new StringBuffer();
if (!dirList.isEmpty()) {
prefix += dirList.get(dirList.size() - 1).getObjectID();
Review Comment:
Nit: Let's make a new variable for `dirList.get(dirList.size() - 1)` (e.g.
`lastDirectory`) to improve readability.
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/KeyLifecycleService.java:
##########
@@ -339,47 +333,54 @@ private void evaluateFSOBucket(OmVolumeArgs volume,
OmBucketInfo bucket, String
continue;
}
// use last directory's object ID to iterate the keys
- String prefix = OzoneConsts.OM_KEY_PREFIX + volume.getObjectID() +
- OzoneConsts.OM_KEY_PREFIX + bucket.getObjectID() +
OzoneConsts.OM_KEY_PREFIX;
+ String prefix = OM_KEY_PREFIX + volume.getObjectID() +
+ OM_KEY_PREFIX + bucket.getObjectID() + OM_KEY_PREFIX;
StringBuffer directoryPath = new StringBuffer();
if (!dirList.isEmpty()) {
prefix += dirList.get(dirList.size() - 1).getObjectID();
for (OmDirectoryInfo dir : dirList) {
-
directoryPath.append(dir.getName()).append(OzoneConsts.OM_KEY_PREFIX);
+ directoryPath.append(dir.getName()).append(OM_KEY_PREFIX);
}
- if (directoryPath.toString().equals(rule.getEffectivePrefix() +
OzoneConsts.OM_KEY_PREFIX)) {
- expiredDirList.add(directoryPath.toString());
- expiredDirUpdateIDList.add(dirList.get(dirList.size() -
1).getUpdateID());
+ if (directoryPath.toString().equals(rule.getEffectivePrefix() +
OM_KEY_PREFIX)) {
+ if (!expiredDirList.add(directoryPath.toString(),
dirList.get(dirList.size() - 1).getUpdateID())) {
Review Comment:
Can I check why we are adding this `directoryPath` without checking whether
it matches the rule (i.e. directory is expired)? Furthermore, what is the
difference between the logic here and `evaluateDirTable`?
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/KeyLifecycleService.java:
##########
@@ -339,47 +333,54 @@ private void evaluateFSOBucket(OmVolumeArgs volume,
OmBucketInfo bucket, String
continue;
}
// use last directory's object ID to iterate the keys
- String prefix = OzoneConsts.OM_KEY_PREFIX + volume.getObjectID() +
- OzoneConsts.OM_KEY_PREFIX + bucket.getObjectID() +
OzoneConsts.OM_KEY_PREFIX;
+ String prefix = OM_KEY_PREFIX + volume.getObjectID() +
+ OM_KEY_PREFIX + bucket.getObjectID() + OM_KEY_PREFIX;
StringBuffer directoryPath = new StringBuffer();
if (!dirList.isEmpty()) {
prefix += dirList.get(dirList.size() - 1).getObjectID();
for (OmDirectoryInfo dir : dirList) {
-
directoryPath.append(dir.getName()).append(OzoneConsts.OM_KEY_PREFIX);
+ directoryPath.append(dir.getName()).append(OM_KEY_PREFIX);
}
- if (directoryPath.toString().equals(rule.getEffectivePrefix() +
OzoneConsts.OM_KEY_PREFIX)) {
- expiredDirList.add(directoryPath.toString());
- expiredDirUpdateIDList.add(dirList.get(dirList.size() -
1).getUpdateID());
+ if (directoryPath.toString().equals(rule.getEffectivePrefix() +
OM_KEY_PREFIX)) {
+ if (!expiredDirList.add(directoryPath.toString(),
dirList.get(dirList.size() - 1).getUpdateID())) {
+ // if expiredDirList is full, send delete request for pending
deletion directories
+ sendDeleteKeysRequestAndClearList(volume.getVolume(),
bucket.getBucketName(),
+ expiredDirList, true);
+ expiredDirList.add(directoryPath.toString(),
dirList.get(dirList.size() - 1).getUpdateID());
+ }
}
}
LOG.info("Prefix {} for {}", prefix, bucketKey);
- evaluateKeyTable(keyTable, prefix, directoryPath.toString(), rule,
expiredKeyList,
- expiredKeyUpdateIDList, bucketKey);
evaluateDirTable(directoryInfoTable, prefix, directoryPath.toString(),
rule,
- expiredDirList, expiredDirUpdateIDList, bucketKey);
+ expiredDirList, bucket);
+ evaluateKeyTable(keyTable, prefix, directoryPath.toString(), rule,
expiredKeyList, bucket);
Review Comment:
Can I check the reason in switching the order of evaluation? From my
understanding, we should remove the keys first before the files to prevent
orphaned keys.
--
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]