Force merge with only_expunge_deletes
should honor max segment size
#7644
Labels
enhancement
Enhancement or improvement to existing feature or request
Indexing
Indexing, Bulk Indexing and anything related to indexing
v2.12.0
Issues and PRs related to version 2.12.0
Is your feature request related to a problem? Please describe.
There is longstanding logic that ignores the max segment size when doing any kind of forced merge, here https://github.com/opensearch-project/OpenSearch/blob/main/server/src/main/java/org/opensearch/index/OpenSearchTieredMergePolicy.java#L59.
This makes sense when you have an index that stops receiving updates, has been switched to read-only, and you want to merge down to a single segment.
There are times, though, when someone just wants to periodically expunge deletes, because soft deletes mean that they have accumulated way too many deleted docs. As mentioned in e.g. the answer to this Stackoverflow question, this may result in segments that are larger than the max segment size, so they will never merge away deletes going forward (unless there are so many deletes that the segment could drop back below the max segment size).
Describe the solution you'd like
I would like a force merge with
only_expunge_deletes
to honor the max segment size.The simple way to do that is to change this line to use
regularMergePolicy
instead offorcedMergePolicy
.Describe alternatives you've considered
I guess we could add another option to the force merge API to say "merge away deletes, but still honor the max segment size" (or even just add a general "honor the max segment size" argument).
In my opinion,
only_expunge_deletes
already implies that I just want to get rid of deletes and am not trying to merge to one big segment.Additional context
N/A
The text was updated successfully, but these errors were encountered: