Skip to content

Commit

Permalink
Add docs, small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosdelest committed Feb 14, 2025
1 parent ce66ca2 commit 43c8507
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2850,7 +2850,7 @@ public synchronized void beforeMerge(OnGoingMerge merge) {
@Override
protected long estimateMergeMemory(MergePolicy.OneMerge merge) {
try (Searcher searcher = acquireSearcher("merge_memory_estimation", SearcherScope.INTERNAL)) {
return SegmentMergeMemoryEstimator.estimateMergeMemory(merge, searcher.getIndexReader());
return MergeMemoryEstimator.estimateMergeMemory(merge, searcher.getIndexReader());
} catch (AlreadyClosedException e) {
failOnTragicEvent(e);
return 0L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,17 @@

import java.util.List;

public class SegmentMergeMemoryEstimator {
/**
* Provides an estimation of the memory needed to merge segments.
*
* This class is a temporary solution until we have a better way to estimate the memory needed for merges in Lucene.
* We can work iteratively in providing estimations for different types of fields and vector encodings.
*/
public class MergeMemoryEstimator {

/**
* Estimates the memory, in bytes, needed to merge the segments of the given merge.
*/
public static long estimateMergeMemory(MergePolicy.OneMerge merge, IndexReader indexReader) {
long memoryNeeded = 0;
for (SegmentCommitInfo mergedSegment : merge.segments) {
Expand Down

This file was deleted.

0 comments on commit 43c8507

Please sign in to comment.