public virtual void TestChooseTargetsOnBoundaryTopology()
 {
     for (int i = 0; i < NumOfDatanodes; i++)
     {
         cluster.Remove(dataNodes[i]);
     }
     for (int i_1 = 0; i_1 < NumOfDatanodesBoundary; i_1++)
     {
         cluster.Add(dataNodesInBoundaryCase[i_1]);
     }
     for (int i_2 = 0; i_2 < NumOfDatanodesBoundary; i_2++)
     {
         UpdateHeartbeatWithUsage(dataNodes[0], 2 * HdfsConstants.MinBlocksForWrite * BlockSize
                                  , 0L, (HdfsConstants.MinBlocksForWrite - 1) * BlockSize, 0L, 0L, 0L, 0, 0);
         UpdateHeartbeatWithUsage(dataNodesInBoundaryCase[i_2], 2 * HdfsConstants.MinBlocksForWrite
                                  * BlockSize, 0L, 2 * HdfsConstants.MinBlocksForWrite * BlockSize, 0L, 0L, 0L, 0
                                  , 0);
     }
     DatanodeStorageInfo[] targets;
     targets = ChooseTarget(0, dataNodesInBoundaryCase[0]);
     NUnit.Framework.Assert.AreEqual(targets.Length, 0);
     targets = ChooseTarget(1, dataNodesInBoundaryCase[0]);
     NUnit.Framework.Assert.AreEqual(targets.Length, 1);
     targets = ChooseTarget(2, dataNodesInBoundaryCase[0]);
     NUnit.Framework.Assert.AreEqual(targets.Length, 2);
     NUnit.Framework.Assert.IsFalse(IsOnSameRack(targets[0], targets[1]));
     targets = ChooseTarget(3, dataNodesInBoundaryCase[0]);
     NUnit.Framework.Assert.AreEqual(targets.Length, 3);
     NUnit.Framework.Assert.IsTrue(CheckTargetsOnDifferentNodeGroup(targets));
 }
Пример #2
0
        private void RemoveNode(DatanodeDescriptor deadNode)
        {
            NetworkTopology cluster = bm.GetDatanodeManager().GetNetworkTopology();

            cluster.Remove(deadNode);
            bm.RemoveBlocksAssociatedTo(deadNode);
        }