Skip to content

Honour max segment size when setting only_expunge_deletes on force merge #77478

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 14, 2021
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
5 changes: 2 additions & 3 deletions docs/reference/indices/forcemerge.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ If so, executes it.
--
(Optional, Boolean)
If `true`,
only expunge segments containing document deletions.
expunge all segments containing more than `index.merge.policy.expunge_deletes_allowed`
(default to 10) percents of deleted documents.
Defaults to `false`.

In Lucene,
Expand All @@ -133,8 +134,6 @@ During a merge,
a new segment is created
that does not contain those document deletions.

NOTE: This parameter does *not* override the
`index.merge.policy.expunge_deletes_allowed` setting.
--


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ public MergeSpecification findForcedMerges(SegmentInfos infos, int maxSegmentCou

@Override
public MergeSpecification findForcedDeletesMerges(SegmentInfos infos, MergeContext mergeContext) throws IOException {
return forcedMergePolicy.findForcedDeletesMerges(infos, mergeContext);
// we apply the max segment size through the regular merge policy in
// order to avoid giant segments when expunging deletes on a read/write index
return regularMergePolicy.findForcedDeletesMerges(infos, mergeContext);
}

public void setForceMergeDeletesPctAllowed(double forceMergeDeletesPctAllowed) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public void testSetForceMergeDeletesPctAllowed() {
EsTieredMergePolicy policy = new EsTieredMergePolicy();
policy.setForceMergeDeletesPctAllowed(42);
assertEquals(42, policy.forcedMergePolicy.getForceMergeDeletesPctAllowed(), 0);
assertEquals(42, policy.regularMergePolicy.getForceMergeDeletesPctAllowed(), 0);
}

public void testSetFloorSegmentMB() {
Expand Down