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

[Backport 2.x] [Segment Replication] Added source-side classes for orchestrating replication events. #4128

Merged

Conversation

Rishikesh1159
Copy link
Member

Description

This PR backports b902add from #3470 and fixes breaking change in Engine.java

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.

kartg and others added 3 commits August 3, 2022 18:50
…lication events (opensearch-project#3470)

This change expands on the existing SegmentReplicationSource interface and its corresponding Factory class by introducing an implementation where the replication source is a primary shard (PrimaryShardReplicationSource). These code paths execute on the target. The primary shard implementation creates the requests to be send to the source/primary shard.

Correspondingly, this change also defines two request classes for the GET_CHECKPOINT_INFO and GET_SEGMENT_FILES requests as well as an abstract superclass.

A CopyState class has been introduced that captures point-in-time, file-level details from an IndexShard. This implementation mirrors Lucene's NRT CopyState implementation.

Finally, a service class has been introduce for segment replication that runs on the source side (SegmentReplicationSourceService) which handles these two types of incoming requests. This includes private handler classes that house the logic to respond to these requests, with some functionality stubbed for now. The service class also uses a simple map to cache CopyState objects that would be needed by replication targets.

Unit tests have been added/updated for all new functionality.

Signed-off-by: Kartik Ganesh <gkart@amazon.com>
…is a breaking change and fix other uses of getProcessedLocalCheckpoint()

Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com>
Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com>
@Rishikesh1159 Rishikesh1159 requested review from a team and reta as code owners August 4, 2022 16:50
});
}

private Optional<NRTReplicationEngine> getReplicationEngine() {
Copy link
Member Author

Choose a reason for hiding this comment

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

This method is not part of actual PR. But to fix the breaking change and write getProcessedLocalCheckpoint() in Indexshard.java in a cleaner way. This method is picked from another Segment Replication PR, which will be backported later. While backporting with PR, we should not include getReplicationEngine() in IndexShard.java

@github-actions
Copy link
Contributor

github-actions bot commented Aug 4, 2022

Gradle Check (Jenkins) Run Completed with:

Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com>
@kartg
Copy link
Member

kartg commented Aug 5, 2022

Wouldn't it be cleaner/easier to have the readOnlyEngine object be a ReadOnlyEngine type instead of Engine ? That would avoid the unsafe casting.

@Rishikesh1159
Copy link
Member Author

Wouldn't it be cleaner/easier to have the readOnlyEngine object be a ReadOnlyEngine type instead of Engine ? That would avoid the unsafe casting.

Yes, I will change this next commit.

Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com>
@github-actions
Copy link
Contributor

github-actions bot commented Aug 5, 2022

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

github-actions bot commented Aug 5, 2022

Gradle Check (Jenkins) Run Completed with:

@codecov-commenter
Copy link

Codecov Report

Merging #4128 (20467b6) into 2.x (01123f8) will increase coverage by 0.06%.
The diff coverage is 67.31%.

@@             Coverage Diff              @@
##                2.x    #4128      +/-   ##
============================================
+ Coverage     70.47%   70.53%   +0.06%     
- Complexity    56648    56686      +38     
============================================
  Files          4553     4559       +6     
  Lines        272795   272921     +126     
  Branches      40049    40053       +4     
============================================
+ Hits         192240   192510     +270     
+ Misses        64450    64267     -183     
- Partials      16105    16144      +39     
Impacted Files Coverage Δ
.../main/java/org/opensearch/index/engine/Engine.java 73.87% <0.00%> (-0.29%) ⬇️
...in/java/org/opensearch/index/shard/IndexShard.java 69.06% <0.00%> (-0.49%) ⬇️
...s/replication/SegmentReplicationSourceFactory.java 0.00% <0.00%> (ø)
...opensearch/index/translog/NoOpTranslogManager.java 68.96% <33.33%> (-2.47%) ⬇️
...ion/common/SegmentReplicationTransportRequest.java 33.33% <33.33%> (ø)
...ch/indices/replication/GetSegmentFilesRequest.java 38.46% <38.46%> (ø)
...rch/indices/replication/CheckpointInfoRequest.java 40.00% <40.00%> (ø)
...search/index/translog/InternalTranslogManager.java 58.69% <59.09%> (-1.81%) ⬇️
...ensearch/indices/replication/common/CopyState.java 69.69% <69.69%> (ø)
.../opensearch/index/engine/NRTReplicationEngine.java 69.11% <78.57%> (+12.62%) ⬆️
... 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants