-
Notifications
You must be signed in to change notification settings - Fork 59
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
For segrep enabled indices, use NRTReplicationEngine for replica shards #486
Conversation
Signed-off-by: Suraj Singh <surajrider@gmail.com>
src/main/kotlin/org/opensearch/replication/ReplicationPlugin.kt
Outdated
Show resolved
Hide resolved
Signed-off-by: Suraj Singh <surajrider@gmail.com>
197a35e
to
9048b02
Compare
Optional.of(EngineFactory { config -> ReplicationEngine(config) }) | ||
Optional.of(EngineFactory { config -> | ||
// Use NRTSegmentReplicationEngine for SEGMENT replication type indices replica shards | ||
if (config.isReadOnlyReplica && indexSettings.settings.get(INDEX_REPLICATION_TYPE_SETTING.key) != null && indexSettings.settings.get(INDEX_REPLICATION_TYPE_SETTING.key).equals("SEGMENT")) { |
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.
- we can drop explicit
null
check and use "?" instead for obtaining replication type setting. - Can we use constant for "SEGMENT" (from the allowed values)?
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.
Looks like config.isReadOnlyReplica
already have segrep settings check inside EngineConfig. Removing segrep setting explicit check.
public boolean isReadOnlyReplica() {
return indexSettings.isSegRepEnabled() && isReadOnlyReplica;
}
837e6f8
to
2ff0486
Compare
Signed-off-by: Suraj Singh <surajrider@gmail.com>
2ff0486
to
4ba2d80
Compare
Codecov Report
@@ Coverage Diff @@
## main #486 +/- ##
============================================
- Coverage 75.16% 73.05% -2.12%
+ Complexity 1007 983 -24
============================================
Files 141 141
Lines 4579 4595 +16
Branches 506 506
============================================
- Hits 3442 3357 -85
- Misses 823 925 +102
+ Partials 314 313 -1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
…ds (#486) (#533) * Update engine factory to return NRTReplicationEngine for replica shards Signed-off-by: Suraj Singh <surajrider@gmail.com> * Address review comments Signed-off-by: Suraj Singh <surajrider@gmail.com> Signed-off-by: Suraj Singh <surajrider@gmail.com> (cherry picked from commit 81c2002) Co-authored-by: Suraj Singh <surajrider@gmail.com>
Signed-off-by: Suraj Singh surajrider@gmail.com
Description
Update EngineFactory to return NRTReplicationEngine for SegRep enabled replica shards. Today both primary & replica uses ReplicationEngine (extends InternalEngine from OpenSearch) though NRTReplicationEngine is needed on replica shards for SegmentReplication to work.
Resolves
opensearch-project/OpenSearch#3823
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.