-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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 #4096
Closed
Closed
[Backport 2.x] [Segment Replication] Added source-side classes for orchestrating replication events #4096
Changes from all commits
Commits
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 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 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 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 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 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 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 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 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.
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.
Breaking change, need to remove abstract and provide default implementation