@ -1994,23 +1994,21 @@ Iterator* VersionSet::MakeInputIterator(Compaction* c) {
// Level-0 files have to be merged together. For other levels,
// Level-0 files have to be merged together. For other levels,
// we will make a concatenating iterator per level.
// we will make a concatenating iterator per level.
// TODO(opt): use concatenating iterator for level-0 if there is no overlap
// TODO(opt): use concatenating iterator for level-0 if there is no overlap
const int space = ( c - > level ( ) = = 0 ? c - > inputs_ [ 0 ] . size ( ) + 1 : 2 ) ;
const int space = ( c - > level ( ) = = 0 ? c - > inputs ( 0 ) - > size ( ) + 1 : 2 ) ;
Iterator * * list = new Iterator * [ space ] ;
Iterator * * list = new Iterator * [ space ] ;
int num = 0 ;
int num = 0 ;
for ( int which = 0 ; which < 2 ; which + + ) {
for ( int which = 0 ; which < 2 ; which + + ) {
if ( ! c - > inputs_ [ which ] . empty ( ) ) {
if ( ! c - > inputs ( which ) - > empty ( ) ) {
if ( c - > level ( ) + which = = 0 ) {
if ( c - > level ( ) + which = = 0 ) {
const std : : vector < FileMetaData * > & files = c - > inputs_ [ which ] ;
for ( const auto & file : * c - > inputs ( which ) ) {
for ( size_t i = 0 ; i < files . size ( ) ; i + + ) {
list [ num + + ] = table_cache_ - > NewIterator (
list [ num + + ] = table_cache_ - > NewIterator (
options , storage_options_compactions_ ,
options , storage_options_compactions_ , file - > number ,
files [ i ] - > number , files [ i ] - > file_size , nullptr ,
file - > file_size , nullptr , true /* for compaction */ ) ;
true /* for compaction */ ) ;
}
}
} else {
} else {
// Create concatenating iterator for the files from this level
// Create concatenating iterator for the files from this level
list [ num + + ] = NewTwoLevelIterator (
list [ num + + ] = NewTwoLevelIterator (
new Version : : LevelFileNumIterator ( icmp_ , & c - > inputs_ [ which ] ) ,
new Version : : LevelFileNumIterator ( icmp_ , c - > inputs ( which ) ) ,
& GetFileIterator , table_cache_ , options , storage_options_ ,
& GetFileIterator , table_cache_ , options , storage_options_ ,
true /* for compaction */ ) ;
true /* for compaction */ ) ;
}
}
@ -2034,7 +2032,7 @@ uint64_t VersionSet::MaxFileSizeForLevel(int level) {
// in the current version
// in the current version
bool VersionSet : : VerifyCompactionFileConsistency ( Compaction * c ) {
bool VersionSet : : VerifyCompactionFileConsistency ( Compaction * c ) {
# ifndef NDEBUG
# ifndef NDEBUG
if ( c - > input_version_ ! = current_ ) {
if ( c - > input_version ( ) ! = current_ ) {
Log ( options_ - > info_log , " VerifyCompactionFileConsistency version mismatch " ) ;
Log ( options_ - > info_log , " VerifyCompactionFileConsistency version mismatch " ) ;
}
}