Examples of NumberReplicas


Examples of org.apache.hadoop.hdfs.server.namenode.FSNamesystem.NumberReplicas

  private void waitForExcessReplicasToChange(
    FSNamesystem namesystem,
    Block block,
    int newReplicas) throws Exception
  {
    NumberReplicas num;
    long startChecking = System.currentTimeMillis();
    do {
      namesystem.readLock();
      try {
        num = namesystem.countNodes(block);
        LOG.info("We have " + num.excessReplicas() + " excess replica");
      } finally {
        namesystem.readUnlock();
      }
      Thread.sleep(100);
      if (System.currentTimeMillis() - startChecking > 30000) {
        namesystem.metaSave("TestNodeCount.meta");
        LOG.warn("Dumping meta into log directory");
        fail("Timed out waiting for excess replicas to change");
      }

    } while (num.excessReplicas() != newReplicas);
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.FSNamesystem.NumberReplicas

      nn.reportBadBlocks(new LocatedBlock[] {badLBlock});

      nn.getNamesystem().restartReplicationWork();

      DFSTestUtil.waitReplication(fs, path, (short)3);
      NumberReplicas num = nn.getNamesystem().countNodes(
          firstBlock.getBlock());
      assertEquals(0, num.corruptReplicas());

    } finally {
      cluster.shutdown();
    }
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.FSNamesystem.NumberReplicas

      LOG.info("Start a new node");
      cluster.restartDataNode(dnprop);
      cluster.waitActive(false);
      // The block should be replicated
      LOG.info("wait for the block to replicate");
      NumberReplicas num;
      long startTime = System.currentTimeMillis();
      do {
       namesystem.readLock();
       try {
         num = namesystem.countNodes(block);
         namesystem.metaSave("TestLostDataNodeAfterDeleteExcessReplica.meta");
       } finally {
         namesystem.readUnlock();
       }
       Thread.sleep(1000);
       LOG.info("live: " + num.liveReplicas());
      } while (num.liveReplicas() != 3 &&
          System.currentTimeMillis() - startTime < 30000);
      assertEquals("Live Replicas doesn't reach 3", num.liveReplicas(), 3);
    } finally {
      cluster.shutdown();
    }
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.FSNamesystem.NumberReplicas

      LOG.info("Start a new node");
      cluster.restartDataNode(dnprop);
      cluster.waitActive(false);
      // The block should be replicated
      LOG.info("wait for the block to replicate");
      NumberReplicas num;
      long startTime = System.currentTimeMillis();
      do {
       namesystem.readLock();
       try {
         num = namesystem.countNodes(block);
         namesystem.metaSave("TestDecommissionDataNodeAfterDeleteExcessReplica.meta");
       } finally {
         namesystem.readUnlock();
       }
       Thread.sleep(1000);
       LOG.info("live: " + num.liveReplicas() + "Decom: " + num.decommissionedReplicas());
      } while (num.liveReplicas() != 3 &&
          System.currentTimeMillis() - startTime < 30000);
      assertEquals("Live Replicas doesn't reach 3", num.liveReplicas(), 3);
    } finally {
      cluster.shutdown();
    }
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.FSNamesystem.NumberReplicas

      // bring up the datanode
      cluster.restartDataNode(dnprop);

      // Wait for block report
      LOG.info("wait for its block report to come in");
      NumberReplicas num;
      long startTime = System.currentTimeMillis();
      do {
       namesystem.readLock();
       try {
         num = namesystem.countNodes(block);
       } finally {
         namesystem.readUnlock();
       }
       Thread.sleep(1000);
       LOG.info("live: " + num.liveReplicas()
           + "Decom: " + num.decommissionedReplicas());
      } while (num.decommissionedReplicas() != 1 &&
          System.currentTimeMillis() - startTime < 30000);
      assertEquals("Decommissioning Replicas doesn't reach 1",
          1, num.decommissionedReplicas());
      assertEquals(1, namesystem.getNonCorruptUnderReplicatedBlocks());
      assertEquals(0, namesystem.getMissingBlocksCount());
    } finally {
      cluster.shutdown();
    }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.FSNamesystem.NumberReplicas

  private void waitForExcessReplicasToChange(
      FSNamesystem namesystem,
      Block block,
      int newReplicas) throws Exception
    {
      NumberReplicas num;
      long startChecking = System.currentTimeMillis();
      do {
        LOG.info("Waiting for a replica to become excess");
        namesystem.readLock();
        try {
          num = namesystem.countNodes(block);
        } finally {
          namesystem.readUnlock();
        }
        Thread.sleep(100);
        if (System.currentTimeMillis() - startChecking > 30000) {
          fail("Timed out waiting for excess replicas to change");
        }

      } while (num.excessReplicas() != newReplicas);
    }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.FSNamesystem.NumberReplicas

      } while (num.excessReplicas() != newReplicas);
    }
 
  private void waitForExcessReplicasToBeDeleted(FSNamesystem namesystem,
      Block block, DataNode dn) throws Exception {
    NumberReplicas num;
    long startChecking = System.currentTimeMillis();
    do {
      LOG.info("Waiting for the excess replica to be deleted");
      dn.scheduleNSBlockReceivedAndDeleted(0);
      namesystem.readLock();
      try {
        num = namesystem.countNodes(block);
      } finally {
        namesystem.readUnlock();
      }
      Thread.sleep(100);
      if (System.currentTimeMillis() - startChecking > 30000) {
        fail("Timed out waiting for excess replicas to be deleted");
      }

    } while (num.excessReplicas() != 0);
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.FSNamesystem.NumberReplicas

        namesystem.heartbeatCheck();
      }
     
      LOG.info("Waiting for live replicas to hit repl factor");
      // The block should be replicated
      NumberReplicas num;
      do {
       namesystem.readLock();
       try {
         num = namesystem.countNodes(block);
       } finally {
         namesystem.readUnlock();
       }
      } while (num.liveReplicas() != REPLICATION_FACTOR);
     
      LOG.info("Restarting first DN");
      // restart the first datanode
      cluster.restartDataNode(dnprop);
      cluster.waitActive(false);
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.FSNamesystem.NumberReplicas

  private void waitForExcessReplicasToChange(
    FSNamesystem namesystem,
    Block block,
    int newReplicas) throws Exception
  {
    NumberReplicas num;
    long startChecking = System.currentTimeMillis();
    do {
      namesystem.readLock();
      try {
        num = namesystem.countNodes(block);
        LOG.info("We have " + num.excessReplicas() + " excess replica");
      } finally {
        namesystem.readUnlock();
      }
      Thread.sleep(100);
      if (System.currentTimeMillis() - startChecking > 30000) {
        namesystem.metaSave("TestNodeCount.meta");
        LOG.warn("Dumping meta into log directory");
        fail("Timed out waiting for excess replicas to change");
      }

    } while (num.excessReplicas() != newReplicas);
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.FSNamesystem.NumberReplicas

      nn.reportBadBlocks(new LocatedBlock[] {badLBlock});

      nn.getNamesystem().restartReplicationWork();

      DFSTestUtil.waitReplication(fs, path, (short)3);
      NumberReplicas num = nn.getNamesystem().countNodes(
          firstBlock.getBlock());
      assertEquals(0, num.corruptReplicas());

    } finally {
      cluster.shutdown();
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.