Skip to content

Commit 17be5cc

Browse files
CaptainDredgePrabhat Sharma
and
Prabhat Sharma
authored
Added static setting for checkPendingFlushUpdate functionality of lucene writer (opensearch-project#12710) (opensearch-project#12786) (opensearch-project#12857)
(cherry picked from commit c369ec4) (cherry picked from commit 29bcc48) Signed-off-by: Prabhat Sharma <ptsharma@amazon.com> Co-authored-by: Prabhat Sharma <ptsharma@amazon.com>
1 parent db00468 commit 17be5cc

File tree

5 files changed

+23
-1
lines changed

5 files changed

+23
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
3030
- Built-in secure transports support ([#12435](https://github.com/opensearch-project/OpenSearch/pull/12435))
3131
- Lightweight Transport action to verify local term before fetching cluster-state from remote ([#12252](https://github.com/opensearch-project/OpenSearch/pull/12252/))
3232
- Integrate with admission controller for cluster-manager Read API. ([#12496](https://github.com/opensearch-project/OpenSearch/pull/12496))
33+
- Introduce a new setting `index.check_pending_flush.enabled` to expose the ability to disable the check for pending flushes by write threads ([#12710](https://github.com/opensearch-project/OpenSearch/pull/12710))
3334

3435
### Dependencies
3536
- Bump `com.squareup.okio:okio` from 3.7.0 to 3.8.0 ([#12290](https://github.com/opensearch-project/OpenSearch/pull/12290))

release-notes/opensearch.release-notes-2.13.0.md

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
- Built-in secure transports support ([#12435](https://github.com/opensearch-project/OpenSearch/pull/12435))
2828
- Lightweight Transport action to verify local term before fetching cluster-state from remote ([#12252](https://github.com/opensearch-project/OpenSearch/pull/12252/))
2929
- Integrate with admission controller for cluster-manager Read API. ([#12496](https://github.com/opensearch-project/OpenSearch/pull/12496))
30+
- Introduce a new setting `index.check_pending_flush.enabled` to expose the ability to disable the check for pending flushes by write threads ([#12710](https://github.com/opensearch-project/OpenSearch/pull/12710))
3031

3132
### Dependencies
3233
- Bump `com.squareup.okio:okio` from 3.7.0 to 3.8.0 ([#12290](https://github.com/opensearch-project/OpenSearch/pull/12290))

server/src/main/java/org/opensearch/common/settings/IndexScopedSettings.java

+1
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ public final class IndexScopedSettings extends AbstractScopedSettings {
207207
IndexSettings.INDEX_MERGE_ON_FLUSH_MAX_FULL_FLUSH_MERGE_WAIT_TIME,
208208
IndexSettings.INDEX_MERGE_ON_FLUSH_POLICY,
209209
IndexSettings.INDEX_MERGE_POLICY,
210+
IndexSettings.INDEX_CHECK_PENDING_FLUSH_ENABLED,
210211
LogByteSizeMergePolicyProvider.INDEX_LBS_MERGE_POLICY_MERGE_FACTOR_SETTING,
211212
LogByteSizeMergePolicyProvider.INDEX_LBS_MERGE_POLICY_MIN_MERGE_SETTING,
212213
LogByteSizeMergePolicyProvider.INDEX_LBS_MAX_MERGE_SEGMENT_SETTING,

server/src/main/java/org/opensearch/index/IndexSettings.java

+19-1
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,16 @@ public static IndexMergePolicy fromString(String text) {
625625
Property.IndexScope
626626
);
627627

628+
/**
629+
* Expert: Makes indexing threads check for pending flushes on update in order to help out
630+
* flushing indexing buffers to disk. This is an experimental Apache Lucene feature.
631+
*/
632+
public static final Setting<Boolean> INDEX_CHECK_PENDING_FLUSH_ENABLED = Setting.boolSetting(
633+
"index.check_pending_flush.enabled",
634+
true,
635+
Property.IndexScope
636+
);
637+
628638
public static final Setting<String> TIME_SERIES_INDEX_MERGE_POLICY = Setting.simpleString(
629639
"indices.time_series_index.default_index_merge_policy",
630640
DEFAULT_POLICY,
@@ -816,7 +826,10 @@ private void setRetentionLeaseMillis(final TimeValue retentionLease) {
816826
* Specialized merge-on-flush policy if provided
817827
*/
818828
private volatile UnaryOperator<MergePolicy> mergeOnFlushPolicy;
819-
829+
/**
830+
* Is flush check by write threads enabled or not
831+
*/
832+
private final boolean checkPendingFlushEnabled;
820833
/**
821834
* Is fuzzy set enabled for doc id
822835
*/
@@ -958,6 +971,7 @@ public IndexSettings(final IndexMetadata indexMetadata, final Settings nodeSetti
958971
maxFullFlushMergeWaitTime = scopedSettings.get(INDEX_MERGE_ON_FLUSH_MAX_FULL_FLUSH_MERGE_WAIT_TIME);
959972
mergeOnFlushEnabled = scopedSettings.get(INDEX_MERGE_ON_FLUSH_ENABLED);
960973
setMergeOnFlushPolicy(scopedSettings.get(INDEX_MERGE_ON_FLUSH_POLICY));
974+
checkPendingFlushEnabled = scopedSettings.get(INDEX_CHECK_PENDING_FLUSH_ENABLED);
961975
defaultSearchPipeline = scopedSettings.get(DEFAULT_SEARCH_PIPELINE);
962976
/* There was unintentional breaking change got introduced with [OpenSearch-6424](https://github.com/opensearch-project/OpenSearch/pull/6424) (version 2.7).
963977
* For indices created prior version (prior to 2.7) which has IndexSort type, they used to type cast the SortField.Type
@@ -1844,6 +1858,10 @@ private void setMergeOnFlushPolicy(String policy) {
18441858
}
18451859
}
18461860

1861+
public boolean isCheckPendingFlushEnabled() {
1862+
return checkPendingFlushEnabled;
1863+
}
1864+
18471865
public Optional<UnaryOperator<MergePolicy>> getMergeOnFlushPolicy() {
18481866
return Optional.ofNullable(mergeOnFlushPolicy);
18491867
}

server/src/main/java/org/opensearch/index/engine/InternalEngine.java

+1
Original file line numberDiff line numberDiff line change
@@ -2473,6 +2473,7 @@ private IndexWriterConfig getIndexWriterConfig() {
24732473
iwc.setMaxFullFlushMergeWaitMillis(0);
24742474
}
24752475

2476+
iwc.setCheckPendingFlushUpdate(config().getIndexSettings().isCheckPendingFlushEnabled());
24762477
iwc.setMergePolicy(new OpenSearchMergePolicy(mergePolicy));
24772478
iwc.setSimilarity(engineConfig.getSimilarity());
24782479
iwc.setRAMBufferSizeMB(engineConfig.getIndexingBufferSize().getMbFrac());

0 commit comments

Comments
 (0)