-
Notifications
You must be signed in to change notification settings - Fork 2.3k
[Segment Replication] Added source-side classes for orchestrating replication events #3470
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
Merged
Merged
Changes from 13 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
912d997
Added CopyState class and relevant downstream methods
kartg f362d44
Add PrimaryShardReplicationSource as an implementation of SegmentRepl…
kartg 36b4fb1
Change SegmentReplicationSourceFactory to create a PrimaryShardReplic…
kartg f72aa14
Added the SegmentReplicationSourceService service class
kartg 2e3f243
Added SegmentReplicationTransportRequest and its two concrete subclasses
kartg b874d01
Added unit tests for PrimaryShardReplicationSource
kartg 83a47a5
Added request handlers to SegmentReplicationSourceService
kartg d5b85fe
Refactoring argument order to avoid confusion between source and targ…
kartg 005e403
Added a subset of unit tests
kartg 2227f45
Added and updated Javadocs
kartg 6ecb560
Added a unit test for CopyState
kartg 1a2c70b
Incorporating PR comments
kartg caca533
Added tests for SegmentReplicationSourceService
kartg 91372c6
Removing default implementation of getProcessedLocalCheckpoint
kartg 7075793
Made the javadoc for getSegmentInfosSnapshot() better
kartg 71e66de
Incorporating PR feedback on javadocs
kartg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
54 changes: 54 additions & 0 deletions
54
server/src/main/java/org/opensearch/indices/replication/CheckpointInfoRequest.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| /* | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * | ||
| * The OpenSearch Contributors require contributions made to | ||
| * this file be licensed under the Apache-2.0 license or a | ||
| * compatible open source license. | ||
| */ | ||
|
|
||
| package org.opensearch.indices.replication; | ||
|
|
||
| import org.opensearch.cluster.node.DiscoveryNode; | ||
| import org.opensearch.common.io.stream.StreamInput; | ||
| import org.opensearch.common.io.stream.StreamOutput; | ||
| import org.opensearch.indices.replication.checkpoint.ReplicationCheckpoint; | ||
| import org.opensearch.indices.replication.common.SegmentReplicationTransportRequest; | ||
|
|
||
| import java.io.IOException; | ||
|
|
||
| /** | ||
| * Request object for fetching segment metadata for a {@link ReplicationCheckpoint} from | ||
| * a {@link SegmentReplicationSource}. This object is created by the target node and sent | ||
| * to the source node. | ||
| * | ||
| * @opensearch.internal | ||
| */ | ||
| public class CheckpointInfoRequest extends SegmentReplicationTransportRequest { | ||
|
|
||
| private final ReplicationCheckpoint checkpoint; | ||
|
|
||
| public CheckpointInfoRequest(StreamInput in) throws IOException { | ||
| super(in); | ||
| checkpoint = new ReplicationCheckpoint(in); | ||
| } | ||
|
|
||
| public CheckpointInfoRequest( | ||
| long replicationId, | ||
| String targetAllocationId, | ||
| DiscoveryNode targetNode, | ||
| ReplicationCheckpoint checkpoint | ||
| ) { | ||
| super(replicationId, targetAllocationId, targetNode); | ||
| this.checkpoint = checkpoint; | ||
| } | ||
|
|
||
| @Override | ||
| public void writeTo(StreamOutput out) throws IOException { | ||
| super.writeTo(out); | ||
| checkpoint.writeTo(out); | ||
| } | ||
|
|
||
| public ReplicationCheckpoint getCheckpoint() { | ||
| return checkpoint; | ||
| } | ||
| } |
60 changes: 60 additions & 0 deletions
60
server/src/main/java/org/opensearch/indices/replication/GetSegmentFilesRequest.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| /* | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * | ||
| * The OpenSearch Contributors require contributions made to | ||
| * this file be licensed under the Apache-2.0 license or a | ||
| * compatible open source license. | ||
| */ | ||
|
|
||
| package org.opensearch.indices.replication; | ||
|
|
||
| import org.opensearch.cluster.node.DiscoveryNode; | ||
| import org.opensearch.common.io.stream.StreamInput; | ||
| import org.opensearch.common.io.stream.StreamOutput; | ||
| import org.opensearch.index.store.StoreFileMetadata; | ||
| import org.opensearch.indices.replication.checkpoint.ReplicationCheckpoint; | ||
| import org.opensearch.indices.replication.common.SegmentReplicationTransportRequest; | ||
|
|
||
| import java.io.IOException; | ||
| import java.util.List; | ||
|
|
||
| /** | ||
| * Request object for fetching a list of segment files metadata from a {@link SegmentReplicationSource}. | ||
| * This object is created by the target node and sent to the source node. | ||
| * | ||
| * @opensearch.internal | ||
| */ | ||
| public class GetSegmentFilesRequest extends SegmentReplicationTransportRequest { | ||
|
|
||
| private final List<StoreFileMetadata> filesToFetch; | ||
| private final ReplicationCheckpoint checkpoint; | ||
|
|
||
| public GetSegmentFilesRequest(StreamInput in) throws IOException { | ||
| super(in); | ||
| this.filesToFetch = in.readList(StoreFileMetadata::new); | ||
| this.checkpoint = new ReplicationCheckpoint(in); | ||
| } | ||
|
|
||
| public GetSegmentFilesRequest( | ||
| long replicationId, | ||
| String targetAllocationId, | ||
| DiscoveryNode targetNode, | ||
| List<StoreFileMetadata> filesToFetch, | ||
| ReplicationCheckpoint checkpoint | ||
| ) { | ||
| super(replicationId, targetAllocationId, targetNode); | ||
| this.filesToFetch = filesToFetch; | ||
| this.checkpoint = checkpoint; | ||
| } | ||
|
|
||
| @Override | ||
| public void writeTo(StreamOutput out) throws IOException { | ||
| super.writeTo(out); | ||
| out.writeList(filesToFetch); | ||
| checkpoint.writeTo(out); | ||
| } | ||
|
|
||
| public ReplicationCheckpoint getCheckpoint() { | ||
| return checkpoint; | ||
| } | ||
| } |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.