@ -1991,6 +1991,7 @@ bool BlockBasedTable::PrefixMayMatch(
template < class TBlockIter >
template < class TBlockIter >
void BlockBasedTableIterator < TBlockIter > : : Seek ( const Slice & target ) {
void BlockBasedTableIterator < TBlockIter > : : Seek ( const Slice & target ) {
is_out_of_bound_ = false ;
if ( ! CheckPrefixMayMatch ( target ) ) {
if ( ! CheckPrefixMayMatch ( target ) ) {
ResetDataIter ( ) ;
ResetDataIter ( ) ;
return ;
return ;
@ -2020,6 +2021,7 @@ void BlockBasedTableIterator<TBlockIter>::Seek(const Slice& target) {
template < class TBlockIter >
template < class TBlockIter >
void BlockBasedTableIterator < TBlockIter > : : SeekForPrev ( const Slice & target ) {
void BlockBasedTableIterator < TBlockIter > : : SeekForPrev ( const Slice & target ) {
is_out_of_bound_ = false ;
if ( ! CheckPrefixMayMatch ( target ) ) {
if ( ! CheckPrefixMayMatch ( target ) ) {
ResetDataIter ( ) ;
ResetDataIter ( ) ;
return ;
return ;
@ -2062,6 +2064,7 @@ void BlockBasedTableIterator<TBlockIter>::SeekForPrev(const Slice& target) {
template < class TBlockIter >
template < class TBlockIter >
void BlockBasedTableIterator < TBlockIter > : : SeekToFirst ( ) {
void BlockBasedTableIterator < TBlockIter > : : SeekToFirst ( ) {
is_out_of_bound_ = false ;
SavePrevIndexValue ( ) ;
SavePrevIndexValue ( ) ;
index_iter_ - > SeekToFirst ( ) ;
index_iter_ - > SeekToFirst ( ) ;
if ( ! index_iter_ - > Valid ( ) ) {
if ( ! index_iter_ - > Valid ( ) ) {
@ -2075,6 +2078,7 @@ void BlockBasedTableIterator<TBlockIter>::SeekToFirst() {
template < class TBlockIter >
template < class TBlockIter >
void BlockBasedTableIterator < TBlockIter > : : SeekToLast ( ) {
void BlockBasedTableIterator < TBlockIter > : : SeekToLast ( ) {
is_out_of_bound_ = false ;
SavePrevIndexValue ( ) ;
SavePrevIndexValue ( ) ;
index_iter_ - > SeekToLast ( ) ;
index_iter_ - > SeekToLast ( ) ;
if ( ! index_iter_ - > Valid ( ) ) {
if ( ! index_iter_ - > Valid ( ) ) {
@ -2153,7 +2157,7 @@ void BlockBasedTableIterator<TBlockIter>::InitDataBlock() {
template < class TBlockIter >
template < class TBlockIter >
void BlockBasedTableIterator < TBlockIter > : : FindKeyForward ( ) {
void BlockBasedTableIterator < TBlockIter > : : FindKeyForward ( ) {
is_out_of_bound_ = false ;
assert ( ! is_out_of_bound_ ) ;
// TODO the while loop inherits from two-level-iterator. We don't know
// TODO the while loop inherits from two-level-iterator. We don't know
// whether a block can be empty so it can be replaced by an "if".
// whether a block can be empty so it can be replaced by an "if".
while ( ! block_iter_ . Valid ( ) ) {
while ( ! block_iter_ . Valid ( ) ) {
@ -2193,6 +2197,7 @@ void BlockBasedTableIterator<TBlockIter>::FindKeyForward() {
template < class TBlockIter >
template < class TBlockIter >
void BlockBasedTableIterator < TBlockIter > : : FindKeyBackward ( ) {
void BlockBasedTableIterator < TBlockIter > : : FindKeyBackward ( ) {
assert ( ! is_out_of_bound_ ) ;
while ( ! block_iter_ . Valid ( ) ) {
while ( ! block_iter_ . Valid ( ) ) {
if ( ! block_iter_ . status ( ) . ok ( ) ) {
if ( ! block_iter_ . status ( ) . ok ( ) ) {
return ;
return ;