Search in sources :

Example 6 with BaselineTopologyHistory

use of org.apache.ignite.internal.processors.cluster.BaselineTopologyHistory in project ignite by apache.

the class IgniteBaselineAffinityTopologyActivationTest method testBaselineHistorySyncWithNewNode.

/**
 */
@Test
public void testBaselineHistorySyncWithNewNode() throws Exception {
    final long expectedBranchingHash = "A".hashCode() + "B".hashCode() + "C".hashCode();
    BaselineTopologyHistoryVerifier verifier = new BaselineTopologyHistoryVerifier() {

        @Override
        public void verify(BaselineTopologyHistory bltHist) {
            assertNotNull(bltHist);
            assertEquals(1, bltHist.history().size());
            BaselineTopologyHistoryItem histItem = bltHist.history().get(0);
            assertEquals(1, histItem.branchingHistory().size());
            long actualBranchingHash = histItem.branchingHistory().get(0);
            assertEquals(expectedBranchingHash, actualBranchingHash);
        }
    };
    Ignite nodeA = startGridWithConsistentId("A");
    startGridWithConsistentId("B");
    startGridWithConsistentId("C");
    nodeA.cluster().baselineAutoAdjustEnabled(false);
    nodeA.cluster().active(true);
    stopGrid("C", false);
    nodeA.cluster().setBaselineTopology(baselineNodes(nodeA.cluster().forServers().nodes()));
    startGridWithConsistentId("D");
    stopAllGrids(false);
    Ignite nodeD = startGridWithConsistentId("D");
    verifyBaselineTopologyHistoryOnNodes(verifier, new Ignite[] { nodeD });
}
Also used : BaselineTopologyHistoryItem(org.apache.ignite.internal.processors.cluster.BaselineTopologyHistoryItem) Ignite(org.apache.ignite.Ignite) BaselineTopologyHistory(org.apache.ignite.internal.processors.cluster.BaselineTopologyHistory) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Aggregations

BaselineTopologyHistory (org.apache.ignite.internal.processors.cluster.BaselineTopologyHistory)6 Ignite (org.apache.ignite.Ignite)4 BaselineTopologyHistoryItem (org.apache.ignite.internal.processors.cluster.BaselineTopologyHistoryItem)3 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)3 Test (org.junit.Test)3 BaselineTopology (org.apache.ignite.internal.processors.cluster.BaselineTopology)2 IgniteEx (org.apache.ignite.internal.IgniteEx)1 GridAbsPredicate (org.apache.ignite.internal.util.lang.GridAbsPredicate)1