szetszwo commented on code in PR #4255:
URL: https://github.com/apache/ozone/pull/4255#discussion_r1106276701
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java:
##########
@@ -1411,33 +1415,49 @@ public List<OpenKeyBucket> getExpiredOpenKeys(Duration
expireThreshold,
final long expiredCreationTimestamp =
expireThreshold.negated().plusMillis(Time.now()).toMillis();
- OpenKey.Builder builder = OpenKey.newBuilder();
int num = 0;
while (num < count && keyValueTableIterator.hasNext()) {
KeyValue<String, OmKeyInfo> openKeyValue =
keyValueTableIterator.next();
String dbOpenKeyName = openKeyValue.getKey();
+
+ final int lastPrefix = dbOpenKeyName.lastIndexOf(OM_KEY_PREFIX);
+ final String dbKeyName = dbOpenKeyName.substring(0, lastPrefix);
OmKeyInfo openKeyInfo = openKeyValue.getValue();
if (openKeyInfo.getCreationTime() <= expiredCreationTimestamp) {
- final String volume = openKeyInfo.getVolumeName();
- final String bucket = openKeyInfo.getBucketName();
- final String mapKey = volume + OM_KEY_PREFIX + bucket;
- if (!expiredKeys.containsKey(mapKey)) {
- expiredKeys.put(mapKey,
- OpenKeyBucket.newBuilder()
- .setVolumeName(volume)
- .setBucketName(bucket));
+ final OmKeyInfo info = kt.get(dbKeyName);
+
+ if (info == null) {
+ // add non-hsync'ed keys
+ expiredKeys.addOpenKey(openKeyInfo, dbOpenKeyName);
+ } else {
+ // add hsync'ed keys
+ final KeyArgs.Builder keyArgs = KeyArgs.newBuilder()
Review Comment:
@sumitagrawl , thanks for taking a look! You are right that the `info`
obtained may be from a different key closed earlier.
We should put hsync client id in the hsync'ed key. Then, we can tell the
difference.
--
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]