Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
rallen090 committed Aug 27, 2021
1 parent fc4cd09 commit 9873beb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/dbnode/storage/index/mutable_segments.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,18 +440,18 @@ func (m *mutableSegments) maybeBackgroundCompactWithLock() {
return
}

m.backgroundCompactWithLock()
m.backgroundCompactWithLock(false)
}

// BackgroundCompact background compacts eligible segments.
func (m *mutableSegments) BackgroundCompact() {
m.Lock()
defer m.Unlock()

m.backgroundCompactWithLock()
m.backgroundCompactWithLock(true)
}

func (m *mutableSegments) backgroundCompactWithLock() {
func (m *mutableSegments) backgroundCompactWithLock(force bool) {
// Create a logical plan.
segs := make([]compaction.Segment, 0, len(m.backgroundSegments))
for _, seg := range m.backgroundSegments {
Expand Down Expand Up @@ -489,7 +489,7 @@ func (m *mutableSegments) backgroundCompactWithLock() {
for _, seg := range m.backgroundSegments {
sinceLastInactiveSeriesCheck := now.Sub(seg.garbageCollectLastCheck)
seg.garbageCollectLastCheck = now
if sinceLastInactiveSeriesCheck < segmentCheckInactiveSeriesMinInterval {
if !force && sinceLastInactiveSeriesCheck < segmentCheckInactiveSeriesMinInterval {
// Only consider for compaction every so often.
continue
}
Expand Down
2 changes: 1 addition & 1 deletion src/dbnode/storage/index/mutable_segments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ func TestMutableSegmentsBackgroundCompactGCReconstructCachedSearches(t *testing.
// Explicitly background compact and make sure that background segment
// is GC'd of series no longer present.
segs.Lock()
segs.backgroundCompactWithLock()
segs.backgroundCompactWithLock(false)
compactingBackgroundStandard := segs.compact.compactingBackgroundStandard
compactingBackgroundGarbageCollect := segs.compact.compactingBackgroundGarbageCollect
segs.Unlock()
Expand Down

0 comments on commit 9873beb

Please sign in to comment.