-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
File System Caching for remote store #5641
File System Caching for remote store #5641
Conversation
Gradle Check (Jenkins) Run Completed with:
|
Codecov Report
@@ Coverage Diff @@
## main #5641 +/- ##
============================================
- Coverage 71.13% 70.90% -0.24%
+ Complexity 58648 58630 -18
============================================
Files 4759 4773 +14
Lines 279468 280088 +620
Branches 40343 40394 +51
============================================
- Hits 198803 198583 -220
- Misses 64440 65308 +868
+ Partials 16225 16197 -28
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
* | ||
* @opensearch.internal | ||
*/ | ||
public final class LinkedDeque<E extends Linked<E>> extends AbstractCollection<E> implements Deque<E> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know where this implementation comes from? It seems to be widely copied into projects on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really what I'm getting at is whether we need to implement this data structure or if we can use something built into the JDK instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know where this implementation comes from? It seems to be widely copied into projects on GitHub.
No, I don't know where this file originally came from. But I see almost all cache implementations (Guava, Caffeine, ...) have this and no I'm not aware of any Java built in alternative
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andrross this copied from [1], which is the predecessor of [2], we should not be doing that (IMHO)
[1] https://github.com/ben-manes/concurrentlinkedhashmap/
[2] https://github.com/ben-manes/caffeine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@reta There's now more details about why we're doing this in #4964. I would love to find a library implementation we can use for this and the caching logic in general, but at the moment we don't have one and I'd like to keep making incremental progress here. #6225 has been opened to track that effort.
Also, for additional context, this and other code in this PR has been adapted from UltraWarm (see the commit message) which is another reason why this implementation is our first approach.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andrross sure, have a suggestion here (#5641 (comment)) on isolating this code (in separate library)
server/src/main/java/org/opensearch/index/store/remote/utils/TransferManager.java
Show resolved
Hide resolved
* @return the difference between this instance and {@code other} | ||
*/ | ||
|
||
public CacheStats minus(CacheStats other) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the plus()
and minus()
methods used anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope they are not used anywhere for now but there are few more methods which are not used but will be used once cache stats is exposed to nodes stats and maybe plus
will be one of them. For now will remove plus
and minus
and if needed will add them back
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the unused code, methods will be introduced when needed
* @opensearch.internal | ||
*/ | ||
class LRUCache<K, V> implements RefCountedCache<K, V> { | ||
private long capacity; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can all these fields be final?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
made them final
@aabukhalil What are we doing with this PR? |
new commit should be uploaded today |
c80e883
to
b940bb0
Compare
Gradle Check (Jenkins) Run Completed with:
|
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.index.store.remote.utils.cache; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nknize What do you think about the location for this code? I kind of like keeping it contained here until either it matures a bit or we replace it with something else. But marking it experimental in the opensearch-commons
library essentially accomplishes the same thing, so I'm happy to defer to your preference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put my thoughts in the comments below..
49757a5
to
ff26dde
Compare
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
@andrross @nknize since we are copying a large chunk of specialized code, may be we could move it off to separate module |
*/ | ||
public class SegmentedCache<K, V> implements RefCountedCache<K, V> { | ||
|
||
private static final int HASH_BITS = 0x7fffffff; // usable bits of normal ActivenessAwareCache hash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ActivenessAwareCache
, some leftovers from UltraWarm need clearing :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes :)
I don't think we want to introduce a whole new
I would like to pull it out of How about this: could we refactor the entire remote store implementation to a I realize I didn't jump into the original PR conversation and raise the plugin / module question. Since it's already released as a part of 2.5 I think that takes away the plugin option. |
@@ -136,7 +136,7 @@ public void testMultivaluedGeoPointsAggregation() throws Exception { | |||
* | |||
* @param geometry {@link Geometry} | |||
* @param geoShapeDocValue {@link GeoShapeDocValue} | |||
* @param intersectingWithBB | |||
* @param intersectingWithBB enable intersectingWithBB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strange this change crept into this unrelated PR. spotless?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is failing on gradlew precommit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you building with JDK 14? We've seen weirdness with JDK 14 enforcing some javadoc rules in tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes I'm building with JDK 14
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.index.store.remote.utils.cache; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put my thoughts in the comments below..
@nknize The generic cache and the more specific "FileCache" components can be moved around quite easily I think. As for making the whole thing a module, I'm sure that's possible but if my understanding is correct we'll have to make sure we have all the necessary extension points in the Plugin interface. I honestly don't know the scope of that but we can definitely explore it. |
ff26dde
to
f3f4f04
Compare
Gradle Check (Jenkins) Run Completed with:
|
This sounds like a good follow on PR. I'm happy to help out here as well. Thoughts @reta? |
+1 from me as well |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm good with this PR, though we've got some new items to follow up on going forward.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 LGTM! Thx all!
Part of this commit was developed from code and concepts initially implemented in Amazon OpenSearch Service as part of the UltraWarm feature. Thank you to the following developers and the entire UltraWarm team. Co-authored-by: Min Zhou <minzho@amazon.com> Co-authored-by: Ankit Malpani <malpani@amazon.com> Co-authored-by: Rohit Nair <rohinair@amazon.com> Co-authored-by: Sorabh Hamirwasia <hsorabh@amazon.com> Co-authored-by: Ankit Jain <akjain@amazon.com> Co-authored-by: Tianru Zhou <tianruz@amazon.com> Co-authored-by: Neetika Singhal <neetiks@amazon.com> Co-authored-by: Amit Khandelwal <mkhnde@amazon.com> Co-authored-by: Vigya Sharma <vigyas@amazon.com> Co-authored-by: Prateek Sharma <shrprat@amazon.com> Co-authored-by: Venkata Jyothsna Donapati <donapv@amazon.com> Co-authored-by: Vlad Rozov <vrozov@amazon.com> Co-authored-by: Mohit Agrawal <agramohi@amazon.com> Co-authored-by: Shweta Thareja <tharejas@amazon.com> Co-authored-by: Palash Hedau <phhedau@amazon.com> Co-authored-by: Saurabh Singh <sisurab@amazon.com> Co-authored-by: Piyush Daftary <pdaftary@amazon.com> Co-authored-by: Payal Maheshwari <pmaheshw@amazon.com> Co-authored-by: Kunal Khatua <kkhatua@amazon.com> Co-authored-by: Gulshan Kumar <kumargu@amazon.com> Co-authored-by: Rushi Agrawal <agrrushi@amazon.com> Co-authored-by: Ketan Verma <vermketa@amazon.com> Co-authored-by: Gaurav Chandani <chngau@amazon.com> Co-authored-by: Dharmesh Singh <sdharms@amazon.com> Signed-off-by: Ahmad AbuKhalil <abukhali@amazon.com>
f3f4f04
to
c6d46cf
Compare
Gradle Check (Jenkins) Run Completed with:
|
Windows precommit failed with an out of memory error, so almost certainly unrelated. Retrying... |
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-5641-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 0ca51a774211184835c4825dfeff38b23198352e
# Push it to GitHub
git push --set-upstream origin backport/backport-5641-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/backport-2.x Then, create a pull request where the |
…oject#5641) Part of this commit was developed from code and concepts initially implemented in Amazon OpenSearch Service as part of the UltraWarm feature. Thank you to the following developers and the entire UltraWarm team. Co-authored-by: Min Zhou <minzho@amazon.com> Co-authored-by: Ankit Malpani <malpani@amazon.com> Co-authored-by: Rohit Nair <rohinair@amazon.com> Co-authored-by: Sorabh Hamirwasia <hsorabh@amazon.com> Co-authored-by: Ankit Jain <akjain@amazon.com> Co-authored-by: Tianru Zhou <tianruz@amazon.com> Co-authored-by: Neetika Singhal <neetiks@amazon.com> Co-authored-by: Amit Khandelwal <mkhnde@amazon.com> Co-authored-by: Vigya Sharma <vigyas@amazon.com> Co-authored-by: Prateek Sharma <shrprat@amazon.com> Co-authored-by: Venkata Jyothsna Donapati <donapv@amazon.com> Co-authored-by: Vlad Rozov <vrozov@amazon.com> Co-authored-by: Mohit Agrawal <agramohi@amazon.com> Co-authored-by: Shweta Thareja <tharejas@amazon.com> Co-authored-by: Palash Hedau <phhedau@amazon.com> Co-authored-by: Saurabh Singh <sisurab@amazon.com> Co-authored-by: Piyush Daftary <pdaftary@amazon.com> Co-authored-by: Payal Maheshwari <pmaheshw@amazon.com> Co-authored-by: Kunal Khatua <kkhatua@amazon.com> Co-authored-by: Gulshan Kumar <kumargu@amazon.com> Co-authored-by: Rushi Agrawal <agrrushi@amazon.com> Co-authored-by: Ketan Verma <vermketa@amazon.com> Co-authored-by: Gaurav Chandani <chngau@amazon.com> Co-authored-by: Dharmesh Singh <sdharms@amazon.com> Signed-off-by: Ahmad AbuKhalil <abukhali@amazon.com> (cherry picked from commit 0ca51a7)
…oject#5641) Part of this commit was developed from code and concepts initially implemented in Amazon OpenSearch Service as part of the UltraWarm feature. Thank you to the following developers and the entire UltraWarm team. Co-authored-by: Min Zhou <minzho@amazon.com> Co-authored-by: Ankit Malpani <malpani@amazon.com> Co-authored-by: Rohit Nair <rohinair@amazon.com> Co-authored-by: Sorabh Hamirwasia <hsorabh@amazon.com> Co-authored-by: Ankit Jain <akjain@amazon.com> Co-authored-by: Tianru Zhou <tianruz@amazon.com> Co-authored-by: Neetika Singhal <neetiks@amazon.com> Co-authored-by: Amit Khandelwal <mkhnde@amazon.com> Co-authored-by: Vigya Sharma <vigyas@amazon.com> Co-authored-by: Prateek Sharma <shrprat@amazon.com> Co-authored-by: Venkata Jyothsna Donapati <donapv@amazon.com> Co-authored-by: Vlad Rozov <vrozov@amazon.com> Co-authored-by: Mohit Agrawal <agramohi@amazon.com> Co-authored-by: Shweta Thareja <tharejas@amazon.com> Co-authored-by: Palash Hedau <phhedau@amazon.com> Co-authored-by: Saurabh Singh <sisurab@amazon.com> Co-authored-by: Piyush Daftary <pdaftary@amazon.com> Co-authored-by: Payal Maheshwari <pmaheshw@amazon.com> Co-authored-by: Kunal Khatua <kkhatua@amazon.com> Co-authored-by: Gulshan Kumar <kumargu@amazon.com> Co-authored-by: Rushi Agrawal <agrrushi@amazon.com> Co-authored-by: Ketan Verma <vermketa@amazon.com> Co-authored-by: Gaurav Chandani <chngau@amazon.com> Co-authored-by: Dharmesh Singh <sdharms@amazon.com> Signed-off-by: Ahmad AbuKhalil <abukhali@amazon.com> (cherry picked from commit 0ca51a7) Signed-off-by: Andrew Ross <andrross@amazon.com>
Part of this commit was developed from code and concepts initially implemented in Amazon OpenSearch Service as part of the UltraWarm feature. Thank you to the following developers and the entire UltraWarm team. Co-authored-by: Min Zhou <minzho@amazon.com> Co-authored-by: Ankit Malpani <malpani@amazon.com> Co-authored-by: Rohit Nair <rohinair@amazon.com> Co-authored-by: Sorabh Hamirwasia <hsorabh@amazon.com> Co-authored-by: Ankit Jain <akjain@amazon.com> Co-authored-by: Tianru Zhou <tianruz@amazon.com> Co-authored-by: Neetika Singhal <neetiks@amazon.com> Co-authored-by: Amit Khandelwal <mkhnde@amazon.com> Co-authored-by: Vigya Sharma <vigyas@amazon.com> Co-authored-by: Prateek Sharma <shrprat@amazon.com> Co-authored-by: Venkata Jyothsna Donapati <donapv@amazon.com> Co-authored-by: Vlad Rozov <vrozov@amazon.com> Co-authored-by: Mohit Agrawal <agramohi@amazon.com> Co-authored-by: Shweta Thareja <tharejas@amazon.com> Co-authored-by: Palash Hedau <phhedau@amazon.com> Co-authored-by: Saurabh Singh <sisurab@amazon.com> Co-authored-by: Piyush Daftary <pdaftary@amazon.com> Co-authored-by: Payal Maheshwari <pmaheshw@amazon.com> Co-authored-by: Kunal Khatua <kkhatua@amazon.com> Co-authored-by: Gulshan Kumar <kumargu@amazon.com> Co-authored-by: Rushi Agrawal <agrrushi@amazon.com> Co-authored-by: Ketan Verma <vermketa@amazon.com> Co-authored-by: Gaurav Chandani <chngau@amazon.com> Co-authored-by: Dharmesh Singh <sdharms@amazon.com> (cherry picked from commit 0ca51a7) Signed-off-by: Ahmad AbuKhalil <abukhali@amazon.com> Signed-off-by: Andrew Ross <andrross@amazon.com> Co-authored-by: Ahmad AbuKhalil <abukhali@amazon.com>
Signed-off-by: Ahmad AbuKhalil abukhali@amazon.com
Description
Implement FileSystem Tracking LRU Cache with RefCounting
Part of this commit was developed from code and concepts initially implemented
in Amazon OpenSearch Service as part of the UltraWarm feature.
Issues Resolved
#4965
Check List
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.