use of org.neo4j.test.causalclustering.ClusterRule in project neo4j by neo4j.
the class ReadReplicaHierarchicalCatchupIT method shouldCatchupThroughHierarchy.
@Test
public void shouldCatchupThroughHierarchy() throws Throwable {
clusterRule = clusterRule.withInstanceReadReplicaParam(CausalClusteringSettings.server_groups, id -> serverGroups.get(id)).withInstanceCoreParam(CausalClusteringSettings.server_groups, id -> serverGroups.get(id));
// given
Cluster cluster = clusterRule.startCluster();
int numberOfNodesToCreate = 100;
cluster.coreTx((db, tx) -> {
db.schema().constraintFor(label("Foo")).assertPropertyIsUnique("foobar").create();
tx.success();
});
// 0, 1, 2 are core instances
createLabelledNodesWithProperty(cluster, numberOfNodesToCreate, label("Foo"), () -> Pair.of("foobar", String.format("baz_bat%s", UUID.randomUUID())));
// 3, 4 are other DCs
ReadReplica east3 = cluster.addReadReplicaWithId(3);
east3.start();
ReadReplica west4 = cluster.addReadReplicaWithId(4);
west4.start();
checkDataHasReplicatedToReadReplicas(cluster, numberOfNodesToCreate);
for (CoreClusterMember coreClusterMember : cluster.coreMembers()) {
coreClusterMember.stopCatchupServer();
}
// 5, 6 are other DCs
ReadReplica east5 = cluster.addReadReplicaWithId(5);
east5.setUpstreamDatabaseSelectionStrategy("connect-within-data-center");
east5.start();
ReadReplica west6 = cluster.addReadReplicaWithId(6);
west6.setUpstreamDatabaseSelectionStrategy("connect-within-data-center");
west6.start();
checkDataHasReplicatedToReadReplicas(cluster, numberOfNodesToCreate);
}
Aggregations