You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "neils-dev (via GitHub)" <gi...@apache.org> on 2023/03/28 01:03:57 UTC

[GitHub] [ozone] neils-dev commented on a diff in pull request #4468: HDDS-8257. RocksIterator not closed properly in LegacyBucketHandler

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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org