Skip to content

Commit 3647f80

Browse files
committed
handle the mergePlanOptions appropriately
1 parent ceeb65f commit 3647f80

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

index/scorch/merge.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,17 @@ func (s *Scorch) ForceMerge(ctx context.Context,
209209
func (s *Scorch) parseMergePlannerOptions() (*mergeplan.MergePlanOptions,
210210
error) {
211211
mergePlannerOptions := mergeplan.DefaultMergePlanOptions
212+
213+
po, err := s.parsePersisterOptions()
214+
if err != nil {
215+
return nil, err
216+
}
217+
// by default use the MaxSizeInMemoryMergePerWorker from the persister option
218+
// as the FloorSegmentFileSize for the merge planner which would be the
219+
// first tier size in the planning. If the value is 0, then we don't use the
220+
// file size in the planning.
221+
mergePlannerOptions.FloorSegmentFileSize = int64(po.MaxSizeInMemoryMergePerWorker)
222+
212223
if v, ok := s.config["scorchMergePlanOptions"]; ok {
213224
b, err := util.MarshalJSON(v)
214225
if err != nil {
@@ -225,16 +236,6 @@ func (s *Scorch) parseMergePlannerOptions() (*mergeplan.MergePlanOptions,
225236
return nil, err
226237
}
227238
}
228-
229-
if mergePlannerOptions.FloorSegmentFileSize == 0 {
230-
po, err := s.parsePersisterOptions()
231-
if err != nil {
232-
return nil, err
233-
}
234-
235-
mergePlannerOptions.FloorSegmentFileSize = int64(po.MaxSizeInMemoryMergePerWorker)
236-
}
237-
238239
return &mergePlannerOptions, nil
239240
}
240241

0 commit comments

Comments
 (0)