Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 36a7c7e

Browse files
author
Prabhat Sharma
committedMar 20, 2024·
Added static setting for checkPendingFlushUpdate functionality of lucene writer
Signed-off-by: Prabhat Sharma <ptsharma@amazon.com>
1 parent dda3e3d commit 36a7c7e

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed
 

‎CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
118118
- [Tiered caching] Add Stale keys Management and CacheCleaner to IndicesRequestCache ([#12625](https://github.com/opensearch-project/OpenSearch/pull/12625))
119119
- [Tiered caching] Add serializer integration to allow ehcache disk cache to use non-primitive values ([#12709](https://github.com/opensearch-project/OpenSearch/pull/12709))
120120
- [Admission Control] Integrated IO Based AdmissionController to AdmissionControl Framework ([#12583](https://github.com/opensearch-project/OpenSearch/pull/12583))
121+
- 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))
121122

122123
### Dependencies
123124
- Bump `peter-evans/find-comment` from 2 to 3 ([#12288](https://github.com/opensearch-project/OpenSearch/pull/12288))

‎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
@@ -624,6 +624,16 @@ public static IndexMergePolicy fromString(String text) {
624624
Property.IndexScope
625625
);
626626

627+
/**
628+
* Expert: Makes indexing threads check for pending flushes on update in order to help out
629+
* flushing indexing buffers to disk. This is an Apache Lucene feature.
630+
*/
631+
public static final Setting<Boolean> INDEX_CHECK_PENDING_FLUSH_ENABLED = Setting.boolSetting(
632+
"index.check_pending_flush.enabled",
633+
true,
634+
Property.IndexScope
635+
);
636+
627637
public static final Setting<String> TIME_SERIES_INDEX_MERGE_POLICY = Setting.simpleString(
628638
"indices.time_series_index.default_index_merge_policy",
629639
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
*/
@@ -959,6 +972,7 @@ public IndexSettings(final IndexMetadata indexMetadata, final Settings nodeSetti
959972
maxFullFlushMergeWaitTime = scopedSettings.get(INDEX_MERGE_ON_FLUSH_MAX_FULL_FLUSH_MERGE_WAIT_TIME);
960973
mergeOnFlushEnabled = scopedSettings.get(INDEX_MERGE_ON_FLUSH_ENABLED);
961974
setMergeOnFlushPolicy(scopedSettings.get(INDEX_MERGE_ON_FLUSH_POLICY));
975+
checkPendingFlushEnabled = scopedSettings.get(INDEX_CHECK_PENDING_FLUSH_ENABLED);
962976
defaultSearchPipeline = scopedSettings.get(DEFAULT_SEARCH_PIPELINE);
963977
/* There was unintentional breaking change got introduced with [OpenSearch-6424](https://github.com/opensearch-project/OpenSearch/pull/6424) (version 2.7).
964978
* 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
@@ -2336,6 +2336,7 @@ private IndexWriterConfig getIndexWriterConfig() {
23362336
iwc.setMaxFullFlushMergeWaitMillis(0);
23372337
}
23382338

2339+
iwc.setCheckPendingFlushUpdate(config().getIndexSettings().isCheckPendingFlushEnabled());
23392340
iwc.setMergePolicy(new OpenSearchMergePolicy(mergePolicy));
23402341
iwc.setSimilarity(engineConfig.getSimilarity());
23412342
iwc.setRAMBufferSizeMB(engineConfig.getIndexingBufferSize().getMbFrac());

0 commit comments

Comments
 (0)
Please sign in to comment.