apache / apache/lucene

Think again about the floor segment size? [LUCENE-10569]

Open
#11,605 3 comments 0 reactions 0 assignees View on GitHub
legacy-jira-priority:Minor type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

TieredMergePolicy has a floor segment size that it uses to prevent indexes from having a long tail of small segments, which would be very inefficient at search time. It is 2MB by default.

While this floor segment size is good for searches, it also has the side effect of computing sub-optimal merges when segments are below this size. We came up whis 2MB floor segment size many years ago when Lucene was less space-efficient. I think we should consider lowering it at a minimum, and maybe move to a threshold on the document count rather than the byte size of the segment to better work with datasets of small or highly-compressible documents? Or maybe there are better ways?

Separately, we should enable merge-on-refresh by default (#11116) and only return suboptimal merges for merge-on-refresh, not regular background merges.

---
Migrated from [LUCENE-10569](https://issues.apache.org/jira/browse/LUCENE-10569) by Adrien Grand (@jpountz), updated May 18 2022

Contributor guide

Open the contributing guide

Research direction

Start by reviewing TieredMergePolicy's floor segment size and the merge-on-refresh behavior described in the issue. Compare byte-size and document-count thresholds, then determine how suboptimal merges should differ between refreshes and regular background merges. Done means the project has an agreed approach and the relevant merge behavior is updated accordingly.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.