use of org.neo4j.causalclustering.core.consensus.NewLeaderBarrier in project neo4j by neo4j.
the class CommandApplicationProcessTest method shouldIncreaseLastAppliedForOtherCommands.
@Test
public void shouldIncreaseLastAppliedForOtherCommands() throws Exception {
// given
applicationProcess.start();
// when
raftLog.append(new RaftLogEntry(0, new NewLeaderBarrier()));
raftLog.append(new RaftLogEntry(0, new NewLeaderBarrier()));
raftLog.append(new RaftLogEntry(0, new NewLeaderBarrier()));
applicationProcess.notifyCommitted(2);
applier.sync(false);
// then
assertEquals(2, applicationProcess.lastApplied());
}
use of org.neo4j.causalclustering.core.consensus.NewLeaderBarrier in project neo4j by neo4j.
the class CommandApplicationProcessTest method entriesThatAreNotStateMachineCommandsShouldStillIncreaseCommandIndex.
@Test
public void entriesThatAreNotStateMachineCommandsShouldStillIncreaseCommandIndex() throws Throwable {
// given
applicationProcess.start();
// when
raftLog.append(new RaftLogEntry(0, new NewLeaderBarrier()));
raftLog.append(new RaftLogEntry(0, operation(nullTx)));
applicationProcess.notifyCommitted(1);
applier.sync(false);
InOrder inOrder = inOrder(coreStateMachines, commandDispatcher);
// then
inOrder.verify(coreStateMachines).commandDispatcher();
inOrder.verify(commandDispatcher).dispatch(eq(nullTx), eq(1L), anyCallback());
inOrder.verify(commandDispatcher).close();
}
use of org.neo4j.causalclustering.core.consensus.NewLeaderBarrier in project neo4j by neo4j.
the class CommandApplicationProcessTest method duplicatesShouldBeIgnoredButStillIncreaseCommandIndex.
@Test
public void duplicatesShouldBeIgnoredButStillIncreaseCommandIndex() throws Exception {
// given
applicationProcess.start();
// when
raftLog.append(new RaftLogEntry(0, new NewLeaderBarrier()));
raftLog.append(new RaftLogEntry(0, new DistributedOperation(nullTx, globalSession, new LocalOperationId(0, 0))));
// duplicate
raftLog.append(new RaftLogEntry(0, new DistributedOperation(nullTx, globalSession, new LocalOperationId(0, 0))));
raftLog.append(new RaftLogEntry(0, new DistributedOperation(nullTx, globalSession, new LocalOperationId(0, 1))));
applicationProcess.notifyCommitted(3);
applier.sync(false);
InOrder inOrder = inOrder(coreStateMachines, commandDispatcher);
// then
inOrder.verify(coreStateMachines).commandDispatcher();
inOrder.verify(commandDispatcher).dispatch(eq(nullTx), eq(1L), anyCallback());
// duplicate not dispatched
inOrder.verify(commandDispatcher).dispatch(eq(nullTx), eq(3L), anyCallback());
inOrder.verify(commandDispatcher).close();
verifyNoMoreInteractions(commandDispatcher);
}
Aggregations