Skip to content
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

[1x] Deprecate index.merge.policy.max_merge_at_once_explicit (#1981) #1984

Merged
merged 3 commits into from
Feb 2, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -713,10 +713,8 @@ public IndexSettings(final IndexMetadata indexMetadata, final Settings nodeSetti
MergePolicyConfig.INDEX_MERGE_POLICY_MAX_MERGE_AT_ONCE_SETTING,
mergePolicyConfig::setMaxMergesAtOnce
);
scopedSettings.addSettingsUpdateConsumer(
MergePolicyConfig.INDEX_MERGE_POLICY_MAX_MERGE_AT_ONCE_EXPLICIT_SETTING,
mergePolicyConfig::setMaxMergesAtOnceExplicit
);
// todo: remove this in 2.0.0 since it was removed in lucene 9
scopedSettings.addSettingsUpdateConsumer(MergePolicyConfig.INDEX_MERGE_POLICY_MAX_MERGE_AT_ONCE_EXPLICIT_SETTING, noop -> {});
scopedSettings.addSettingsUpdateConsumer(
MergePolicyConfig.INDEX_MERGE_POLICY_MAX_MERGED_SEGMENT_SETTING,
mergePolicyConfig::setMaxMergedSegment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,6 @@
* Maximum number of segments to be merged at a time during "normal" merging.
* Default is <code>10</code>.
*
* <li><code>index.merge.policy.max_merge_at_once_explicit</code>:
*
* Maximum number of segments to be merged at a time, during force merge or
* expungeDeletes. Default is <code>30</code>.
*
* <li><code>index.merge.policy.max_merged_segment</code>:
*
* Maximum sized segment to produce during normal merging (not explicit
Expand Down Expand Up @@ -136,7 +131,6 @@ public final class MergePolicyConfig {
public static final double DEFAULT_EXPUNGE_DELETES_ALLOWED = 10d;
public static final ByteSizeValue DEFAULT_FLOOR_SEGMENT = new ByteSizeValue(2, ByteSizeUnit.MB);
public static final int DEFAULT_MAX_MERGE_AT_ONCE = 10;
public static final int DEFAULT_MAX_MERGE_AT_ONCE_EXPLICIT = 30;
public static final ByteSizeValue DEFAULT_MAX_MERGED_SEGMENT = new ByteSizeValue(5, ByteSizeUnit.GB);
public static final double DEFAULT_SEGMENTS_PER_TIER = 10.0d;
public static final double DEFAULT_RECLAIM_DELETES_WEIGHT = 2.0d;
Expand Down Expand Up @@ -169,10 +163,12 @@ public final class MergePolicyConfig {
Property.Dynamic,
Property.IndexScope
);
@Deprecated
public static final Setting<Integer> INDEX_MERGE_POLICY_MAX_MERGE_AT_ONCE_EXPLICIT_SETTING = Setting.intSetting(
"index.merge.policy.max_merge_at_once_explicit",
DEFAULT_MAX_MERGE_AT_ONCE_EXPLICIT,
30,
2,
Property.Deprecated,
Property.Dynamic,
Property.IndexScope
);
Expand Down Expand Up @@ -260,10 +256,6 @@ void setMaxMergedSegment(ByteSizeValue maxMergedSegment) {
mergePolicy.setMaxMergedSegmentMB(maxMergedSegment.getMbFrac());
}

void setMaxMergesAtOnceExplicit(Integer maxMergeAtOnceExplicit) {
mergePolicy.setMaxMergeAtOnceExplicit(maxMergeAtOnceExplicit);
}

void setMaxMergesAtOnce(Integer maxMergeAtOnce) {
mergePolicy.setMaxMergeAtOnce(maxMergeAtOnce);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,13 @@ public int getMaxMergeAtOnce() {
return regularMergePolicy.getMaxMergeAtOnce();
}

@Deprecated
public void setMaxMergeAtOnceExplicit(int maxMergeAtOnceExplicit) {
regularMergePolicy.setMaxMergeAtOnceExplicit(maxMergeAtOnceExplicit);
forcedMergePolicy.setMaxMergeAtOnceExplicit(maxMergeAtOnceExplicit);
}

@Deprecated
public int getMaxMergeAtOnceExplicit() {
return forcedMergePolicy.getMaxMergeAtOnceExplicit();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,25 +156,13 @@ public void testTieredMergePolicySettingsUpdate() throws IOException {
MergePolicyConfig.DEFAULT_MAX_MERGE_AT_ONCE - 1
);

assertEquals(
((OpenSearchTieredMergePolicy) indexSettings.getMergePolicy()).getMaxMergeAtOnceExplicit(),
MergePolicyConfig.DEFAULT_MAX_MERGE_AT_ONCE_EXPLICIT
);
assertEquals(((OpenSearchTieredMergePolicy) indexSettings.getMergePolicy()).getMaxMergeAtOnceExplicit(), 30);
indexSettings.updateIndexMetadata(
newIndexMeta(
"index",
Settings.builder()
.put(
MergePolicyConfig.INDEX_MERGE_POLICY_MAX_MERGE_AT_ONCE_EXPLICIT_SETTING.getKey(),
MergePolicyConfig.DEFAULT_MAX_MERGE_AT_ONCE_EXPLICIT - 1
)
.build()
Settings.builder().put(MergePolicyConfig.INDEX_MERGE_POLICY_MAX_MERGE_AT_ONCE_EXPLICIT_SETTING.getKey(), 29).build()
)
);
assertEquals(
((OpenSearchTieredMergePolicy) indexSettings.getMergePolicy()).getMaxMergeAtOnceExplicit(),
MergePolicyConfig.DEFAULT_MAX_MERGE_AT_ONCE_EXPLICIT - 1
);

assertEquals(
((OpenSearchTieredMergePolicy) indexSettings.getMergePolicy()).getMaxMergedSegmentMB(),
Expand Down Expand Up @@ -259,10 +247,7 @@ public void testTieredMergePolicySettingsUpdate() throws IOException {
((OpenSearchTieredMergePolicy) indexSettings.getMergePolicy()).getMaxMergeAtOnce(),
MergePolicyConfig.DEFAULT_MAX_MERGE_AT_ONCE
);
assertEquals(
((OpenSearchTieredMergePolicy) indexSettings.getMergePolicy()).getMaxMergeAtOnceExplicit(),
MergePolicyConfig.DEFAULT_MAX_MERGE_AT_ONCE_EXPLICIT
);
assertEquals(((OpenSearchTieredMergePolicy) indexSettings.getMergePolicy()).getMaxMergeAtOnceExplicit(), 30);
assertEquals(
((OpenSearchTieredMergePolicy) indexSettings.getMergePolicy()).getMaxMergedSegmentMB(),
new ByteSizeValue(MergePolicyConfig.DEFAULT_MAX_MERGED_SEGMENT.getBytes() + 1).getMbFrac(),
Expand All @@ -278,6 +263,12 @@ public void testTieredMergePolicySettingsUpdate() throws IOException {
MergePolicyConfig.DEFAULT_DELETES_PCT_ALLOWED,
0
);

assertWarnings(
"[index.merge.policy.max_merge_at_once_explicit] setting was "
+ "deprecated in OpenSearch and will be removed in a future release! See the breaking changes "
+ "documentation for the next major version."
);
}

public Settings build(String value) {
Expand Down