/** * Returned information is a JSON representation of an array, * each element of the array is a map contains the information * about a block pool service actor. */ @Override // DataNodeMXBean public String getBPServiceActorInfo() { final ArrayList<Map<String, String>> infoArray = new ArrayList<Map<String, String>>(); for (BPOfferService bpos : blockPoolManager.getAllNamenodeThreads()) { if (bpos != null) { for (BPServiceActor actor : bpos.getBPServiceActors()) { infoArray.add(actor.getActorInfoMap()); } } } return JSON.toString(infoArray); }
/** * @param addr rpc address of the namenode * @return true if the datanode is connected to a NameNode at the * given address */ public boolean isConnectedToNN(InetSocketAddress addr) { for (BPOfferService bpos : getAllBpOs()) { for (BPServiceActor bpsa : bpos.getBPServiceActors()) { if (addr.equals(bpsa.getNNSocketAddress())) { return bpsa.isAlive(); } } } return false; }
@Override // ClientDatanodeProtocol public void triggerBlockReport(BlockReportOptions options) throws IOException { checkSuperuserPrivilege(); for (BPOfferService bpos : blockPoolManager.getAllNamenodeThreads()) { if (bpos != null) { for (BPServiceActor actor : bpos.getBPServiceActors()) { actor.triggerBlockReport(options); } } } }
/** * Returned information is a JSON representation of a map with * name node host name as the key and block pool Id as the value. * Note that, if there are multiple NNs in an NA nameservice, * a given block pool may be represented twice. */ @Override // DataNodeMXBean public String getNamenodeAddresses() { final Map<String, String> info = new HashMap<String, String>(); for (BPOfferService bpos : blockPoolManager.getAllNamenodeThreads()) { if (bpos != null) { for (BPServiceActor actor : bpos.getBPServiceActors()) { info.put(actor.getNNSocketAddress().getHostName(), bpos.getBlockPoolId()); } } } return JSON.toString(info); }
/** * @param addr rpc address of the namenode * @return true if the datanode is connected to a NameNode at the * given address */ public boolean isConnectedToNN(InetSocketAddress addr) { for (BPOfferService bpos : getAllBpOs()) { for (BPServiceActor bpsa : bpos.getBPServiceActors()) { if (addr.equals(bpsa.getNNSocketAddress())) { return bpsa.isAlive(); } } } return false; }
/** * @param addr rpc address of the namenode * @return true if the datanode is connected to a NameNode at the * given address */ public boolean isConnectedToNN(InetSocketAddress addr) { for (BPOfferService bpos : getAllBpOs()) { for (BPServiceActor bpsa : bpos.getBPServiceActors()) { if (addr.equals(bpsa.getNNSocketAddress())) { return bpsa.isAlive(); } } } return false; }
/** * Returned information is a JSON representation of a map with * name node host name as the key and block pool Id as the value. * Note that, if there are multiple NNs in an NA nameservice, * a given block pool may be represented twice. */ @Override // DataNodeMXBean public String getNamenodeAddresses() { final Map<String, String> info = new HashMap<String, String>(); for (BPOfferService bpos : blockPoolManager.getAllNamenodeThreads()) { if (bpos != null) { for (BPServiceActor actor : bpos.getBPServiceActors()) { info.put(actor.getNNSocketAddress().getHostName(), bpos.getBlockPoolId()); } } } return JSON.toString(info); }
@Override public Boolean get() { List<BPServiceActor> actors = bpos.getBPServiceActors(); int failedcount = 0; for (BPServiceActor actor : actors) { if (!actor.isAlive()) { failedcount++; } } return failedcount == 1; } }, 100, 10000);
@Override // ClientDatanodeProtocol public void triggerBlockReport(BlockReportOptions options) throws IOException { checkSuperuserPrivilege(); for (BPOfferService bpos : blockPoolManager.getAllNamenodeThreads()) { if (bpos != null) { for (BPServiceActor actor : bpos.getBPServiceActors()) { actor.triggerBlockReport(options); } } } }
@Override // ClientDatanodeProtocol public void triggerBlockReport(BlockReportOptions options) throws IOException { checkSuperuserPrivilege(); for (BPOfferService bpos : blockPoolManager.getAllNamenodeThreads()) { if (bpos != null) { for (BPServiceActor actor : bpos.getBPServiceActors()) { actor.triggerBlockReport(options); } } } }
/** * Returned information is a JSON representation of a map with * name node host name as the key and block pool Id as the value. * Note that, if there are multiple NNs in an NA nameservice, * a given block pool may be represented twice. */ @Override // DataNodeMXBean public String getNamenodeAddresses() { final Map<String, String> info = new HashMap<String, String>(); for (BPOfferService bpos : blockPoolManager.getAllNamenodeThreads()) { if (bpos != null) { for (BPServiceActor actor : bpos.getBPServiceActors()) { info.put(actor.getNNSocketAddress().getHostName(), bpos.getBlockPoolId()); } } } return JSON.toString(info); }
private static InetSocketAddress getNNSocketAddress(BPOfferService bpos) { List<BPServiceActor> actors = bpos.getBPServiceActors(); assertEquals(1, actors.size()); return actors.get(0).getNNSocketAddress(); }
private int getStandbyIBRSize(BPOfferService bpos) { List<BPServiceActor> bpServiceActors = bpos.getBPServiceActors(); for (BPServiceActor bpServiceActor : bpServiceActors) { if (bpServiceActor.state == HAServiceState.STANDBY) { return bpServiceActor.getIbrManager().getPendingIBRSize(); } } return -1; } }
List<BPServiceActor> actors = bpos.getBPServiceActors(); assertEquals(2, actors.size()); bpos.start();
@Before public void startCluster() throws IOException { conf = new HdfsConfiguration(); cluster = new MiniDFSCluster.Builder(conf).numDataNodes(DN_COUNT).build(); singletonNn = cluster.getNameNode(); singletonDn = cluster.getDataNodes().get(0); bpos = singletonDn.getAllBpOs()[0]; actor = bpos.getBPServiceActors().get(0); storageUuid = singletonDn.getFSDataset().getVolumes().get(0).getStorageID(); }
for (BPServiceActor thisBpsa : bpos.getBPServiceActors()) { if (thisBpsa.getNNSocketAddress().equals(nn.getServiceRpcAddress())) { bpsa = thisBpsa;
DataNode datanode = cluster.getDataNodes().get(0); BPServiceActor actor = datanode.getAllBpOs()[0].getBPServiceActors().get(0); String storageUuid = datanode.getFSDataset().getVolumes().get(0).getStorageID();
for (BPServiceActor bpsa : bpos.getBPServiceActors()) { assertTrue(nnAddrsFromDN.add(bpsa.getNNSocketAddress()));