Examples of ClientDatanodeProtocol


Examples of org.apache.hadoop.hdfs.protocol.ClientDatanodeProtocol

      // Create a new block object, because the block inside LocatedBlock at
      // namenode is of type BlockInfo.
      ExtendedBlock blk = new ExtendedBlock(lb.get(0).getBlock());
      Token<BlockTokenIdentifier> token = lb.get(0).getBlockToken();
      final DatanodeInfo dnInfo = lb.get(0).getLocations()[0];
      ClientDatanodeProtocol proxy =
          DFSUtil.createClientDatanodeProtocolProxy(dnInfo, conf, 60000, false);
      try {
        proxy.getBlockLocalPathInfo(blk, token);
        Assert.fail("The call should have failed as this user "
            + " is not allowed to call getBlockLocalPathInfo");
      } catch (IOException ex) {
        Assert.assertTrue(ex.getMessage().contains(
            "not allowed to call getBlockLocalPathInfo"));
View Full Code Here

Examples of org.apache.hadoop.hdfs.protocol.ClientDatanodeProtocol

    @Override
    public HdfsBlocksMetadata call() throws Exception {
      HdfsBlocksMetadata metadata = null;
      // Create the RPC proxy and make the RPC
      ClientDatanodeProtocol cdp = null;
      try {
        cdp = DFSUtil.createClientDatanodeProtocolProxy(datanode, configuration,
            timeout, connectToDnViaHostname);
        metadata = cdp.getHdfsBlocksMetadata(extendedBlocks, dnTokens);
      } catch (IOException e) {
        // Bubble this up to the caller, handle with the Future
        throw e;
      } finally {
        if (cdp != null) {
View Full Code Here

Examples of org.apache.hadoop.hdfs.protocol.ClientDatanodeProtocol

  private long readBlockLength(LocatedBlock locatedblock) throws IOException {
    assert locatedblock != null : "LocatedBlock cannot be null";
    int replicaNotFoundCount = locatedblock.getLocations().length;
   
    for(DatanodeInfo datanode : locatedblock.getLocations()) {
      ClientDatanodeProtocol cdp = null;
     
      try {
        cdp = DFSUtil.createClientDatanodeProtocolProxy(
            datanode, dfsClient.conf, dfsClient.getConf().socketTimeout,
            dfsClient.getConf().connectToDnViaHostname, locatedblock);
       
        final long n = cdp.getReplicaVisibleLength(locatedblock.getBlock());
       
        if (n >= 0) {
          return n;
        }
      }
View Full Code Here

Examples of org.apache.hadoop.hdfs.protocol.ClientDatanodeProtocol

    // For datanode proxy the server principal should be DN's one.
    conf.set(CommonConfigurationKeys.HADOOP_SECURITY_SERVICE_USER_NAME_KEY,
        conf.get(DFSConfigKeys.DFS_DATANODE_USER_NAME_KEY, ""));

    // Create the client
    ClientDatanodeProtocol dnProtocol =    
        DFSUtil.createClientDatanodeProtocolProxy(datanodeAddr, getUGI(), conf,
            NetUtils.getSocketFactory(conf, ClientDatanodeProtocol.class));
    return dnProtocol;
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.protocol.ClientDatanodeProtocol

            NetUtils.getSocketFactory(conf, ClientDatanodeProtocol.class));
    return dnProtocol;
  }
 
  private int deleteBlockPool(String[] argv, int i) throws IOException {
    ClientDatanodeProtocol dnProxy = getDataNodeProxy(argv[i]);
    boolean force = false;
    if (argv.length-1 == i+2) {
      if ("force".equals(argv[i+2])) {
        force = true;
      } else {
        printUsage("-deleteBlockPool");
        return -1;
      }
    }
    dnProxy.deleteBlockPool(argv[i+1], force);
    return 0;
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.protocol.ClientDatanodeProtocol

    return 0;
  }
 
  private int refreshNamenodes(String[] argv, int i) throws IOException {
    String datanode = argv[i];
    ClientDatanodeProtocol refreshProtocol = getDataNodeProxy(datanode);
    refreshProtocol.refreshNamenodes();
   
    return 0;
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.protocol.ClientDatanodeProtocol

  public void shutdown() throws IOException {
    // Clean up RPC connections.
    Iterator <ClientDatanodeProtocol> connections =
      datanodeMap.values().iterator();
    while(connections.hasNext()) {
      ClientDatanodeProtocol cnxn = connections.next();
      RPC.stopProxy(cnxn);
    }
    datanodeMap.clear();
    executor.shutdownNow();
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.protocol.ClientDatanodeProtocol

      private ClientDatanodeProtocol getDatanodeConnection(DatanodeInfo dn,
          Configuration conf, int timeout) throws IOException {
        // This is done to improve read performance, no need for
        // synchronization on the map when we do a read. We go through this
        // method for each block.
        ClientDatanodeProtocol cdp = datanodeMap.get(dn.getName());
        if (cdp != null) {
          return cdp;
        }
        synchronized (datanodeMap) {
          cdp = datanodeMap.get(dn.getName());
View Full Code Here

Examples of org.apache.hadoop.hdfs.protocol.ClientDatanodeProtocol

      private void copyBlockReplica() {
        boolean error = false;
        try {
          // Timeout of 8 minutes for this RPC, this is sufficient since
          // PendingReplicationMonitor timeout itself is 5 minutes.
          ClientDatanodeProtocol cdp = getDatanodeConnection(srcDn, conf,
              rpcTimeout);
          LOG.debug("Fast Copy : Copying block " + src.getBlockName() + " to "
              + dst.getBlockName() + " on " + dstDn.getHostName());
          // This is a blocking call that does not return until the block is
          // successfully copied on the Datanode.
          if (supportFederation) {
            cdp.copyBlock(srcNamespaceId, src,
                dstNamespaceId, dst, dstDn,
                false);
          } else {
            cdp.copyBlock(src, dst, dstDn,
                false);
          }
        } catch (Exception e) {
          String errMsg = "Fast Copy : Failed for Copying block "
            + src.getBlockName() + " to " + dst.getBlockName() + " on "
View Full Code Here

Examples of org.apache.hadoop.hdfs.protocol.ClientDatanodeProtocol

     int port = Integer.parseInt(dnAddr.substring(index+1));
     InetSocketAddress addr = NetUtils.createSocketAddr(hostname + ":" + port);
     if (ClientDatanodeProtocol.LOG.isDebugEnabled()) {
       ClientDatanodeProtocol.LOG.debug("ClientDatanodeProtocol addr=" + addr);
     }
     ClientDatanodeProtocol datanode = null;
     try {
       datanode =(ClientDatanodeProtocol)RPC.getProxy(ClientDatanodeProtocol.class,
         ClientDatanodeProtocol.versionID, addr, conf);
       datanode.refreshNamenodes();
       return 0;
     } finally {
       if (Proxy.isProxyClass(datanode.getClass())) {
         RPC.stopProxy(datanode);
       }
     }
   }
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.