From 35d8e65a04138a922ccd01697900c9931d31d80f Mon Sep 17 00:00:00 2001 From: Yi Wu Date: Tue, 23 Jan 2018 16:06:18 -0800 Subject: [PATCH] Make Iterator::SeekForPrev pure virtual Summary: To prevent user who implement the Iterator interface fail to implement SeekForPrev by mistake. Closes https://github.com/facebook/rocksdb/pull/3402 Differential Revision: D6790681 Pulled By: yiwu-arbug fbshipit-source-id: bd75b8ced30208982e0a1414d34384d93496827a --- HISTORY.md | 2 ++ include/rocksdb/iterator.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index baf4961dab..7a183d654b 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,7 @@ # Rocksdb Change Log ## Unreleased +### Public API Change +* Iterator::SeekForPrev is now a pure virtual method. This is to prevent user who implement the Iterator interface fail to implement SeekForPrev by mistake. ### Bug Fixes * Fix `DisableFileDeletions()` followed by `GetSortedWalFiles()` to not return obsolete WAL files that `PurgeObsoleteFiles()` is going to delete. * Fix DB::Flush() keep waiting after flush finish under certain condition. diff --git a/include/rocksdb/iterator.h b/include/rocksdb/iterator.h index d4ac528181..e3e4f7ce7d 100644 --- a/include/rocksdb/iterator.h +++ b/include/rocksdb/iterator.h @@ -51,7 +51,7 @@ class Iterator : public Cleanable { // Position at the last key in the source that at or before target // The iterator is Valid() after this call iff the source contains // an entry that comes at or before target. - virtual void SeekForPrev(const Slice& target) {} + virtual void SeekForPrev(const Slice& target) = 0; // Moves to the next entry in the source. After this call, Valid() is // true iff the iterator was not positioned at the last entry in the source.