Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Splitting out minimum_consensus_group_size from
expected_core_cluster_size to address the different lifecycle concerns. The latter is about when we will start up (N/2+1 instances ready), the former is how small we will allow the Raft group to shrink. Merge branch '3.3' into 3.4
- Loading branch information
Showing
9 changed files
with
134 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
...ustering/src/test/java/org/neo4j/causalclustering/scenarios/ConsensusGroupSettingsIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,75 @@ | |||
/* | |||
* Copyright (c) 2002-2018 "Neo Technology," | |||
* Network Engine for Objects in Lund AB [http://neotechnology.com] | |||
* | |||
* This file is part of Neo4j. | |||
* | |||
* Neo4j is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU Affero General Public License as | |||
* published by the Free Software Foundation, either version 3 of the | |||
* License, or (at your option) any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Affero General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Affero General Public License | |||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
*/ | |||
package org.neo4j.causalclustering.scenarios; | |||
|
|||
import org.junit.Before; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.junit.rules.RuleChain; | |||
|
|||
import org.neo4j.causalclustering.core.CausalClusteringSettings; | |||
import org.neo4j.causalclustering.core.consensus.roles.Role; | |||
import org.neo4j.causalclustering.discovery.Cluster; | |||
import org.neo4j.test.causalclustering.ClusterRule; | |||
import org.neo4j.test.rule.VerboseTimeout; | |||
|
|||
import static java.util.concurrent.TimeUnit.SECONDS; | |||
import static org.junit.Assert.assertEquals; | |||
|
|||
public class ConsensusGroupSettingsIT | |||
{ | |||
private final ClusterRule clusterRule = new ClusterRule().withNumberOfCoreMembers( 5 ).withNumberOfReadReplicas( 0 ) | |||
.withInstanceCoreParam(CausalClusteringSettings.minimum_core_cluster_size_at_formation, value -> "5" ) | |||
.withInstanceCoreParam( CausalClusteringSettings.minimum_core_cluster_size_at_runtime,value -> "3" ) | |||
.withInstanceCoreParam( CausalClusteringSettings.leader_election_timeout, value -> "1s" ); | |||
|
|||
private final VerboseTimeout timeout = VerboseTimeout.builder().withTimeout( 1000, SECONDS ).build(); | |||
|
|||
@Rule | |||
public RuleChain ruleChain = RuleChain.outerRule( clusterRule ).around( timeout ); | |||
|
|||
private Cluster cluster; | |||
|
|||
@Before | |||
public void setup() throws Exception | |||
{ | |||
cluster = clusterRule.startCluster(); | |||
} | |||
|
|||
@Test | |||
public void shouldNotAllowTheConsensusGroupToDropBelowMinimumConsensusGroupSize() throws Exception | |||
{ | |||
// given | |||
int numberOfCoreSeversToRemove = 3; | |||
|
|||
cluster.awaitLeader(); | |||
|
|||
// when | |||
for ( int i = 0; i < numberOfCoreSeversToRemove; i++ ) | |||
{ | |||
cluster.removeCoreMember( cluster.getDbWithRole( Role.LEADER ) ); | |||
cluster.awaitLeader( 30, SECONDS ); | |||
} | |||
|
|||
// then | |||
|
|||
assertEquals(3, cluster.coreMembers().iterator().next().raft().replicationMembers().size()); | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters