Skip to content

Commit

Permalink
Fix regression failure in PrefixTest.PrefixValid
Browse files Browse the repository at this point in the history
Summary: Use IterKey to store prefix_start_ so that it doesn't get freed

Test Plan: PrefixTest.PrefixValid

Reviewers: anthony, IslamAbdelRahman

Reviewed By: IslamAbdelRahman

Subscribers: dhruba

Differential Revision: https://reviews.facebook.net/D50289
  • Loading branch information
rven1 committed Nov 6, 2015
1 parent c8e01ef commit ae7940b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions db/db_iter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class DBIter: public Iterator {
Statistics* statistics_;
uint64_t max_skip_;
const Slice* iterate_upper_bound_;
Slice prefix_start_;
IterKey prefix_start_;
bool prefix_same_as_start_;

// No copying allowed
Expand Down Expand Up @@ -203,7 +203,7 @@ void DBIter::Next() {
}
if (valid_ && prefix_extractor_ && prefix_same_as_start_ &&
prefix_extractor_->Transform(saved_key_.GetKey())
.compare(prefix_start_) != 0) {
.compare(prefix_start_.GetKey()) != 0) {
valid_ = false;
}
}
Expand Down Expand Up @@ -378,7 +378,7 @@ void DBIter::Prev() {
}
if (valid_ && prefix_extractor_ && prefix_same_as_start_ &&
prefix_extractor_->Transform(saved_key_.GetKey())
.compare(prefix_start_) != 0) {
.compare(prefix_start_.GetKey()) != 0) {
valid_ = false;
}
}
Expand Down Expand Up @@ -683,7 +683,7 @@ void DBIter::Seek(const Slice& target) {
valid_ = false;
}
if (valid_ && prefix_extractor_ && prefix_same_as_start_) {
prefix_start_ = prefix_extractor_->Transform(target);
prefix_start_.SetKey(prefix_extractor_->Transform(target));
}
}

Expand Down Expand Up @@ -714,7 +714,7 @@ void DBIter::SeekToFirst() {
valid_ = false;
}
if (valid_ && prefix_extractor_ && prefix_same_as_start_) {
prefix_start_ = prefix_extractor_->Transform(saved_key_.GetKey());
prefix_start_.SetKey(prefix_extractor_->Transform(saved_key_.GetKey()));
}
}

Expand Down Expand Up @@ -762,7 +762,7 @@ void DBIter::SeekToLast() {
}
}
if (valid_ && prefix_extractor_ && prefix_same_as_start_) {
prefix_start_ = prefix_extractor_->Transform(saved_key_.GetKey());
prefix_start_.SetKey(prefix_extractor_->Transform(saved_key_.GetKey()));
}
}

Expand Down

0 comments on commit ae7940b

Please sign in to comment.