@ -317,9 +317,9 @@ struct WriteBatchIndexEntry {
class WriteBatchEntryComparator {
public :
WriteBatchEntryComparator ( const Comparator * default_comparator ,
WriteBatchEntryComparator ( const Comparator * _ default_comparator,
const ReadableWriteBatch * write_batch )
: default_comparator_ ( default_comparator ) , write_batch_ ( write_batch ) { }
: default_comparator_ ( _ default_comparator) , write_batch_ ( write_batch ) { }
// Compare a and b. Return a negative value if a is less than b, 0 if they
// are equal, and a positive value if a is greater than b
int operator ( ) ( const WriteBatchIndexEntry * entry1 ,
@ -333,6 +333,8 @@ class WriteBatchEntryComparator {
cf_comparator_map_ [ column_family_id ] = comparator ;
}
const Comparator * default_comparator ( ) { return default_comparator_ ; }
private :
const Comparator * default_comparator_ ;
std : : unordered_map < uint32_t , const Comparator * > cf_comparator_map_ ;
@ -590,6 +592,16 @@ Iterator* WriteBatchWithIndex::NewIteratorWithBase(
GetColumnFamilyUserComparator ( column_family ) ) ;
}
Iterator * WriteBatchWithIndex : : NewIteratorWithBase ( Iterator * base_iterator ) {
if ( rep - > overwrite_key = = false ) {
assert ( false ) ;
return nullptr ;
}
// default column family's comparator
return new BaseDeltaIterator ( base_iterator , NewIterator ( ) ,
rep - > comparator . default_comparator ( ) ) ;
}
void WriteBatchWithIndex : : Put ( ColumnFamilyHandle * column_family ,
const Slice & key , const Slice & value ) {
rep - > SetLastEntryOffset ( ) ;