LuciferYang commented on a change in pull request #35493: URL: https://github.com/apache/spark/pull/35493#discussion_r805095956
########## 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: There is also this potential risk. Let me fix it together -- 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-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org