-
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
[Draft] Refactor remote store within existing index shard store #7904
[Draft] Refactor remote store within existing index shard store #7904
Conversation
Gradle Check (Jenkins) Run Completed with:
|
Codecov Report
@@ Coverage Diff @@
## main #7904 +/- ##
============================================
+ Coverage 70.78% 70.82% +0.03%
- Complexity 56251 56264 +13
============================================
Files 4689 4689
Lines 266304 266305 +1
Branches 39086 39086
============================================
+ Hits 188505 188610 +105
+ Misses 61847 61765 -82
+ Partials 15952 15930 -22
|
Signed-off-by: Kunal Kotwani <kkotwani@amazon.com>
45d94d6
to
5eae0a7
Compare
Gradle Check (Jenkins) Run Completed with:
|
@Bukhtawar / @sachinpkale / @andrross The relation would be as follows -
We can further enhance the store operations to perform operations between directories, for example, in case of a writeable index perform local + remote writes within a single operation. Thoughts? |
@@ -119,7 +119,7 @@ public RemoteStoreRefreshListener( | |||
) { | |||
this.indexShard = indexShard; | |||
this.storeDirectory = indexShard.store().directory(); | |||
this.remoteDirectory = (RemoteSegmentStoreDirectory) ((FilterDirectory) ((FilterDirectory) indexShard.remoteStore().directory()) | |||
this.remoteDirectory = (RemoteSegmentStoreDirectory) ((FilterDirectory) ((FilterDirectory) indexShard.store().remoteDirectory()) |
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.
Is there any way to avoid doing all these casts? We're plumbing in the explicit concept of a remote directory into the store, so can it store and expose that directory as an explicit remote directory type to avoid the need for the consumers to unwrap and cast?
This really isn't following the principles of object oriented programming because even though the type is exposed as the a generic Directory, the consumers require this to be a very specific type (a FilterDirectory wrapping a FilterDirectory wrapping a RemoteSegmentStoreDirectory) or else it will fail at runtime. If the consumers can't be made agnostic to the specific type, then it would probably be better to be explicit about the type and let the compiler enforce it.
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.
Agree, I think this is just a workaround as RemoteDirectory
does not support all the methods in the directory. We need to get away from this and should be used as a drop-in replacement for any directory.
I think there was a work item pending from the Remote Store initial implementation days #3719. The reason behind a composite store was to make the intent of local and remote store working in tandem more explicit and not optional(if remote store is enabled) Why Store and not Directory? |
Thanks for the response @Bukhtawar. The metadata seems to be fetched at run time from the directory and I had the proposal to add
The above pattern adds in a lot of delegation to the local store for most of these functions which seems to be not so ideal IMO. |
I would like us to think more from a cloud native architecture where metadata is free to be stored elsewhere and doesn't have to reside/consume the same Directory interface. The delegation can be handled by making Store abstract and keeping common business logic there. That way remote store has a clear way to extend the same |
When we started the implementation of remote store for the first time, one approach tried was to include remote directory in the store which is the same approach that is implemented in this PR (I used to call it as primary and secondary directory). There are two problems with this approach:
IMO, Store should not use more than one directory. Having a |
Any implementation requiring a single |
Thanks for the detailed info @Bukhtawar! I do not plan to merge #7960 in since it requires better documentation/tests/productionization and is only incremental in its current form. |
Description
Related Issues
Resolves #[Issue number to be closed when this PR is merged]
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.