Package org.apache.hadoop.hdfs.server.namenode

Examples of org.apache.hadoop.hdfs.server.namenode.FSNamesystem.writeLock()


     
      // report corrupted block by the third datanode
      DatanodeRegistration dnR =
        DataNodeTestUtils.getDNRegistrationForBP(dataNode, blk.getBlockPoolId());
      FSNamesystem ns = cluster.getNamesystem();
      ns.writeLock();
      try {
        cluster.getNamesystem().getBlockManager().findAndMarkBlockAsCorrupt(
            blk, new DatanodeInfo(dnR), "TEST");
      } finally {
        ns.writeUnlock();
View Full Code Here


      DatanodeDescriptor datanode = datanodes[0];
      DataNodeProperties dnprop = cluster.stopDataNode(datanode.getName());
     
      // make sure that NN detects that the datanode is down
      try {
        namesystem.writeLock();
        synchronized (hm) {
          datanode.setLastUpdate(0); // mark it dead
          hm.heartbeatCheck();
        }
      } finally {
View Full Code Here

      // bring down non excessive datanode
      dnprop = cluster.stopDataNode(nonExcessDN.getName());
      // make sure that NN detects that the datanode is down
     
      try {
        namesystem.writeLock();
        synchronized(hm) {
          nonExcessDN.setLastUpdate(0); // mark it dead
          hm.heartbeatCheck();
        }
      } finally {
View Full Code Here

      final int blockInvalidateLimit = bm.getDatanodeManager().blockInvalidateLimit;
      final DatanodeDescriptor[] nodes = bm.getDatanodeManager(
          ).getHeartbeatManager().getDatanodes();
      assertEquals(nodes.length, NUM_OF_DATANODES);
     
      namesystem.writeLock();
      try {
        for (int i=0; i<nodes.length; i++) {
          for(int j=0; j<3*blockInvalidateLimit+1; j++) {
            Block block = new Block(i*(blockInvalidateLimit+1)+j, 0,
                GenerationStamp.FIRST_VALID_STAMP);
View Full Code Here

      final int MAX_INVALIDATE_BLOCKS = 2*MAX_INVALIDATE_LIMIT+REMAINING_BLOCKS;
      final int MAX_REPLICATE_BLOCKS = 2*MAX_REPLICATE_LIMIT+REMAINING_BLOCKS;
      final DatanodeDescriptor[] ONE_TARGET = new DatanodeDescriptor[1];

      try {
        namesystem.writeLock();
        synchronized(hm) {
          for (int i=0; i<MAX_REPLICATE_BLOCKS; i++) {
            dd.addBlockToBeReplicated(
                new Block(i, 0, GenerationStamp.FIRST_VALID_STAMP), ONE_TARGET);
          }
View Full Code Here

        
      final FSNamesystem namesystem = cluster.getNamesystem();
      final BlockManager bm = namesystem.getBlockManager();
      final HeartbeatManager hm = bm.getDatanodeManager().getHeartbeatManager();
      try {
        namesystem.writeLock();
        synchronized(hm) {
          // set live datanode's remaining space to be 0
          // so they will be chosen to be deleted when over-replication occurs
          String corruptMachineName = corruptDataNode.getName();
          for (DatanodeDescriptor datanode : hm.getDatanodes()) {
View Full Code Here

        
      final FSNamesystem namesystem = cluster.getNamesystem();
      final BlockManager bm = namesystem.getBlockManager();
      final HeartbeatManager hm = bm.getDatanodeManager().getHeartbeatManager();
      try {
        namesystem.writeLock();
        synchronized(hm) {
          // set live datanode's remaining space to be 0
          // so they will be chosen to be deleted when over-replication occurs
          String corruptMachineName = corruptDataNode.getName();
          for (DatanodeDescriptor datanode : hm.getDatanodes()) {
View Full Code Here

     
      // report corrupted block by the third datanode
      DatanodeRegistration dnR =
        DataNodeTestUtils.getDNRegistrationForBP(dataNode, blk.getBlockPoolId());
      FSNamesystem ns = cluster.getNamesystem();
      ns.writeLock();
      try {
        cluster.getNamesystem().getBlockManager().findAndMarkBlockAsCorrupt(
            blk, new DatanodeInfo(dnR), "TEST", "STORAGE_ID");
      } finally {
        ns.writeUnlock();
View Full Code Here

          dnDs.getDfsUsed(), dnDs.getRemaining(), dnDs.getNamespaceUsed(),
          dnDs.getXceiverCount());
     
      newDS.isAlive = true;
      // Overwrite NN maps with new descriptor.
      namesystem.writeLock();
      namesystem.clusterMap.remove(dnDs);
      namesystem.resolveNetworkLocation(newDS);
      namesystem.unprotectedAddDatanode(newDS);
      namesystem.clusterMap.add(newDS);
      namesystem.writeUnlock();
View Full Code Here

     
      // report corrupted block by the third datanode
      DatanodeRegistration dnR =
        DataNodeTestUtils.getDNRegistrationForBP(dataNode, blk.getBlockPoolId());
      FSNamesystem ns = cluster.getNamesystem();
      ns.writeLock();
      try {
        cluster.getNamesystem().getBlockManager().findAndMarkBlockAsCorrupt(
            blk, new DatanodeInfo(dnR), "TEST");
      } finally {
        ns.writeUnlock();
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.