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

Make HybridDirectory MMAP Extensions Configurable #3837

Merged
merged 2 commits into from
Jul 21, 2022

Conversation

mattweber
Copy link
Contributor

Make the HybridDirectory's list of mmap extensions configurable
via index settings instead of being hard-coded.
Set defaults to the list of currently hard-coded values for
backwards compatibility.

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@mattweber mattweber requested review from a team and reta as code owners July 9, 2022 23:42
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@mattweber
Copy link
Contributor Author

@reta can you please rerun the tests, failure seems unrelated so I opened #3838.

@reta
Copy link
Collaborator

reta commented Jul 10, 2022

@reta can you please rerun the tests, failure seems unrelated so I opened #3838.

@mattweber I believe we need to get #3807 first, working on it

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@mattweber
Copy link
Contributor Author

thanks @reta

@reta
Copy link
Collaborator

reta commented Jul 10, 2022

thanks @reta

@mattweber could you rebase please?

Make the HybridDirectory's list of mmap extensions configurable
via index settings instead of being hard-coded to a specfic set.
Set defaults to the list of currently hard-coded values for
backwards compatibility.

Signed-off-by: Matt Weber <matt@mattweber.org>
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@codecov-commenter
Copy link

Codecov Report

Merging #3837 (8a264c5) into main (bfac8fc) will increase coverage by 0.07%.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##               main    #3837      +/-   ##
============================================
+ Coverage     70.52%   70.60%   +0.07%     
- Complexity    56655    56673      +18     
============================================
  Files          4557     4557              
  Lines        272682   272685       +3     
  Branches      40038    40037       -1     
============================================
+ Hits         192310   192522     +212     
+ Misses        64203    63915     -288     
- Partials      16169    16248      +79     
Impacted Files Coverage Δ
...pensearch/common/settings/IndexScopedSettings.java 100.00% <ø> (ø)
...rc/main/java/org/opensearch/index/IndexModule.java 82.03% <100.00%> (+0.32%) ⬆️
...org/opensearch/index/store/FsDirectoryFactory.java 77.61% <100.00%> (ø)
...pensearch/client/cluster/RemoteConnectionInfo.java 0.00% <0.00%> (-73.18%) ⬇️
...a/org/opensearch/client/cluster/SniffModeInfo.java 0.00% <0.00%> (-58.83%) ⬇️
...a/org/opensearch/client/cluster/ProxyModeInfo.java 0.00% <0.00%> (-55.00%) ⬇️
.../opensearch/client/indices/CloseIndexResponse.java 42.50% <0.00%> (-48.75%) ⬇️
...opensearch/persistent/PersistentTasksExecutor.java 22.22% <0.00%> (-44.45%) ⬇️
.../search/aggregations/pipeline/HoltLinearModel.java 20.33% <0.00%> (-42.38%) ⬇️
.../opensearch/client/cluster/RemoteInfoResponse.java 61.53% <0.00%> (-38.47%) ⬇️
... and 495 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bfac8fc...8a264c5. Read the comment docs.

