Skip to content

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

Merged
Rishikesh1159 merged 5 commits intoopensearch-project:2.xfrom
Rishikesh1159:backport/backport-3470
Aug 9, 2022
Merged

[Backport 2.x] [Segment Replication] Added source-side classes for orchestrating replication events.#4128
Rishikesh1159 merged 5 commits intoopensearch-project:2.xfrom
Rishikesh1159:backport/backport-3470

Conversation

@Rishikesh1159
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

github-actions bot commented Aug 4, 2022

Gradle Check (Jenkins) Run Completed with:

Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com>
@kartg
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

github-actions bot commented Aug 5, 2022

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Aug 5, 2022

Gradle Check (Jenkins) Run Completed with:

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Aug 5, 2022

Codecov Report

❌ Patch coverage is 64.40678% with 63 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.53%. Comparing base (01123f8) to head (20467b6).
⚠️ Report is 2785 commits behind head on 2.x.

Files with missing lines Patch % Lines
...ensearch/indices/replication/common/CopyState.java 69.69% 9 Missing and 1 partial ⚠️
...ion/common/SegmentReplicationTransportRequest.java 33.33% 10 Missing ⚠️
...in/java/org/opensearch/index/shard/IndexShard.java 0.00% 9 Missing ⚠️
...ch/indices/replication/GetSegmentFilesRequest.java 38.46% 8 Missing ⚠️
...s/replication/SegmentReplicationSourceService.java 81.08% 5 Missing and 2 partials ⚠️
...rch/indices/replication/CheckpointInfoRequest.java 40.00% 6 Missing ⚠️
...s/replication/SegmentReplicationSourceFactory.java 0.00% 6 Missing ⚠️
...rc/main/java/org/opensearch/index/store/Store.java 86.66% 2 Missing and 2 partials ⚠️
...va/org/opensearch/index/engine/InternalEngine.java 66.66% 2 Missing ⚠️
.../main/java/org/opensearch/index/engine/Engine.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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