Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 3 additions & 17 deletions index/scorch/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,8 @@ func (s *Scorch) mergerLoop() {

var lastEpochMergePlanned uint64
var ctrlMsg *mergerCtrl
mergePlannerOptions, err := s.parseMergePlannerOptions()
if err != nil {
s.fireAsyncError(NewScorchError(
merger,
fmt.Sprintf("mergerPlannerOptions json parsing err: %v", err),
ErrOptionsParse,
))
return
}
ctrlMsgDflt := &mergerCtrl{ctx: context.Background(),
options: mergePlannerOptions,
options: s.mergePlannerOptions,
doneCh: nil}

OUTER:
Expand Down Expand Up @@ -234,14 +225,9 @@ func (s *Scorch) ForceMerge(ctx context.Context,
return nil
}

func (s *Scorch) parseMergePlannerOptions() (*mergeplan.MergePlanOptions,
func (s *Scorch) parseMergePlannerOptions(po *persisterOptions) (*mergeplan.MergePlanOptions,
error) {
mergePlannerOptions := mergeplan.DefaultMergePlanOptions

po, err := s.parsePersisterOptions()
if err != nil {
return nil, err
}
// by default use the MaxSizeInMemoryMergePerWorker from the persister option
// as the FloorSegmentFileSize for the merge planner which would be the
// first tier size in the planning. If the value is 0, then we don't use the
Expand Down Expand Up @@ -569,6 +555,7 @@ func (s *Scorch) mergeAndPersistInMemorySegments(snapshot *IndexSnapshot,
// is updated - which is valid, since the snapshot updated in bolt is
// cleaned up only if its zero ref'd (MB-66163 for more details)
s.markIneligibleForRemoval(filename)
newMergedSegmentFileNames[flushID] = filename

// the newly merged segment is already flushed out to disk, just needs
// to be opened using mmap.
Expand All @@ -582,7 +569,6 @@ func (s *Scorch) mergeAndPersistInMemorySegments(snapshot *IndexSnapshot,
}
newDocIDsSet[flushID] = newDocIDs
newMergedSegmentIDs[flushID] = newSegmentID
newMergedSegmentFileNames[flushID] = filename
newMergedSegments[flushID], err = s.segPlugin.OpenUsing(path, s.segmentConfig)
if err != nil {
em.Lock()
Expand Down
Loading
Loading