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 6a39e8a

Browse files
CaptainDredgePrabhat Sharma
and
Prabhat Sharma
committedMar 20, 2024
Added static setting for checkPendingFlushUpdate functionality of lucene writer (opensearch-project#12710)
Signed-off-by: Prabhat Sharma <ptsharma@amazon.com> Co-authored-by: Prabhat Sharma <ptsharma@amazon.com> (cherry picked from commit c369ec4)
1 parent ff820ed commit 6a39e8a

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
@@ -48,6 +48,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
4848
- Support index level allocation filtering for searchable snapshot index ([#11563](https://github.com/opensearch-project/OpenSearch/pull/11563))
4949
- [S3 Repository] Add setting to control connection count for sync client ([#12028](https://github.com/opensearch-project/OpenSearch/pull/12028))
5050
- Add support for Google Application Default Credentials in repository-gcs ([#8394](https://github.com/opensearch-project/OpenSearch/pull/8394))
51+
- 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))
5152

5253
### Dependencies
5354
- Bumps jetty version to 9.4.52.v20230823 to fix GMS-2023-1857 ([#9822](https://github.com/opensearch-project/OpenSearch/pull/9822))

‎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
@@ -613,6 +613,16 @@ public static IndexMergePolicy fromString(String text) {
613613
Property.IndexScope
614614
);
615615

616+
/**
617+
* Expert: Makes indexing threads check for pending flushes on update in order to help out
618+
* flushing indexing buffers to disk. This is an experimental Apache Lucene feature.
619+
*/
620+
public static final Setting<Boolean> INDEX_CHECK_PENDING_FLUSH_ENABLED = Setting.boolSetting(
621+
"index.check_pending_flush.enabled",
622+
true,
623+
Property.IndexScope
624+
);
625+
616626
public static final Setting<String> TIME_SERIES_INDEX_MERGE_POLICY = Setting.simpleString(
617627
"indices.time_series_index.default_index_merge_policy",
618628
DEFAULT_POLICY,
@@ -786,7 +796,10 @@ private void setRetentionLeaseMillis(final TimeValue retentionLease) {
786796
* Specialized merge-on-flush policy if provided
787797
*/
788798
private volatile UnaryOperator<MergePolicy> mergeOnFlushPolicy;
789-
799+
/**
800+
* Is flush check by write threads enabled or not
801+
*/
802+
private final boolean checkPendingFlushEnabled;
790803
/**
791804
* Returns the default search fields for this index.
792805
*/
@@ -917,6 +930,7 @@ public IndexSettings(final IndexMetadata indexMetadata, final Settings nodeSetti
917930
maxFullFlushMergeWaitTime = scopedSettings.get(INDEX_MERGE_ON_FLUSH_MAX_FULL_FLUSH_MERGE_WAIT_TIME);
918931
mergeOnFlushEnabled = scopedSettings.get(INDEX_MERGE_ON_FLUSH_ENABLED);
919932
setMergeOnFlushPolicy(scopedSettings.get(INDEX_MERGE_ON_FLUSH_POLICY));
933+
checkPendingFlushEnabled = scopedSettings.get(INDEX_CHECK_PENDING_FLUSH_ENABLED);
920934
defaultSearchPipeline = scopedSettings.get(DEFAULT_SEARCH_PIPELINE);
921935
/* There was unintentional breaking change got introduced with [OpenSearch-6424](https://github.com/opensearch-project/OpenSearch/pull/6424) (version 2.7).
922936
* For indices created prior version (prior to 2.7) which has IndexSort type, they used to type cast the SortField.Type
@@ -1782,6 +1796,10 @@ private void setMergeOnFlushPolicy(String policy) {
17821796
}
17831797
}
17841798

1799+
public boolean isCheckPendingFlushEnabled() {
1800+
return checkPendingFlushEnabled;
1801+
}
1802+
17851803
public Optional<UnaryOperator<MergePolicy>> getMergeOnFlushPolicy() {
17861804
return Optional.ofNullable(mergeOnFlushPolicy);
17871805
}

‎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)
Please sign in to comment.