Search in sources :

Example 1 with BaselineTopologyHistoryItem

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

the class IgniteBaselineAffinityTopologyActivationTest method testBaselineHistorySyncWithOldNodeWithCompatibleHistory.

/**
 */
public void testBaselineHistorySyncWithOldNodeWithCompatibleHistory() throws Exception {
    final long expectedBranchingHash0 = "A".hashCode() + "B".hashCode() + "C".hashCode();
    final long expectedBranchingHash1 = "A".hashCode() + "B".hashCode();
    BaselineTopologyHistoryVerifier verifier = new BaselineTopologyHistoryVerifier() {

        @Override
        public void verify(BaselineTopologyHistory bltHist) {
            assertNotNull(bltHist);
            assertEquals(2, bltHist.history().size());
            BaselineTopologyHistoryItem histItem = bltHist.history().get(0);
            assertEquals(1, histItem.branchingHistory().size());
            long actualBranchingHash0 = histItem.branchingHistory().get(0);
            assertEquals(expectedBranchingHash0, actualBranchingHash0);
            histItem = bltHist.history().get(1);
            assertEquals(1, histItem.branchingHistory().size());
            long actualBranchingHash1 = histItem.branchingHistory().get(0);
            assertEquals(expectedBranchingHash1, actualBranchingHash1);
        }
    };
    Ignite nodeA = startGridWithConsistentId("A");
    startGridWithConsistentId("B");
    startGridWithConsistentId("C");
    nodeA.active(true);
    stopGrid("C", false);
    nodeA.cluster().setBaselineTopology(baselineNodes(nodeA.cluster().forServers().nodes()));
    stopGrid("B", false);
    nodeA.cluster().setBaselineTopology(baselineNodes(nodeA.cluster().forServers().nodes()));
    startGridWithConsistentId("B");
    stopAllGrids(false);
    startGridWithConsistentId("A");
    Ignite nodeB = startGridWithConsistentId("B");
    verifyBaselineTopologyHistoryOnNodes(verifier, new Ignite[] { nodeB });
}
Also used : BaselineTopologyHistoryItem(org.apache.ignite.internal.processors.cluster.BaselineTopologyHistoryItem) Ignite(org.apache.ignite.Ignite) BaselineTopologyHistory(org.apache.ignite.internal.processors.cluster.BaselineTopologyHistory)

Example 2 with BaselineTopologyHistoryItem

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

the class IgniteBaselineAffinityTopologyActivationTest method testBaselineHistorySyncWithNewNode.

/**
 */
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.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)

Aggregations

Ignite (org.apache.ignite.Ignite)2 BaselineTopologyHistory (org.apache.ignite.internal.processors.cluster.BaselineTopologyHistory)2 BaselineTopologyHistoryItem (org.apache.ignite.internal.processors.cluster.BaselineTopologyHistoryItem)2