-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Backport 2.x] Support no-op replication for remote-backed indexes (#…
…5731) * Remove PRRL creation/deletion in peer recovery of remote store enabled replica (#4954) * Add RecoverySourceHandlerFactory for extensibility Signed-off-by: Ashish Singh <[email protected]> * recoverToTarget made extensible to allow multiple implementations Signed-off-by: Ashish Singh <[email protected]> * Remove PRRL after SendFileStep in Peer Recovery Signed-off-by: Ashish Singh <[email protected]> * Incorporate PR review feedback Signed-off-by: Ashish Singh <[email protected]> * Empty-Commit Signed-off-by: Ashish Singh <[email protected]> * Incorporate PR review feedback Signed-off-by: Ashish Singh <[email protected]> * Empty-Commit Signed-off-by: Ashish Singh <[email protected]> * Empty-Commit Signed-off-by: Ashish Singh <[email protected]> * Remove CHANGELOG entry as this is incremental PR Signed-off-by: Ashish Singh <[email protected]> * Incorporate PR review feedback Signed-off-by: Ashish Singh <[email protected]> Signed-off-by: Ashish Singh <[email protected]> * Enhance CheckpointState to support no-op replication (#5282) * CheckpointState enhanced to support no-op replication Signed-off-by: Ashish Singh <[email protected]> Co-authored-by: Bukhtawar Khan<[email protected]> Signed-off-by: Ashish Singh <[email protected]> * Add transport action for primary term validation for remote-backed indices (#5616) Add transport action for primary term validation for remote-backed indices Signed-off-by: Ashish Singh <[email protected]> Signed-off-by: Ashish Singh <[email protected]>
- Loading branch information
Showing
35 changed files
with
3,028 additions
and
462 deletions.
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
45 changes: 45 additions & 0 deletions
45
server/src/main/java/org/opensearch/action/support/replication/FanoutReplicationProxy.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,45 @@ | ||
/* | ||
* 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.action.support.replication; | ||
|
||
import org.opensearch.action.ActionListener; | ||
import org.opensearch.action.support.replication.ReplicationOperation.ReplicaResponse; | ||
import org.opensearch.action.support.replication.ReplicationOperation.Replicas; | ||
import org.opensearch.cluster.routing.ShardRouting; | ||
|
||
import java.util.function.BiConsumer; | ||
import java.util.function.Consumer; | ||
|
||
/** | ||
* This implementation of {@link ReplicationProxy} fans out the replication request to current shard routing if | ||
* it is not the primary and has replication mode as {@link ReplicationMode#FULL_REPLICATION}. | ||
* | ||
* @opensearch.internal | ||
*/ | ||
public class FanoutReplicationProxy<ReplicaRequest extends ReplicationRequest<ReplicaRequest>> extends ReplicationProxy<ReplicaRequest> { | ||
|
||
public FanoutReplicationProxy(Replicas<ReplicaRequest> replicasProxy) { | ||
super(replicasProxy); | ||
} | ||
|
||
@Override | ||
protected void performOnReplicaProxy( | ||
ReplicationProxyRequest<ReplicaRequest> proxyRequest, | ||
ReplicationMode replicationMode, | ||
BiConsumer<Consumer<ActionListener<ReplicaResponse>>, ReplicationProxyRequest<ReplicaRequest>> performOnReplicaConsumer | ||
) { | ||
assert replicationMode == ReplicationMode.FULL_REPLICATION : "FanoutReplicationProxy allows only full replication mode"; | ||
performOnReplicaConsumer.accept(getReplicasProxyConsumer(fullReplicationProxy, proxyRequest), proxyRequest); | ||
} | ||
|
||
@Override | ||
ReplicationMode determineReplicationMode(ShardRouting shardRouting, ShardRouting primaryRouting) { | ||
return shardRouting.isSameAllocation(primaryRouting) == false ? ReplicationMode.FULL_REPLICATION : ReplicationMode.NO_REPLICATION; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
server/src/main/java/org/opensearch/action/support/replication/ReplicationMode.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,32 @@ | ||
/* | ||
* 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.action.support.replication; | ||
|
||
/** | ||
* The type of replication used for inter-node replication. | ||
* | ||
* @opensearch.internal | ||
*/ | ||
public enum ReplicationMode { | ||
/** | ||
* In this mode, a {@code TransportReplicationAction} is fanned out to underlying concerned shard and is replicated logically. | ||
* In short, this mode would replicate the {@link ReplicationRequest} to | ||
* the replica shard along with primary term validation. | ||
*/ | ||
FULL_REPLICATION, | ||
/** | ||
* In this mode, a {@code TransportReplicationAction} is fanned out to underlying concerned shard and used for | ||
* primary term validation only. The request is not replicated logically. | ||
*/ | ||
PRIMARY_TERM_VALIDATION, | ||
/** | ||
* In this mode, a {@code TransportReplicationAction} does not fan out to the underlying concerned shard. | ||
*/ | ||
NO_REPLICATION; | ||
} |
Oops, something went wrong.