@ -546,8 +546,7 @@ bool DBIter::MergeValuesNewToOld() {
// hit a put, merge the put value with operands and store the
// final result in saved_value_. We are done!
const Slice val = iter_ . value ( ) ;
Status s = Merge ( & val , ikey . user_key ) ;
if ( ! s . ok ( ) ) {
if ( ! Merge ( & val , ikey . user_key ) ) {
return false ;
}
// iter_ is positioned after put
@ -576,8 +575,7 @@ bool DBIter::MergeValuesNewToOld() {
return false ;
}
valid_ = true ;
Status s = Merge ( & blob_value_ , ikey . user_key ) ;
if ( ! s . ok ( ) ) {
if ( ! Merge ( & blob_value_ , ikey . user_key ) ) {
return false ;
}
@ -591,11 +589,18 @@ bool DBIter::MergeValuesNewToOld() {
}
return true ;
} else if ( kTypeWideColumnEntity = = ikey . type ) {
// TODO: support wide-column entities
status_ = Status : : NotSupported (
" Merge currently not supported for wide-column entities " ) ;
valid_ = false ;
return false ;
if ( ! MergeEntity ( iter_ . value ( ) , ikey . user_key ) ) {
return false ;
}
// iter_ is positioned after put
iter_ . Next ( ) ;
if ( ! iter_ . status ( ) . ok ( ) ) {
valid_ = false ;
return false ;
}
return true ;
} else {
valid_ = false ;
status_ = Status : : Corruption (
@ -614,8 +619,7 @@ bool DBIter::MergeValuesNewToOld() {
// a deletion marker.
// feed null as the existing value to the merge operator, such that
// client can differentiate this scenario and do things accordingly.
Status s = Merge ( nullptr , saved_key_ . GetUserKey ( ) ) ;
if ( ! s . ok ( ) ) {
if ( ! Merge ( nullptr , saved_key_ . GetUserKey ( ) ) ) {
return false ;
}
assert ( status_ . ok ( ) ) ;
@ -964,8 +968,7 @@ bool DBIter::FindValueForCurrentKey() {
if ( last_not_merge_type = = kTypeDeletion | |
last_not_merge_type = = kTypeSingleDeletion | |
last_not_merge_type = = kTypeDeletionWithTimestamp ) {
s = Merge ( nullptr , saved_key_ . GetUserKey ( ) ) ;
if ( ! s . ok ( ) ) {
if ( ! Merge ( nullptr , saved_key_ . GetUserKey ( ) ) ) {
return false ;
}
return true ;
@ -980,8 +983,7 @@ bool DBIter::FindValueForCurrentKey() {
return false ;
}
valid_ = true ;
s = Merge ( & blob_value_ , saved_key_ . GetUserKey ( ) ) ;
if ( ! s . ok ( ) ) {
if ( ! Merge ( & blob_value_ , saved_key_ . GetUserKey ( ) ) ) {
return false ;
}
@ -989,15 +991,14 @@ bool DBIter::FindValueForCurrentKey() {
return true ;
} else if ( last_not_merge_type = = kTypeWideColumnEntity ) {
// TODO: support wide-column entities
status_ = Status : : NotSupported (
" Merge currently not supported for wide-column entities " ) ;
valid_ = false ;
return fals e;
if ( ! MergeEntity ( pinned_value_ , saved_key_ . GetUserKey ( ) ) ) {
return false ;
}
return tru e;
} else {
assert ( last_not_merge_type = = kTypeValue ) ;
s = Merge ( & pinned_value_ , saved_key_ . GetUserKey ( ) ) ;
if ( ! s . ok ( ) ) {
if ( ! Merge ( & pinned_value_ , saved_key_ . GetUserKey ( ) ) ) {
return false ;
}
return true ;
@ -1181,8 +1182,7 @@ bool DBIter::FindValueForCurrentKeyUsingSeek() {
if ( ikey . type = = kTypeValue ) {
const Slice val = iter_ . value ( ) ;
Status s = Merge ( & val , saved_key_ . GetUserKey ( ) ) ;
if ( ! s . ok ( ) ) {
if ( ! Merge ( & val , saved_key_ . GetUserKey ( ) ) ) {
return false ;
}
return true ;
@ -1201,8 +1201,7 @@ bool DBIter::FindValueForCurrentKeyUsingSeek() {
return false ;
}
valid_ = true ;
Status s = Merge ( & blob_value_ , saved_key_ . GetUserKey ( ) ) ;
if ( ! s . ok ( ) ) {
if ( ! Merge ( & blob_value_ , saved_key_ . GetUserKey ( ) ) ) {
return false ;
}
@ -1210,11 +1209,11 @@ bool DBIter::FindValueForCurrentKeyUsingSeek() {
return true ;
} else if ( ikey . type = = kTypeWideColumnEntity ) {
// TODO: support wide-column entities
status_ = Status : : NotSupported (
" Merge currently not supported for wide-column entities " ) ;
valid_ = false ;
return fals e;
if ( ! MergeEntity ( iter_ . value ( ) , saved_key_ . GetUserKey ( ) ) ) {
return false ;
}
return tru e;
} else {
valid_ = false ;
status_ = Status : : Corruption (
@ -1224,8 +1223,7 @@ bool DBIter::FindValueForCurrentKeyUsingSeek() {
}
}
Status s = Merge ( nullptr , saved_key_ . GetUserKey ( ) ) ;
if ( ! s . ok ( ) ) {
if ( ! Merge ( nullptr , saved_key_ . GetUserKey ( ) ) ) {
return false ;
}
@ -1248,7 +1246,7 @@ bool DBIter::FindValueForCurrentKeyUsingSeek() {
return true ;
}
Status DBIter : : Merge ( const Slice * val , const Slice & user_key ) {
bool DBIter : : Merge ( const Slice * val , const Slice & user_key ) {
Status s = MergeHelper : : TimedFullMerge (
merge_operator_ , user_key , val , merge_context_ . GetOperands ( ) ,
& saved_value_ , logger_ , statistics_ , clock_ , & pinned_value_ ,
@ -1256,14 +1254,33 @@ Status DBIter::Merge(const Slice* val, const Slice& user_key) {
if ( ! s . ok ( ) ) {
valid_ = false ;
status_ = s ;
return s ;
return fal se ;
}
SetValueAndColumnsFromPlain ( pinned_value_ . data ( ) ? pinned_value_
: saved_value_ ) ;
valid_ = true ;
return s ;
return true ;
}
bool DBIter : : MergeEntity ( const Slice & entity , const Slice & user_key ) {
Status s = MergeHelper : : TimedFullMergeWithEntity (
merge_operator_ , user_key , entity , merge_context_ . GetOperands ( ) ,
& saved_value_ , logger_ , statistics_ , clock_ ,
/* update_num_ops_stats */ true ) ;
if ( ! s . ok ( ) ) {
valid_ = false ;
status_ = s ;
return false ;
}
if ( ! SetValueAndColumnsFromEntity ( saved_value_ ) ) {
return false ;
}
valid_ = true ;
return true ;
}
// Move backwards until the key smaller than saved_key_.