For segrep enabled indices, use NRTReplicationEngine for replica shards#486
Merged
ankitkala merged 3 commits intoopensearch-project:mainfrom Aug 29, 2022
Merged
Conversation
Signed-off-by: Suraj Singh <surajrider@gmail.com>
ankitkala
reviewed
Aug 19, 2022
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
ankitkala
previously approved these changes
Aug 23, 2022
| 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")) { |
Member
There was a problem hiding this comment.
- we can drop explicit
nullcheck and use "?" instead for obtaining replication type setting. - Can we use constant for "SEGMENT" (from the allowed values)?
Member
Author
There was a problem hiding this comment.
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. |
ankitkala
approved these changes
Aug 29, 2022
saikaranam-amazon
approved these changes
Aug 29, 2022
ankitkala
pushed a commit
that referenced
this pull request
Aug 30, 2022
…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>
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.