Rocksdb: Potential problem in RocksDBSample.java according to the description on the wiki

Created on 17 May 2018  路  3Comments  路  Source: facebook/rocksdb

Expected behavior

According to the wiki https://github.com/facebook/rocksdb/wiki/Iterator#error-handling, people always need to call RocksIterator#status() after Seek(), Next(), SeekToFirst(), SeekToLast(), SeekForPrev(), and Prev(), even if Valid()=true.

Actual behavior

RocksIterator#status() is only used in a few loop, that is inconsistent with the description from the wiki.

(Additional, what is the best practice with using RocksIterator and the status()?)

java-api

Most helpful comment

@StefanRRichter I think the Wiki will have to be updated again after #3810

All 3 comments

@sihuazhou If the Wiki is correct, then it does indeed seem like RocksIterator#status() should be called more frequently.

However it seems like the behaviour might change again: https://github.com/facebook/rocksdb/pull/3810

@sagar0 Can you comment on whether that is the case?

If the wiki is actually correct, I would almost suggest that the Java API could automatically introduce the status check after all mentioned methods in RocksIterator. Otherwise this is super easy to overlook.

@StefanRRichter I think the Wiki will have to be updated again after #3810

Was this page helpful?
0 / 5 - 0 ratings