summaryrefslogtreecommitdiff
path: root/db/db_iter.cc
diff options
context:
space:
mode:
authorgabor@google.com <gabor@google.com@62dab493-f737-651d-591e-8d6aee1b9529>2011-08-16 01:21:01 +0000
committergabor@google.com <gabor@google.com@62dab493-f737-651d-591e-8d6aee1b9529>2011-08-16 01:21:01 +0000
commitab323f7e1ec53749653967e7d6a2fa1c922334f2 (patch)
treebc6b5343550f7fad533dabd36452544d8bfb5a14 /db/db_iter.cc
parenta05525d13beea3ae56d979fa5fffa9de3652db61 (diff)
downloadleveldb-ab323f7e1ec53749653967e7d6a2fa1c922334f2.tar.gz
Bugfixes for iterator and documentation.
- Fix bug in Iterator::Prev where it would return the wrong key. Fixes issues 29 and 30. - Added a tweak to testharness to allow running just some tests. - Fixing two minor documentation errors based on issues 28 and 25. - Cleanup; fix namespaces of export-to-C code. Also fix one "const char*" vs "char*" mismatch. git-svn-id: https://leveldb.googlecode.com/svn/trunk@48 62dab493-f737-651d-591e-8d6aee1b9529
Diffstat (limited to 'db/db_iter.cc')
-rw-r--r--db/db_iter.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/db/db_iter.cc b/db/db_iter.cc
index 0be18ff..8849f92 100644
--- a/db/db_iter.cc
+++ b/db/db_iter.cc
@@ -216,7 +216,6 @@ void DBIter::FindPrevUserEntry() {
ValueType value_type = kTypeDeletion;
if (iter_->Valid()) {
- SaveKey(ExtractUserKey(iter_->key()), &saved_key_);
do {
ParsedInternalKey ikey;
if (ParseKey(&ikey) && ikey.sequence <= sequence_) {
@@ -227,6 +226,7 @@ void DBIter::FindPrevUserEntry() {
}
value_type = ikey.type;
if (value_type == kTypeDeletion) {
+ saved_key_.clear();
ClearSavedValue();
} else {
Slice raw_value = iter_->value();
@@ -234,6 +234,7 @@ void DBIter::FindPrevUserEntry() {
std::string empty;
swap(empty, saved_value_);
}
+ SaveKey(ExtractUserKey(iter_->key()), &saved_key_);
saved_value_.assign(raw_value.data(), raw_value.size());
}
}