@@ -168,9 +168,8 @@ type DefaultPlanner struct {
168
168
}
169
169
170
170
type fileStore interface {
171
- Stats () []FileStat
171
+ Stats () []ExtFileStat
172
172
LastModified () time.Time
173
- BlockCount (path string , idx int ) int
174
173
ParseFileName (path string ) (int , int , error )
175
174
NextGeneration () int
176
175
TSMReader (path string ) (* TSMReader , error )
@@ -190,7 +189,7 @@ func NewDefaultPlanner(fs fileStore, writeColdDuration time.Duration) *DefaultPl
190
189
// 000001 each with different sequence numbers.
191
190
type tsmGeneration struct {
192
191
id int
193
- files []FileStat
192
+ files []ExtFileStat
194
193
parseFileName ParseFileNameFunc
195
194
}
196
195
@@ -270,7 +269,10 @@ func (c *DefaultPlanner) generationsFullyCompacted(gens tsmGenerations) (bool, s
270
269
aggressivePointsPerBlockCount := 0
271
270
filesUnderMaxTsmSizeCount := 0
272
271
for _ , tsmFile := range gens [0 ].files {
273
- if c .FileStore .BlockCount (tsmFile .Path , 1 ) >= c .GetAggressiveCompactionPointsPerBlock () {
272
+ // We check for greater than the default points per block here because the admin may
273
+ // have increased aggressive points per block in the config and wants to
274
+ // recompact files at the new higher max.
275
+ if tsmFile .FirstBlockCount > tsdb .DefaultMaxPointsPerBlock {
274
276
aggressivePointsPerBlockCount ++
275
277
}
276
278
if tsmFile .Size < tsdb .MaxTSMFileSize {
@@ -510,7 +512,7 @@ func (c *DefaultPlanner) Plan(lastWrite time.Time) ([]CompactionGroup, int64) {
510
512
var skip bool
511
513
512
514
// Skip the file if it's over the max size and contains a full block and it does not have any tombstones
513
- if len (generations ) > 2 && group .size () > uint64 (tsdb .MaxTSMFileSize ) && c . FileStore . BlockCount ( group .files [0 ].Path , 1 ) >= tsdb .DefaultMaxPointsPerBlock && ! group .hasTombstones () {
515
+ if len (generations ) > 2 && group .size () > uint64 (tsdb .MaxTSMFileSize ) && group .files [0 ].FirstBlockCount >= tsdb .DefaultMaxPointsPerBlock && ! group .hasTombstones () {
514
516
skip = true
515
517
}
516
518
@@ -586,7 +588,7 @@ func (c *DefaultPlanner) Plan(lastWrite time.Time) ([]CompactionGroup, int64) {
586
588
// Skip the file if it's over the max size and contains a full block or the generation is split
587
589
// over multiple files. In the latter case, that would mean the data in the file spilled over
588
590
// the 2GB limit.
589
- if g .size () > uint64 (tsdb .MaxTSMFileSize ) && c . FileStore . BlockCount ( g .files [0 ].Path , 1 ) >= tsdb .DefaultMaxPointsPerBlock {
591
+ if g .size () > uint64 (tsdb .MaxTSMFileSize ) && g .files [0 ].FirstBlockCount >= tsdb .DefaultMaxPointsPerBlock {
590
592
start = i + 1
591
593
}
592
594
@@ -630,7 +632,7 @@ func (c *DefaultPlanner) Plan(lastWrite time.Time) ([]CompactionGroup, int64) {
630
632
}
631
633
632
634
// Skip the file if it's over the max size and it contains a full block
633
- if gen .size () >= uint64 (tsdb .MaxTSMFileSize ) && c . FileStore . BlockCount ( gen .files [0 ].Path , 1 ) >= tsdb .DefaultMaxPointsPerBlock && ! gen .hasTombstones () {
635
+ if gen .size () >= uint64 (tsdb .MaxTSMFileSize ) && gen .files [0 ].FirstBlockCount >= tsdb .DefaultMaxPointsPerBlock && ! gen .hasTombstones () {
634
636
startIndex ++
635
637
continue
636
638
}
0 commit comments