You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/02/11 17:03:50 UTC

[GitHub] [spark] dongjoon-hyun commented on a change in pull request #35493: [SPAPRK-38192][CORE][TESTS] Fix potential resource leak in `kvstore.RocksDBSuite`

dongjoon-hyun commented on a change in pull request #35493:
URL: https://github.com/apache/spark/pull/35493#discussion_r804843513



##########
File path: common/kvstore/src/test/java/org/apache/spark/util/kvstore/RocksDBSuite.java
##########
@@ -330,15 +330,16 @@ private int countKeys(Class<?> type) throws Exception {
     byte[] prefix = db.getTypeInfo(type).keyPrefix();
     int count = 0;
 
-    RocksIterator it = db.db().newIterator();
-    it.seek(prefix);
-
-    while (it.isValid()) {
-      byte[] key = it.key();
-      if (RocksDBIterator.startsWith(key, prefix)) {
-        count++;
+    try (RocksIterator it = db.db().newIterator()) {

Review comment:
       What about `LevelDBSuite`?




-- 
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: reviews-unsubscribe@spark.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org