neils-dev commented on code in PR #4468:
URL: https://github.com/apache/ozone/pull/4468#discussion_r1149923217


##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/handlers/LegacyBucketHandler.java:
##########
@@ -141,31 +139,34 @@ public long calculateDUUnderObject(long parentId)
     }
 
     String[] seekKeys = seekPrefix.split(OM_KEY_PREFIX);
-    iterator.seek(seekPrefix);
-    // handle direct keys
-    while (iterator.hasNext()) {
-      Table.KeyValue<String, OmKeyInfo> kv = iterator.next();
-      String dbKey = kv.getKey();
-      // since the RocksDB is ordered, seek until the prefix isn't matched
-      if (!dbKey.startsWith(seekPrefix)) {
-        break;
-      }
+    try (TableIterator<String, ? extends Table.KeyValue<String, OmKeyInfo>>
+             iterator = keyTable.iterator()) {

Review Comment:
   Thanks @adoroszlai for finding and fixing the unclosed rocksdb iterator 
here.  Does this problem potentially exist in other parts of the file - should 
the iterators used in this class be re-written as well? 
   
   +1



-- 
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]

Reply via email to