use of org.neo4j.kernel.impl.ha.ClusterManager.ManagedCluster in project neo4j by neo4j.
the class TxPushStrategyConfigIT method startCluster.
private ManagedCluster startCluster(int memberCount, final int pushFactor, final HaSettings.TxPushStrategy pushStrategy) throws Exception {
ManagedCluster cluster = clusterRule.withCluster(clusterOfSize(memberCount)).withSharedSetting(HaSettings.tx_push_factor, "" + pushFactor).withSharedSetting(HaSettings.tx_push_strategy, pushStrategy.name()).startCluster();
mapMachineIds(cluster);
return cluster;
}
use of org.neo4j.kernel.impl.ha.ClusterManager.ManagedCluster in project neo4j by neo4j.
the class TxPushStrategyConfigIT method slavesListGetsUpdatedWhenSlaveLeavesNicely.
@Test
public void slavesListGetsUpdatedWhenSlaveLeavesNicely() throws Exception {
ManagedCluster cluster = startCluster(3, 1, HaSettings.TxPushStrategy.fixed_ascending);
cluster.shutdown(cluster.getAnySlave());
cluster.await(masterSeesSlavesAsAvailable(1));
}
use of org.neo4j.kernel.impl.ha.ClusterManager.ManagedCluster in project neo4j by neo4j.
the class TxPushStrategyConfigIT method shouldPushToSlavesInDescendingOrder.
@Test
public void shouldPushToSlavesInDescendingOrder() throws Exception {
ManagedCluster cluster = startCluster(4, 2, HaSettings.TxPushStrategy.fixed_descending);
for (int i = 0; i < 5; i++) {
int missed = createTransactionOnMaster(cluster);
assertLastTransactions(cluster, lastTx(THIRD_SLAVE, BASE_TX_ID + 1 + i, missed));
assertLastTransactions(cluster, lastTx(SECOND_SLAVE, BASE_TX_ID + 1 + i, missed));
assertLastTransactions(cluster, lastTx(FIRST_SLAVE, BASE_TX_ID, missed));
}
}
use of org.neo4j.kernel.impl.ha.ClusterManager.ManagedCluster in project neo4j by neo4j.
the class TxPushStrategyConfigIT method slavesListGetsUpdatedWhenSlaveRageQuits.
@Test
public void slavesListGetsUpdatedWhenSlaveRageQuits() throws Throwable {
ManagedCluster cluster = startCluster(3, 1, HaSettings.TxPushStrategy.fixed_ascending);
cluster.fail(cluster.getAnySlave());
cluster.await(masterSeesSlavesAsAvailable(1));
}
use of org.neo4j.kernel.impl.ha.ClusterManager.ManagedCluster in project neo4j by neo4j.
the class IdBufferingRoleSwitchIT method shouldNotSeeFreedIdsCrossRoleSwitch.
@Test
public void shouldNotSeeFreedIdsCrossRoleSwitch() throws Throwable {
// GIVEN
ManagedCluster cluster = clusterRule.startCluster();
HighlyAvailableGraphDatabase firstMaster = cluster.getMaster();
// WHEN
// a node with a property
Node node = createNodeWithProperties(firstMaster, 1);
// sync cluster
cluster.sync();
// a transaction on master which deletes the property
deleteNode(node, firstMaster);
triggerIdMaintenance(firstMaster);
// <-- this one reuses the same property id 0
createNodeWithProperties(firstMaster, 1);
// a transaction T on slave which will be kept open using a barrier
GraphDatabaseAPI slave = cluster.getAnySlave();
Barrier.Control barrier = new Barrier.Control();
Future<Void> t = t2.execute(barrierControlledReadTransaction(slave, barrier));
// pull updates on slave
barrier.await();
slave.getDependencyResolver().resolveDependency(UpdatePuller.class).pullUpdates();
// a role switch
cluster.shutdown(firstMaster);
cluster.await(masterAvailable(firstMaster));
// close T
barrier.release();
t.get();
triggerIdMaintenance(slave);
// THEN the deleted property record should now not be in freelist on new master
// <-- this transaction should introduce inconsistencies
createNodeWithProperties(slave, 10);
// <-- CC will be run here since that's configured above ^^^
cluster.stop();
}
Aggregations