public virtual void TestReadOnlyReplicaCorrupt() { // "Corrupt" a READ_ONLY_SHARED replica by reporting it as a bad replica client.ReportBadBlocks(new LocatedBlock[] { new LocatedBlock(extendedBlock, new DatanodeInfo [] { readOnlyDataNode }) }); // There should now be only 1 *location* for the block as the READ_ONLY_SHARED is corrupt WaitForLocations(1); // However, the corrupt READ_ONLY_SHARED replica should *not* affect the overall corrupt replicas count NumberReplicas numberReplicas = blockManager.CountNodes(block); Assert.AssertThat(numberReplicas.CorruptReplicas(), CoreMatchers.Is(0)); }
/// <exception cref="System.IO.IOException"/> private void ValidateNumberReplicas(int expectedReplicas) { NumberReplicas numberReplicas = blockManager.CountNodes(block); Assert.AssertThat(numberReplicas.LiveReplicas(), CoreMatchers.Is(expectedReplicas )); Assert.AssertThat(numberReplicas.ExcessReplicas(), CoreMatchers.Is(0)); Assert.AssertThat(numberReplicas.CorruptReplicas(), CoreMatchers.Is(0)); Assert.AssertThat(numberReplicas.DecommissionedReplicas(), CoreMatchers.Is(0)); Assert.AssertThat(numberReplicas.ReplicasOnStaleNodes(), CoreMatchers.Is(0)); BlockManagerTestUtil.UpdateState(blockManager); Assert.AssertThat(blockManager.GetUnderReplicatedBlocksCount(), CoreMatchers.Is(0L )); Assert.AssertThat(blockManager.GetExcessBlocksCount(), CoreMatchers.Is(0L)); }