Skip to content

Commit

Permalink
Merge branch '2.3' into 3.0
Browse files Browse the repository at this point in the history
Conflicts:
	enterprise/cluster/src/main/java/org/neo4j/cluster/protocol/cluster/ClusterConfiguration.java
  • Loading branch information
apcj committed Feb 16, 2016
2 parents 28ee5da + 815010e commit 1ce1ebc
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 260 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.neo4j.logging.Log;
import org.neo4j.logging.LogProvider;

import static org.neo4j.helpers.collection.Iterables.limit;
import static org.neo4j.helpers.collection.Iterables.toList;

/**
Expand Down Expand Up @@ -105,7 +106,9 @@ public URI boundAt()
@Override
public List<URI> getAcceptors()
{
return commonState.configuration().getMemberURIs();
// Only use 2f+1 acceptors
return toList( limit( commonState.configuration()
.getAllowedFailures() * 2 + 1, commonState.configuration().getMemberURIs() ) );
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public class ClusterConfiguration
private final List<URI> candidateMembers;
private Map<InstanceId, URI> members;
private Map<String, InstanceId> roles = new HashMap<>();
private int allowedFailures = 1;

public ClusterConfiguration( String name, LogProvider logProvider, String... members )
{
Expand Down Expand Up @@ -174,8 +175,7 @@ public Map<String, InstanceId> getRoles()

public int getAllowedFailures()
{
assert members.size() > 0;
return (members.size() - 1) / 2;
return allowedFailures;
}

public void left()
Expand Down Expand Up @@ -245,6 +245,10 @@ public boolean equals( Object o )

ClusterConfiguration that = (ClusterConfiguration) o;

if ( allowedFailures != that.allowedFailures )
{
return false;
}
if ( !candidateMembers.equals( that.candidateMembers ) )
{
return false;
Expand Down Expand Up @@ -272,6 +276,7 @@ public int hashCode()
result = 31 * result + candidateMembers.hashCode();
result = 31 * result + members.hashCode();
result = 31 * result + roles.hashCode();
result = 31 * result + allowedFailures;
return result;
}
}
105 changes: 0 additions & 105 deletions enterprise/ha/src/test/java/org/neo4j/kernel/ha/TestFailover.java

This file was deleted.

This file was deleted.

0 comments on commit 1ce1ebc

Please sign in to comment.