Skip to content

Commit

Permalink
Merge branch '3.2' of github.com:neo4j/neo4j into 3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewkerr9000 committed Nov 28, 2017
2 parents 91bab42 + d823b24 commit e7e8a5a
Show file tree
Hide file tree
Showing 28 changed files with 1,929 additions and 253 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.Optional;

/**
* Wrapper around checked exceptions for rethrowing them as runtime exceotions when the signature of the containing method
* Wrapper around checked exceptions for rethrowing them as runtime exceptions when the signature of the containing method
* cannot be changed to declare them.
*
* Thrown by {@link ThrowingFunction#catchThrown(Class, ThrowingFunction)}
Expand All @@ -42,7 +42,7 @@ public UncaughtCheckedException( Object source, Throwable cause )
}

/**
* Check the that the cause has the given type and if succesful, return it.
* Check that the cause has the given type and if successful, return it.
*
* @param clazz class object for the desired type of the cause
* @param <E> the desired type of the cause
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ public class CausalClusteringSettings implements LoadableConfig
public static final Setting<Boolean> refuse_to_be_leader =
setting( "causal_clustering.refuse_to_be_leader", BOOLEAN, FALSE );

@Description( "Enable pre-voting extension to the Raft protocol (this is breaking and must match between the core cluster members)" )
public static final Setting<Boolean> enable_pre_voting =
setting( "causal_clustering.enable_pre_voting", BOOLEAN, FALSE );

@Description( "The maximum batch size when catching up (in unit of entries)" )
public static final Setting<Integer> catchup_batch_size =
setting( "causal_clustering.catchup_batch_size", INTEGER, "64" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,12 @@ expectedClusterSize, electionTimeout, systemClock(), config.get( join_catch_up_t

raftTimeoutService = new DelayedRenewableTimeoutService( systemClock(), logProvider );

boolean supportsPreVoting = config.get( CausalClusteringSettings.enable_pre_voting );

raftMachine = new RaftMachine( myself, termState, voteState, raftLog, electionTimeout, heartbeatInterval,
raftTimeoutService, outbound, logProvider, raftMembershipManager, logShipping, inFlightCache,
config.get( refuse_to_be_leader ),
platformModule.monitors, systemClock() );
supportsPreVoting, platformModule.monitors, systemClock() );

life.add( new RaftCoreTopologyConnector( coreTopologyService, raftMachine ) );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
*/
package org.neo4j.causalclustering.core.consensus;

import java.util.Collection;

public class MajorityIncludingSelfQuorum
{
private static final int MIN_QUORUM = 2;
Expand All @@ -27,6 +29,11 @@ private MajorityIncludingSelfQuorum()
{
}

public static boolean isQuorum( Collection<?> cluster, Collection<?> countNotIncludingMyself )
{
return isQuorum( cluster.size(), countNotIncludingMyself.size() );
}

public static boolean isQuorum( int clusterSize, int countNotIncludingSelf )
{
return isQuorum( MIN_QUORUM, clusterSize, countNotIncludingSelf );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ public RaftMachine( MemberId myself, StateStorage<TermState> termStorage, StateS
RaftLog entryLog, long electionTimeout, long heartbeatInterval,
RenewableTimeoutService renewableTimeoutService, Outbound<MemberId,RaftMessages.RaftMessage> outbound,
LogProvider logProvider, RaftMembershipManager membershipManager, RaftLogShippingManager logShipping,
InFlightCache inFlightCache, boolean refuseToBecomeLeader, Monitors monitors, Clock clock )
InFlightCache inFlightCache, boolean refuseToBecomeLeader, boolean supportPreVoting, Monitors monitors,
Clock clock )
{
this.myself = myself;
this.electionTimeout = electionTimeout;
Expand All @@ -115,7 +116,7 @@ public RaftMachine( MemberId myself, StateStorage<TermState> termStorage, StateS

this.inFlightCache = inFlightCache;
this.state = new RaftState( myself, termStorage, membershipManager, entryLog, voteStorage, inFlightCache,
logProvider );
logProvider, supportPreVoting );

leaderNotFoundMonitor = monitors.newMonitor( LeaderNotFoundMonitor.class );
}
Expand Down

0 comments on commit e7e8a5a

Please sign in to comment.