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

Add file cache restore logic #6538

Merged
merged 1 commit into from
Mar 9, 2023

Conversation

kotwanikunal
Copy link
Member

Description

  • Add support to restore the file cache on node bootstrap

Issues Resolved

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
  • Commit changes are listed out in CHANGELOG.md file (See: Changelog)

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.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2023

Gradle Check (Jenkins) Run Completed with:

if (subPathFile.isFile()) {
fileCache.put(
subPathFile.toPath().toRealPath(),
new FileCachedIndexInput.ClosedIndexInput(subPathFile.length())
Copy link
Member

Choose a reason for hiding this comment

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

This is so gross, but I understand why you're doing it. I think we should be caching a pointer to a chunk on disk instead of an InputIndex (we can create an IndexInput for the file chunk on demand when it is needed) but that is a bigger cache refactoring discussion.

Copy link
Member Author

Choose a reason for hiding this comment

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

Should we create an issue to track this?

@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2023

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2023

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2023

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2023

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      1 org.opensearch.client.ReindexIT.testReindexTask

@codecov-commenter
Copy link

codecov-commenter commented Mar 8, 2023

Codecov Report

Merging #6538 (c25a4d9) into main (8c0e5d0) will increase coverage by 0.03%.
The diff coverage is 60.00%.

❗ Current head c25a4d9 differs from pull request most recent head c034a88. Consider uploading reports for the commit c034a88 to get more accurate results

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@             Coverage Diff              @@
##               main    #6538      +/-   ##
============================================
+ Coverage     70.77%   70.80%   +0.03%     
+ Complexity    59125    59106      -19     
============================================
  Files          4804     4804              
  Lines        283098   283128      +30     
  Branches      40813    40813              
============================================
+ Hits         200372   200481     +109     
+ Misses        66269    66206      -63     
+ Partials      16457    16441      -16     
Impacted Files Coverage Δ
...x/store/remote/filecache/FileCachedIndexInput.java 50.00% <33.33%> (-5.56%) ⬇️
...search/index/store/remote/filecache/FileCache.java 84.61% <75.00%> (-6.69%) ⬇️
.../main/java/org/opensearch/env/NodeEnvironment.java 76.47% <100.00%> (-0.10%) ⬇️
...pensearch/client/cluster/RemoteConnectionInfo.java 0.00% <0.00%> (-68.30%) ⬇️
...n/admin/cluster/node/tasks/get/GetTaskRequest.java 30.30% <0.00%> (-63.64%) ⬇️
...a/org/opensearch/client/cluster/ProxyModeInfo.java 0.00% <0.00%> (-55.00%) ⬇️
...r/src/main/java/org/opensearch/http/HttpUtils.java 16.66% <0.00%> (-50.00%) ⬇️
.../java/org/opensearch/node/NodeClosedException.java 50.00% <0.00%> (-50.00%) ⬇️
...ava/org/opensearch/action/NoSuchNodeException.java 0.00% <0.00%> (-50.00%) ⬇️
.../action/admin/indices/flush/ShardFlushRequest.java 50.00% <0.00%> (-50.00%) ⬇️
... and 478 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

}

NodesStatsResponse postRestoreStats = client().admin().cluster().nodesStats(new NodesStatsRequest().all()).actionGet();
java.util.Map<String, NodeStats> preRestoreStatsMap = preRestoreStats.getNodesMap();
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick, but you can you change the import on line 27 use java.util.Map so that you don't have to do the fully qualified thing here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated.

Signed-off-by: Kunal Kotwani <[email protected]>
@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2023

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2023

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      2 org.opensearch.indices.replication.SegmentReplicationAllocationIT.testAllocationWithDisruption

@andrross andrross merged commit 16535b9 into opensearch-project:main Mar 9, 2023
opensearch-trigger-bot bot pushed a commit that referenced this pull request Mar 9, 2023
Signed-off-by: Kunal Kotwani <[email protected]>
(cherry picked from commit 16535b9)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
kotwanikunal pushed a commit that referenced this pull request Mar 9, 2023
(cherry picked from commit 16535b9)

Signed-off-by: Kunal Kotwani <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
mingshl pushed a commit to mingshl/OpenSearch-Mingshl that referenced this pull request Mar 24, 2023
Signed-off-by: Kunal Kotwani <[email protected]>
Signed-off-by: Mingshi Liu <[email protected]>
@kotwanikunal kotwanikunal deleted the cache-restore branch May 12, 2023 19:53
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 skip-changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Searchable Snapshot] Implement cache restore mechanism and track phantom files
3 participants