LuciferYang commented on code in PR #37471:
URL: https://github.com/apache/spark/pull/37471#discussion_r943025451


##########
common/kvstore/src/main/java/org/apache/spark/util/kvstore/LevelDBIterator.java:
##########
@@ -189,6 +189,7 @@ public synchronized void close() throws IOException {
     if (!closed) {
       it.close();
       closed = true;
+      next = null;

Review Comment:
   ```
   KVStoreIterator<CustomType1> iter =
         db.view(CustomType1.class).closeableIterator();
       // iter should be true
       assertTrue(iter.hasNext());
       // close iter
       iter.close();
       assertFalse(iter.skip(0));
       assertFalse(iter.skip(1));
   ```
   I test rocksdb as above:
   
   - `skip(0)` returning false, looks right
   - `skip(1)`  or `skip(n)` thrown Exception instead of returning false now:
   
   ```
   java.lang.AssertionError
        at 
org.rocksdb.AbstractRocksIterator.isValid(AbstractRocksIterator.java:41)
        at 
org.apache.spark.util.kvstore.RocksDBIterator.skip(RocksDBIterator.java:164)
        at 
org.apache.spark.util.kvstore.RocksDBSuite.testSkipAfterIteratorClose(RocksDBSuite.java:376)
   ```
   
   
   



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