Class ESIndexLevelReplicationTestCase.ReplicationGroup
- java.lang.Object
-
- org.elasticsearch.index.replication.ESIndexLevelReplicationTestCase.ReplicationGroup
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,java.lang.Iterable<IndexShard>
- Enclosing class:
- ESIndexLevelReplicationTestCase
protected class ESIndexLevelReplicationTestCase.ReplicationGroup extends java.lang.Object implements java.lang.AutoCloseable, java.lang.Iterable<IndexShard>
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ReplicationGroup(IndexMetaData indexMetaData)
-
Method Summary
Modifier and Type Method Description IndexShard
addReplica()
void
addReplica(IndexShard replica)
IndexShard
addReplicaWithExistingPath(ShardPath shardPath, java.lang.String nodeId)
RetentionLease
addRetentionLease(java.lang.String id, long retainingSequenceNumber, java.lang.String source, ActionListener<ReplicationResponse> listener)
int
appendDocs(int numOfDoc)
void
assertAllEqual(int expectedCount)
java.util.concurrent.Future<java.lang.Void>
asyncRecoverReplica(IndexShard replica, java.util.function.BiFunction<IndexShard,DiscoveryNode,RecoveryTarget> targetSupplier)
void
close()
BulkItemResponse
delete(DeleteRequest deleteRequest)
void
executeRetentionLeasesSyncRequestOnReplica(RetentionLeaseSyncAction.Request request, IndexShard replica)
void
flush()
protected EngineFactory
getEngineFactory(ShardRouting routing)
IndexShard
getPrimary()
DiscoveryNode
getPrimaryNode()
java.util.List<IndexShard>
getReplicas()
BulkItemResponse
index(IndexRequest indexRequest)
int
indexDocs(int numOfDoc)
java.util.Iterator<IndexShard>
iterator()
java.util.concurrent.Future<PrimaryReplicaSyncer.ResyncTask>
promoteReplicaToPrimary(IndexShard replica)
promotes the specific replica as the new primaryvoid
promoteReplicaToPrimary(IndexShard replica, java.util.function.BiConsumer<IndexShard,ActionListener<PrimaryReplicaSyncer.ResyncTask>> primaryReplicaSyncer)
protected void
recoverPrimary(IndexShard primary)
void
recoverReplica(IndexShard replica)
void
recoverReplica(IndexShard replica, java.util.function.BiFunction<IndexShard,DiscoveryNode,RecoveryTarget> targetSupplier)
void
recoverReplica(IndexShard replica, java.util.function.BiFunction<IndexShard,DiscoveryNode,RecoveryTarget> targetSupplier, boolean markAsRecovering)
void
refresh(java.lang.String source)
void
reinitPrimaryShard()
boolean
removeReplica(IndexShard replica)
void
removeRetentionLease(java.lang.String id, ActionListener<ReplicationResponse> listener)
RetentionLease
renewRetentionLease(java.lang.String id, long retainingSequenceNumber, java.lang.String source)
java.util.List<ShardRouting>
shardRoutings()
void
startAll()
void
startPrimary()
int
startReplicas(int numOfReplicasToStart)
void
syncGlobalCheckpoint()
protected void
syncRetentionLeases(ShardId shardId, RetentionLeases leases, ActionListener<ReplicationResponse> listener)
-
-
-
Constructor Detail
-
ReplicationGroup
protected ReplicationGroup(IndexMetaData indexMetaData) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
getEngineFactory
protected EngineFactory getEngineFactory(ShardRouting routing)
-
indexDocs
public int indexDocs(int numOfDoc) throws java.lang.Exception
- Throws:
java.lang.Exception
-
appendDocs
public int appendDocs(int numOfDoc) throws java.lang.Exception
- Throws:
java.lang.Exception
-
index
public BulkItemResponse index(IndexRequest indexRequest) throws java.lang.Exception
- Throws:
java.lang.Exception
-
delete
public BulkItemResponse delete(DeleteRequest deleteRequest) throws java.lang.Exception
- Throws:
java.lang.Exception
-
startAll
public void startAll() throws java.io.IOException
- Throws:
java.io.IOException
-
startReplicas
public int startReplicas(int numOfReplicasToStart) throws java.io.IOException
- Throws:
java.io.IOException
-
startPrimary
public void startPrimary() throws java.io.IOException
- Throws:
java.io.IOException
-
addReplica
public IndexShard addReplica() throws java.io.IOException
- Throws:
java.io.IOException
-
addReplica
public void addReplica(IndexShard replica) throws java.io.IOException
- Throws:
java.io.IOException
-
recoverPrimary
protected void recoverPrimary(IndexShard primary)
-
addReplicaWithExistingPath
public IndexShard addReplicaWithExistingPath(ShardPath shardPath, java.lang.String nodeId) throws java.io.IOException
- Throws:
java.io.IOException
-
getReplicas
public java.util.List<IndexShard> getReplicas()
-
promoteReplicaToPrimary
public java.util.concurrent.Future<PrimaryReplicaSyncer.ResyncTask> promoteReplicaToPrimary(IndexShard replica) throws java.io.IOException
promotes the specific replica as the new primary- Throws:
java.io.IOException
-
promoteReplicaToPrimary
public void promoteReplicaToPrimary(IndexShard replica, java.util.function.BiConsumer<IndexShard,ActionListener<PrimaryReplicaSyncer.ResyncTask>> primaryReplicaSyncer) throws java.io.IOException
- Throws:
java.io.IOException
-
removeReplica
public boolean removeReplica(IndexShard replica) throws java.io.IOException
- Throws:
java.io.IOException
-
recoverReplica
public void recoverReplica(IndexShard replica) throws java.io.IOException
- Throws:
java.io.IOException
-
recoverReplica
public void recoverReplica(IndexShard replica, java.util.function.BiFunction<IndexShard,DiscoveryNode,RecoveryTarget> targetSupplier) throws java.io.IOException
- Throws:
java.io.IOException
-
recoverReplica
public void recoverReplica(IndexShard replica, java.util.function.BiFunction<IndexShard,DiscoveryNode,RecoveryTarget> targetSupplier, boolean markAsRecovering) throws java.io.IOException
- Throws:
java.io.IOException
-
getPrimaryNode
public DiscoveryNode getPrimaryNode()
-
asyncRecoverReplica
public java.util.concurrent.Future<java.lang.Void> asyncRecoverReplica(IndexShard replica, java.util.function.BiFunction<IndexShard,DiscoveryNode,RecoveryTarget> targetSupplier)
-
assertAllEqual
public void assertAllEqual(int expectedCount) throws java.io.IOException
- Throws:
java.io.IOException
-
refresh
public void refresh(java.lang.String source)
-
flush
public void flush()
-
shardRoutings
public java.util.List<ShardRouting> shardRoutings()
-
close
public void close() throws java.lang.Exception
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Throws:
java.lang.Exception
-
iterator
public java.util.Iterator<IndexShard> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<IndexShard>
-
getPrimary
public IndexShard getPrimary()
-
reinitPrimaryShard
public void reinitPrimaryShard() throws java.io.IOException
- Throws:
java.io.IOException
-
syncGlobalCheckpoint
public void syncGlobalCheckpoint()
-
syncRetentionLeases
protected void syncRetentionLeases(ShardId shardId, RetentionLeases leases, ActionListener<ReplicationResponse> listener)
-
addRetentionLease
public RetentionLease addRetentionLease(java.lang.String id, long retainingSequenceNumber, java.lang.String source, ActionListener<ReplicationResponse> listener)
-
renewRetentionLease
public RetentionLease renewRetentionLease(java.lang.String id, long retainingSequenceNumber, java.lang.String source)
-
removeRetentionLease
public void removeRetentionLease(java.lang.String id, ActionListener<ReplicationResponse> listener)
-
executeRetentionLeasesSyncRequestOnReplica
public void executeRetentionLeasesSyncRequestOnReplica(RetentionLeaseSyncAction.Request request, IndexShard replica)
-
-