@ -104,7 +104,7 @@ class Compaction {
}
// Returns the LevelFilesBrief of the specified compaction input level.
LevelFilesBrief * input_levels ( size_t compaction_input_level ) {
const LevelFilesBrief * input_levels ( size_t compaction_input_level ) const {
return & input_levels_ [ compaction_input_level ] ;
}
@ -132,10 +132,6 @@ class Compaction {
bool KeyNotExistsBeyondOutputLevel ( const Slice & user_key ,
std : : vector < size_t > * level_ptrs ) const ;
// Returns true iff we should stop building the current output
// before processing "internal_key".
bool ShouldStopBefore ( const Slice & internal_key ) ;
// Clear all files to indicate that they are not being compacted
// Delete this compaction from the list of running compactions.
//
@ -151,13 +147,13 @@ class Compaction {
double score ( ) const { return score_ ; }
// Is this compaction creating a file in the bottom most level?
bool bottommost_level ( ) { return bottommost_level_ ; }
bool bottommost_level ( ) const { return bottommost_level_ ; }
// Does this compaction include all sst files?
bool is_full_compaction ( ) { return is_full_compaction_ ; }
bool is_full_compaction ( ) const { return is_full_compaction_ ; }
// Was this compaction triggered manually by the client?
bool is_manual_compaction ( ) { return is_manual_compaction_ ; }
bool is_manual_compaction ( ) const { return is_manual_compaction_ ; }
// Used when allow_trivial_move option is set in
// Universal compaction. If all the input files are
@ -170,19 +166,21 @@ class Compaction {
// Used when allow_trivial_move option is set in
// Universal compaction. Returns true, if the input files
// are non-overlapping and can be trivially moved.
bool is_trivial_move ( ) { return is_trivial_move_ ; }
bool is_trivial_move ( ) const { return is_trivial_move_ ; }
// How many total levels are there?
int number_levels ( ) const { return number_levels_ ; }
// Return the MutableCFOptions that should be used throughout the compaction
// procedure
const MutableCFOptions * mutable_cf_options ( ) { return & mutable_cf_options_ ; }
const MutableCFOptions * mutable_cf_options ( ) const {
return & mutable_cf_options_ ;
}
// Returns the size in bytes that the output file should be preallocated to.
// In level compaction, that is max_file_size_. In universal compaction, that
// is the sum of all input file sizes.
uint64_t OutputFilePreallocationSize ( ) ;
uint64_t OutputFilePreallocationSize ( ) const ;
void SetInputVersion ( Version * input_version ) ;
@ -225,6 +223,14 @@ class Compaction {
CompactionReason compaction_reason ( ) { return compaction_reason_ ; }
const std : : vector < FileMetaData * > & grandparents ( ) const {
return grandparents_ ;
}
uint64_t max_grandparent_overlap_bytes ( ) const {
return max_grandparent_overlap_bytes_ ;
}
private :
// mark (or clear) all files that are being compacted
void MarkFilesBeingCompacted ( bool mark_as_compacted ) ;
@ -268,10 +274,6 @@ class Compaction {
// State used to check for number of of overlapping grandparent files
// (grandparent == "output_level_ + 1")
std : : vector < FileMetaData * > grandparents_ ;
size_t grandparent_index_ ; // Index in grandparent_starts_
bool seen_key_ ; // Some output key has been seen
uint64_t overlapped_bytes_ ; // Bytes of overlap between current output
// and grandparent files
const double score_ ; // score that was used to pick this compaction.
// Is this compaction creating a file in the bottom most level?