@ -75,48 +75,51 @@ class CompactionJob {
Status Run ( ) ;
Status Run ( ) ;
// REQUIRED: mutex held
// REQUIRED: mutex held
// status is the return of Run()
Status Install ( const MutableCFOptions & mutable_cf_options ,
void Install ( Status * status , const MutableCFOptions & mutable_cf_options ,
InstrumentedMutex * db_mutex ) ;
InstrumentedMutex * db_mutex ) ;
private :
private :
// REQUIRED: mutex not held
struct SubCompactionState ;
Status SubCompactionRun ( Slice * start , Slice * end ) ;
void AggregateStatistics ( ) ;
// Set up the individual states used by each subcompaction
void InitializeSubCompactions ( const SequenceNumber & earliest ,
const SequenceNumber & visible ,
const SequenceNumber & latest ) ;
void GetSubCompactionBoundaries ( ) ;
// update the thread status for starting a compaction.
// update the thread status for starting a compaction.
void ReportStartedCompaction ( Compaction * compaction ) ;
void ReportStartedCompaction ( Compaction * compaction ) ;
void AllocateCompactionOutputFileNumbers ( ) ;
void AllocateCompactionOutputFileNumbers ( ) ;
// Call compaction filter. Then iterate through input and compact the
// Call compaction filter. Then iterate through input and compact the
// kv-pairs
// kv-pairs
Status ProcessKeyValueCompaction ( int64_t * imm_micros , Iterator * input ,
void ProcessKeyValueCompaction ( SubCompactionState * sub_compact ) ;
Slice * start = nullptr ,
Slice * end = nullptr ) ;
Status WriteKeyValue ( const Slice & key , const Slice & value ,
Status WriteKeyValue ( const Slice & key , const Slice & value ,
const ParsedInternalKey & ikey ,
const ParsedInternalKey & ikey ,
const Status & input_status ) ;
const Status & input_status ,
SubCompactionState * sub_compact ) ;
Status FinishCompactionOutputFile ( const Status & input_status ) ;
Status InstallCompactionResults ( InstrumentedMutex * db_mutex ,
Status FinishCompactionOutputFile ( const Status & input_status ,
const MutableCFOptions & mutable_cf_options ) ;
SubCompactionState * sub_compact ) ;
SequenceNumber findEarliestVisibleSnapshot (
Status InstallCompactionResults ( const MutableCFOptions & mutable_cf_options ,
SequenceNumber in , const std : : vector < SequenceNumber > & snapshots ,
InstrumentedMutex * db_mutex ) ;
SequenceNumber * prev_snapshot ) ;
SequenceNumber findEarliestVisibleSnapshot ( SequenceNumber in ,
SequenceNumber * prev_snapshot ) ;
void RecordCompactionIOStats ( ) ;
void RecordCompactionIOStats ( ) ;
Status OpenCompactionOutputFile ( ) ;
Status OpenCompactionOutputFile ( SubCompactionState * sub_compact ) ;
void CleanupCompaction ( const Status & status ) ;
void CleanupCompaction ( ) ;
void UpdateCompactionJobStats (
void UpdateCompactionJobStats (
const InternalStats : : CompactionStats & stats ) const ;
const InternalStats : : CompactionStats & stats ) const ;
void RecordDroppedKeys ( int64_t * key_drop_user ,
void RecordDroppedKeys ( int64_t * key_drop_user ,
int64_t * key_drop_newer_entry ,
int64_t * key_drop_newer_entry ,
int64_t * key_drop_obsolete ) ;
int64_t * key_drop_obsolete ,
CompactionJobStats * compaction_job_stats = nullptr ) ;
void UpdateCompactionStats ( ) ;
void UpdateCompactionStats ( ) ;
void UpdateCompactionInputStatsHelper (
void UpdateCompactionInputStatsHelper (
int * num_files , uint64_t * bytes_read , int input_level ) ;
int * num_files , uint64_t * bytes_read , int input_level ) ;
void LogCompaction ( ColumnFamilyData * cfd , Compaction * compaction ) ;
void LogCompaction ( ) ;
int job_id_ ;
int job_id_ ;
@ -126,9 +129,6 @@ class CompactionJob {
CompactionJobStats * compaction_job_stats_ ;
CompactionJobStats * compaction_job_stats_ ;
bool bottommost_level_ ;
bool bottommost_level_ ;
SequenceNumber earliest_snapshot_ ;
SequenceNumber visible_at_tip_ ;
SequenceNumber latest_snapshot_ ;
InternalStats : : CompactionStats compaction_stats_ ;
InternalStats : : CompactionStats compaction_stats_ ;