@@ -395,7 +395,7 @@ type getValueSeparation func(JobID, *compaction, sstable.TableFormat) compact.Va
395
395
// The compaction is created with a reference to its version that must be
396
396
// released when the compaction is complete.
397
397
func newCompaction (
398
- pc * pickedCompaction ,
398
+ pc * pickedTableCompaction ,
399
399
opts * Options ,
400
400
beganAt time.Time ,
401
401
provider objstorage.Provider ,
@@ -1926,7 +1926,7 @@ func (d *DB) makeCompactionEnvLocked() *compactionEnv {
1926
1926
}
1927
1927
1928
1928
// pickAnyCompaction tries to pick a manual or automatic compaction.
1929
- func (d * DB ) pickAnyCompaction (env compactionEnv ) (pc * pickedCompaction ) {
1929
+ func (d * DB ) pickAnyCompaction (env compactionEnv ) (pc pickedCompaction ) {
1930
1930
// Pick a score-based compaction first, since a misshapen LSM is bad.
1931
1931
if ! d .opts .DisableAutomaticCompactions {
1932
1932
if pc = d .mu .versions .picker .pickAutoScore (env ); pc != nil {
@@ -1948,24 +1948,24 @@ func (d *DB) pickAnyCompaction(env compactionEnv) (pc *pickedCompaction) {
1948
1948
// is removed from d.mu.compact.manual.
1949
1949
//
1950
1950
// REQUIRES: d.mu and d.mu.versions.logLock is held.
1951
- func (d * DB ) runPickedCompaction (pc * pickedCompaction , grantHandle CompactionGrantHandle ) {
1951
+ func (d * DB ) runPickedCompaction (pc pickedCompaction , grantHandle CompactionGrantHandle ) {
1952
1952
var doneChannel chan error
1953
- if pc .manualID > 0 {
1953
+ if pc .ManualID () > 0 {
1954
1954
for i := range d .mu .compact .manual {
1955
- if d .mu .compact .manual [i ].id == pc .manualID {
1955
+ if d .mu .compact .manual [i ].id == pc .ManualID () {
1956
1956
doneChannel = d .mu .compact .manual [i ].done
1957
1957
d .mu .compact .manual = slices .Delete (d .mu .compact .manual , i , i + 1 )
1958
1958
d .mu .compact .manualLen .Store (int32 (len (d .mu .compact .manual )))
1959
1959
break
1960
1960
}
1961
1961
}
1962
1962
if doneChannel == nil {
1963
- panic (errors .AssertionFailedf ("did not find manual compaction with id %d" , pc .manualID ))
1963
+ panic (errors .AssertionFailedf ("did not find manual compaction with id %d" , pc .ManualID () ))
1964
1964
}
1965
1965
}
1966
1966
1967
1967
d .mu .compact .compactingCount ++
1968
- compaction := newCompaction ( pc , d . opts , d . timeNow (), d . ObjProvider () , grantHandle , d . TableFormat (), d . determineCompactionValueSeparation )
1968
+ compaction := pc . ConstructCompaction ( d , grantHandle )
1969
1969
d .addInProgressCompaction (compaction )
1970
1970
go func () {
1971
1971
d .compact (compaction , doneChannel )
@@ -2028,7 +2028,7 @@ func (d *DB) GetWaitingCompaction() (bool, WaitingCompaction) {
2028
2028
}
2029
2029
}
2030
2030
// INVARIANT: pc != nil and is in the cache.
2031
- return true , makeWaitingCompaction ( pc .manualID > 0 , pc . kind , pc . score )
2031
+ return true , pc .WaitingCompaction ( )
2032
2032
}
2033
2033
2034
2034
// GetAllowedWithoutPermission implements DBForCompaction (it is called by the
@@ -2072,7 +2072,7 @@ func (d *DB) tryScheduleDownloadCompactions(env compactionEnv, maxConcurrentDown
2072
2072
return started
2073
2073
}
2074
2074
2075
- func (d * DB ) pickManualCompaction (env compactionEnv ) (pc * pickedCompaction ) {
2075
+ func (d * DB ) pickManualCompaction (env compactionEnv ) (pc pickedCompaction ) {
2076
2076
v := d .mu .versions .currentVersion ()
2077
2077
for len (d .mu .compact .manual ) > 0 {
2078
2078
manual := d .mu .compact .manual [0 ]
0 commit comments