use of org.neo4j.causalclustering.discovery.ClusterMember in project neo4j by neo4j.
the class ReadReplicaReplicationIT method aReadReplicShouldBeAbleToRejoinTheCluster.
@Test
public void aReadReplicShouldBeAbleToRejoinTheCluster() throws Exception {
int readReplicaId = 4;
Cluster cluster = clusterRule.withNumberOfReadReplicas(0).startCluster();
cluster.coreTx(createSomeData);
cluster.addReadReplicaWithId(readReplicaId).start();
// let's spend some time by adding more data
cluster.coreTx(createSomeData);
awaitEx(() -> readReplicasUpToDateAsTheLeader(cluster.awaitLeader(), cluster.readReplicas()), 1, TimeUnit.MINUTES);
cluster.removeReadReplicaWithMemberId(readReplicaId);
// let's spend some time by adding more data
cluster.coreTx(createSomeData);
cluster.addReadReplicaWithId(readReplicaId).start();
awaitEx(() -> readReplicasUpToDateAsTheLeader(cluster.awaitLeader(), cluster.readReplicas()), 1, TimeUnit.MINUTES);
Function<ClusterMember, DbRepresentation> toRep = db -> DbRepresentation.of(db.database());
Set<DbRepresentation> dbs = cluster.coreMembers().stream().map(toRep).collect(toSet());
dbs.addAll(cluster.readReplicas().stream().map(toRep).collect(toSet()));
cluster.shutdown();
assertEquals(1, dbs.size());
}
use of org.neo4j.causalclustering.discovery.ClusterMember in project neo4j by neo4j.
the class StartStopLoad method doWorkOnMember.
@Override
protected void doWorkOnMember(boolean isCore, int id) {
ClusterMember member = isCore ? cluster.getCoreMemberById(id) : cluster.getReadReplicaById(id);
String storeDir = member.database().getStoreDir();
KernelExtensions kernelExtensions = member.database().getDependencyResolver().resolveDependency(KernelExtensions.class);
member.shutdown();
assertStoreConsistent(storeDir, kernelExtensions);
LockSupport.parkNanos(5_000_000_000L);
member.start();
}
Aggregations