use of org.neo4j.kernel.ha.transaction.TransactionPropagator in project neo4j by neo4j.
the class TestMasterCommittingAtSlave method commitACoupleOfTransactionsSuccessfully.
@Test
public void commitACoupleOfTransactionsSuccessfully() throws Exception {
TransactionPropagator propagator = newPropagator(3, 1, givenOrder());
propagator.committed(2, MasterServerId);
propagator.committed(3, MasterServerId);
propagator.committed(4, MasterServerId);
assertCalls((FakeSlave) slaves.iterator().next(), 2, 3, 4);
logProvider.assertNone(communicationLogMessage);
}
use of org.neo4j.kernel.ha.transaction.TransactionPropagator in project neo4j by neo4j.
the class TestMasterCommittingAtSlave method commitSuccessfullyAtThreeSlaves.
@Test
public void commitSuccessfullyAtThreeSlaves() throws Exception {
TransactionPropagator propagator = newPropagator(5, 3, givenOrder());
propagator.committed(2, MasterServerId);
propagator.committed(3, 1);
propagator.committed(4, 2);
Iterator<Slave> slaveIt = slaves.iterator();
assertCalls((FakeSlave) slaveIt.next(), 2, 4);
assertCalls((FakeSlave) slaveIt.next(), 2, 3);
assertCalls((FakeSlave) slaveIt.next(), 2, 3, 4);
assertCalls((FakeSlave) slaveIt.next());
assertCalls((FakeSlave) slaveIt.next());
logProvider.assertNone(communicationLogMessage);
}
use of org.neo4j.kernel.ha.transaction.TransactionPropagator in project neo4j by neo4j.
the class TestMasterCommittingAtSlave method notEnoughSlavesSuccessful.
@Test
public void notEnoughSlavesSuccessful() throws Exception {
TransactionPropagator propagator = newPropagator(3, 2, givenOrder(), true, true);
propagator.committed(2, MasterServerId);
Iterator<Slave> slaveIt = slaves.iterator();
slaveIt.next();
slaveIt.next();
assertCalls((FakeSlave) slaveIt.next(), 2);
logProvider.assertNone(communicationLogMessage);
}
use of org.neo4j.kernel.ha.transaction.TransactionPropagator in project neo4j by neo4j.
the class TestMasterCommittingAtSlave method commitFailureAtFirstOneShouldMoveOnToNext.
@Test
public void commitFailureAtFirstOneShouldMoveOnToNext() throws Exception {
TransactionPropagator propagator = newPropagator(3, 1, givenOrder(), true);
propagator.committed(2, MasterServerId);
Iterator<Slave> slaveIt = slaves.iterator();
assertCalls((FakeSlave) slaveIt.next());
assertCalls((FakeSlave) slaveIt.next(), 2);
logProvider.assertNone(communicationLogMessage);
}
use of org.neo4j.kernel.ha.transaction.TransactionPropagator in project neo4j by neo4j.
the class HighlyAvailableEditionModule method createCommitProcessFactory.
private CommitProcessFactory createCommitProcessFactory(Dependencies dependencies, LogService logging, Monitors monitors, Config config, LifeSupport paxosLife, ClusterClient clusterClient, ClusterMembers members, JobScheduler jobScheduler, Master master, RequestContextFactory requestContextFactory, ComponentSwitcherContainer componentSwitcherContainer, Supplier<LogEntryReader<ReadableClosablePositionAwareChannel>> logEntryReader) {
DefaultSlaveFactory slaveFactory = dependencies.satisfyDependency(new DefaultSlaveFactory(logging.getInternalLogProvider(), monitors, config.get(HaSettings.com_chunk_size).intValue(), logEntryReader));
HostnamePort me = config.get(ClusterSettings.cluster_server);
Slaves slaves = dependencies.satisfyDependency(paxosLife.add(new HighAvailabilitySlaves(members, clusterClient, slaveFactory, me)));
TransactionPropagator transactionPropagator = new TransactionPropagator(TransactionPropagator.from(config), logging.getInternalLog(TransactionPropagator.class), slaves, new CommitPusher(jobScheduler));
paxosLife.add(transactionPropagator);
DelegateInvocationHandler<TransactionCommitProcess> commitProcessDelegate = new DelegateInvocationHandler<>(TransactionCommitProcess.class);
CommitProcessSwitcher commitProcessSwitcher = new CommitProcessSwitcher(transactionPropagator, master, commitProcessDelegate, requestContextFactory, lockManager, monitors, dependencies, config.get(GraphDatabaseSettings.release_schema_lock_while_building_constraint));
componentSwitcherContainer.add(commitProcessSwitcher);
return new HighlyAvailableCommitProcessFactory(commitProcessDelegate);
}
Aggregations