Update comments of WriteBatchWithIndex

Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/4113

Differential Revision: D8814172

Pulled By: siying

fbshipit-source-id: cabc31db2c74803af9b2f99329155a1086eb1b22
This commit is contained in:
Siying Dong 2018-07-11 17:31:55 -07:00 committed by Facebook Github Bot
parent 5cd8240b86
commit 35b38a232c
2 changed files with 12 additions and 0 deletions

View file

@ -155,6 +155,12 @@ class WriteBatchWithIndex : public WriteBatchBase {
// The returned iterator should be deleted by the caller. // The returned iterator should be deleted by the caller.
// The base_iterator is now 'owned' by the returned iterator. Deleting the // The base_iterator is now 'owned' by the returned iterator. Deleting the
// returned iterator will also delete the base_iterator. // returned iterator will also delete the base_iterator.
//
// Updating write batch with the current key of the iterator is not safe.
// We strongly recommand users not to do it. It will invalidate the current
// key() and value() of the iterator. This invalidation happens even before
// the write batch update finishes. The state may recover after Next() is
// called.
Iterator* NewIteratorWithBase(ColumnFamilyHandle* column_family, Iterator* NewIteratorWithBase(ColumnFamilyHandle* column_family,
Iterator* base_iterator); Iterator* base_iterator);
// default column family // default column family

View file

@ -114,6 +114,12 @@ public class WriteBatchWithIndex extends AbstractWriteBatch {
* creating a new Iterator that will use {@link org.rocksdb.WBWIRocksIterator} * creating a new Iterator that will use {@link org.rocksdb.WBWIRocksIterator}
* as a delta and baseIterator as a base * as a delta and baseIterator as a base
* *
* Updating write batch with the current key of the iterator is not safe.
* We strongly recommand users not to do it. It will invalidate the current
* key() and value() of the iterator. This invalidation happens even before
* the write batch update finishes. The state may recover after Next() is
* called.
*
* @param columnFamilyHandle The column family to iterate over * @param columnFamilyHandle The column family to iterate over
* @param baseIterator The base iterator, * @param baseIterator The base iterator,
* e.g. {@link org.rocksdb.RocksDB#newIterator()} * e.g. {@link org.rocksdb.RocksDB#newIterator()}