@dblock dblock requested a review from mch2 July 11, 2022 21:48
@@ -97,9 +97,10 @@ protected Directory newFSDirectory(Path location, LockFactory lockFactory, Index
case HYBRIDFS:
// Use Lucene defaults
final FSDirectory primaryDirectory = FSDirectory.open(location, lockFactory);
final Set<String> mmapExtensions = new HashSet<>(indexSettings.getValue(IndexModule.INDEX_STORE_HYBRID_MMAP_EXTENSIONS));
Copy link
Collaborator

@reta reta Jul 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mattweber I am trying to wrap my head around these two properties INDEX_STORE_PRE_LOAD_SETTING and INDEX_STORE_HYBRID_MMAP_EXTENSIONS, which apparently serve the same purpose (and do have same set of values), the HybridDirectory is looking like PreLoadMMapDirectory (except the setPreload thing) ... why do we need both?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@reta INDEX_STORE_PRE_LOAD_SETTING controls which files automatically get loaded into os cache and I don't believe this has any defaults as it is an expensive operation. This PR adds INDEX_STORE_HYBRID_MMAP_EXTENSIONS which controls which extensions are with opened with mmap store. The current defaults were picked by elastic after doing benchmarks. I would like it configurable so a user can tune to their specific usecase. For example, I want to mmap everything EXCEPT stored fields. The settings are related, but not the same.

@mattweber
Copy link
Contributor Author

Thanks @reta! @dblock what do you think about this?

@dblock
Copy link
Member

dblock commented Jul 14, 2022

I know nothing about this stuff, let's have @mch2 take a look for a second pair of 👀 ?

@@ -148,6 +148,14 @@ public final class IndexModule {
Property.NodeScope
);

public static final Setting<List<String>> INDEX_STORE_HYBRID_MMAP_EXTENSIONS = Setting.listSetting(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an expert parameter which, I suspect, few are going to touch. Can we javadoc this as expert with a description similar to above?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nknize sure can

List.of("nvd", "dvd", "tim", "tip", "dim", "kdd", "kdi", "cfs", "doc"),
Function.identity(),
Property.IndexScope,
Property.NodeScope
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also want to set this as a final setting (Property.Final)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nknize I don't think so, I would want to be able to change this by closing index, updating setting, then reopening. I thought final would prevent that scenario, but I could be wrong since I am not super familiar with that setting.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would prevent that scenario. +1 to go w/o final.

Signed-off-by: Matt Weber <matt@mattweber.org>
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@mattweber
Copy link
Contributor Author

@nknize @reta please kick off tests again, unrelated failures

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@mattweber
Copy link
Contributor Author

@nknize @mch2 see any issues with this? Hope to get it in and backported to 2x so it will make one of the next releases. Thanks.

Copy link
Collaborator

@nknize nknize left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Sorry for the hold up.

List.of("nvd", "dvd", "tim", "tip", "dim", "kdd", "kdi", "cfs", "doc"),
Function.identity(),
Property.IndexScope,
Property.NodeScope
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would prevent that scenario. +1 to go w/o final.

Copy link
Member

@mch2 mch2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry had to do some homework to understand the settings. I have no concerns.

@dblock dblock merged commit b08a2b8 into opensearch-project:main Jul 21, 2022
@dblock dblock added backport 2.x Backport to 2.x branch documentation pending Tracks issues which have PRs merged but documentation changes pending labels Jul 21, 2022
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jul 21, 2022
* Make HybridDirectory MMAP Extensions Configurable

Make the HybridDirectory's list of mmap extensions configurable
via index settings instead of being hard-coded to a specfic set.
Set defaults to the list of currently hard-coded values for
backwards compatibility.

Signed-off-by: Matt Weber <matt@mattweber.org>

* Add javadoc to INDEX_STORE_HYBRID_MMAP_EXTENSIONS.

Signed-off-by: Matt Weber <matt@mattweber.org>
(cherry picked from commit b08a2b8)
dblock pushed a commit that referenced this pull request Jul 21, 2022
* Make HybridDirectory MMAP Extensions Configurable

Make the HybridDirectory's list of mmap extensions configurable
via index settings instead of being hard-coded to a specfic set.
Set defaults to the list of currently hard-coded values for
backwards compatibility.

Signed-off-by: Matt Weber <matt@mattweber.org>

* Add javadoc to INDEX_STORE_HYBRID_MMAP_EXTENSIONS.

Signed-off-by: Matt Weber <matt@mattweber.org>
(cherry picked from commit b08a2b8)

Co-authored-by: Matt Weber <matt@mattweber.org>
@nknize nknize mentioned this pull request Aug 28, 2023
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport to 2.x branch documentation pending Tracks issues which have PRs merged but documentation changes pending
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants