/** * @return true if the given NN address is one of the NNs for this * block pool */ boolean containsNN(InetSocketAddress addr) { for (BPServiceActor actor : bpServices) { if (actor.getNNSocketAddress().equals(addr)) { return true; } } return false; }
private String getNameNodeAddress() { return NetUtils.getHostPortString(getNNSocketAddress()); }
void refreshNNList(ArrayList<InetSocketAddress> addrs, ArrayList<InetSocketAddress> lifelineAddrs) throws IOException { Set<InetSocketAddress> oldAddrs = Sets.newHashSet(); for (BPServiceActor actor : bpServices) { oldAddrs.add(actor.getNNSocketAddress()); } Set<InetSocketAddress> newAddrs = Sets.newHashSet(addrs); // Process added NNs Set<InetSocketAddress> addedNNs = Sets.difference(newAddrs, oldAddrs); for (InetSocketAddress addedNN : addedNNs) { BPServiceActor actor = new BPServiceActor(addedNN, lifelineAddrs.get(addrs.indexOf(addedNN)), this); actor.start(); bpServices.add(actor); } // Process removed NNs Set<InetSocketAddress> removedNNs = Sets.difference(oldAddrs, newAddrs); for (InetSocketAddress removedNN : removedNNs) { for (BPServiceActor actor : bpServices) { if (actor.getNNSocketAddress().equals(removedNN)) { actor.stop(); shutdownActor(actor); break; } } } }
/** * @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); }
/** * @return true if the given NN address is one of the NNs for this * block pool */ boolean containsNN(InetSocketAddress addr) { for (BPServiceActor actor : bpServices) { if (actor.getNNSocketAddress().equals(addr)) { return true; } } return false; }
/** * @return true if the given NN address is one of the NNs for this * block pool */ boolean containsNN(InetSocketAddress addr) { for (BPServiceActor actor : bpServices) { if (actor.getNNSocketAddress().equals(addr)) { return true; } } return false; }
break; case DatanodeProtocol.DNA_RECOVERBLOCK: String who = "NameNode at " + actor.getNNSocketAddress(); dn.getBlockRecoveryWorker().recoverBlocks(who, ((BlockRecoveryCommand)cmd).getRecoveringBlocks());
void refreshNNList(ArrayList<InetSocketAddress> addrs) throws IOException { Set<InetSocketAddress> oldAddrs = Sets.newHashSet(); for (BPServiceActor actor : bpServices) { oldAddrs.add(actor.getNNSocketAddress()); } Set<InetSocketAddress> newAddrs = Sets.newHashSet(addrs); if (!Sets.symmetricDifference(oldAddrs, newAddrs).isEmpty()) { // Keep things simple for now -- we can implement this at a later date. throw new IOException( "HA does not currently support adding a new standby to a running DN. " + "Please do a rolling restart of DNs to reconfigure the list of NNs."); } }
void refreshNNList(ArrayList<InetSocketAddress> addrs) throws IOException { Set<InetSocketAddress> oldAddrs = Sets.newHashSet(); for (BPServiceActor actor : bpServices) { oldAddrs.add(actor.getNNSocketAddress()); } Set<InetSocketAddress> newAddrs = Sets.newHashSet(addrs); if (!Sets.symmetricDifference(oldAddrs, newAddrs).isEmpty()) { // Keep things simple for now -- we can implement this at a later date. throw new IOException( "HA does not currently support adding a new standby to a running DN. " + "Please do a rolling restart of DNs to reconfigure the list of NNs."); } }
/** * @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); }
/** * 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(); }
if (thisBpsa.getNNSocketAddress().equals(nn.getServiceRpcAddress())) { bpsa = thisBpsa; break;
break; case DatanodeProtocol.DNA_RECOVERBLOCK: String who = "NameNode at " + actor.getNNSocketAddress(); dn.recoverBlocks(who, ((BlockRecoveryCommand)cmd).getRecoveringBlocks()); break;
for (BPOfferService bpos : dn.getAllBpOs()) { for (BPServiceActor bpsa : bpos.getBPServiceActors()) { assertTrue(nnAddrsFromDN.add(bpsa.getNNSocketAddress()));
break; case DatanodeProtocol.DNA_RECOVERBLOCK: String who = "NameNode at " + actor.getNNSocketAddress(); dn.recoverBlocks(who, ((BlockRecoveryCommand)cmd).getRecoveringBlocks()); break;