public void refreshNamenodes(Configuration conf) throws IOException { blockPoolManager.refreshNamenodes(conf); }
nnIdToLifelineAddr.get(nnId) : null); BPOfferService bpos = createBPOS(nsToAdd, addrs, lifelineAddrs); bpByNameserviceId.put(nsToAdd, bpos); offerServices.add(bpos); startAll();
void refreshNamenodes(Configuration conf) throws IOException { LOG.info("Refresh request received for nameservices: " + conf.get(DFSConfigKeys.DFS_NAMESERVICES)); Map<String, Map<String, InetSocketAddress>> newAddressMap = null; Map<String, Map<String, InetSocketAddress>> newLifelineAddressMap = null; try { newAddressMap = DFSUtil.getNNServiceRpcAddressesForCluster(conf); newLifelineAddressMap = DFSUtil.getNNLifelineRpcAddressesForCluster(conf); } catch (IOException ioe) { LOG.warn("Unable to get NameNode addresses."); } if (newAddressMap == null || newAddressMap.isEmpty()) { throw new IOException("No services to connect, missing NameNode " + "address."); } synchronized (refreshNamenodesLock) { doRefreshNamenodes(newAddressMap, newLifelineAddressMap); } }
void join() { while (shouldRun) { try { blockPoolManager.joinAll(); if (blockPoolManager.getAllNamenodeThreads().size() == 0) { shouldRun = false; } // Terminate if shutdown is complete or 2 seconds after all BPs // are shutdown. synchronized(this) { wait(2000); } } catch (InterruptedException ex) { LOG.warn("Received exception in Datanode#join: {}", ex.toString()); } } }
BPOfferService getBPOfferService(String bpid){ return blockPoolManager.get(bpid); }
List<BPOfferService> getAllBpOs() { return blockPoolManager.getAllNamenodeThreads(); }
blockRecoveryWorker = new BlockRecoveryWorker(this); blockPoolManager = new BlockPoolManager(this); blockPoolManager.refreshNamenodes(getConf());
: this.blockPoolManager.getAllNamenodeThreads(); this.blockPoolManager.shutDownAll(bposArray); } catch (InterruptedException ie) { LOG.warn("Received exception in BlockPoolManager#shutDownAll", ie);
/** * Remove the given block pool from the block scanner, dataset, and storage. */ void shutdownBlockPool(BPOfferService bpos) { blockPoolManager.remove(bpos); if (bpos.hasBlockPoolId()) { // Possible that this is shutting down before successfully // registering anywhere. If that's the case, we wouldn't have // a block pool id String bpId = bpos.getBlockPoolId(); blockScanner.disableBlockPoolId(bpId); if (data != null) { data.shutdownBlockPool(bpId); } if (storage != null) { storage.removeBlockPoolStorage(bpId); } } }
blockPoolManager.addBlockPool(bpos);
/** * @param bpid block pool Id * @return true - if BPOfferService thread is alive */ public boolean isBPServiceAlive(String bpid) { BPOfferService bp = blockPoolManager.get(bpid); return bp != null ? bp.isAlive() : false; }
public int getBpOsCount() { return blockPoolManager.getAllNamenodeThreads().size(); }
metrics.getJvmMetrics().setPauseMonitor(pauseMonitor); blockPoolManager = new BlockPoolManager(this); blockPoolManager.refreshNamenodes(conf);
void join() { while (shouldRun) { try { blockPoolManager.joinAll(); if (blockPoolManager.getAllNamenodeThreads() != null && blockPoolManager.getAllNamenodeThreads().length == 0) { shouldRun = false; } // Terminate if shutdown is complete or 2 seconds after all BPs // are shutdown. synchronized(this) { wait(2000); } } catch (InterruptedException ex) { LOG.warn("Received exception in Datanode#join: " + ex); } } }
: this.blockPoolManager.getAllNamenodeThreads(); this.blockPoolManager.shutDownAll(bposArray); } catch (InterruptedException ie) { LOG.warn("Received exception in BlockPoolManager#shutDownAll: ", ie);
/** * Remove the given block pool from the block scanner, dataset, and storage. */ void shutdownBlockPool(BPOfferService bpos) { blockPoolManager.remove(bpos); if (bpos.hasBlockPoolId()) { // Possible that this is shutting down before successfully // registering anywhere. If that's the case, we wouldn't have // a block pool id String bpId = bpos.getBlockPoolId(); blockScanner.disableBlockPoolId(bpId); if (data != null) { data.shutdownBlockPool(bpId); } if (storage != null) { storage.removeBlockPoolStorage(bpId); } } }
blockPoolManager.addBlockPool(bpos);
/** * Try to send an error report to the NNs associated with the given * block pool. * @param bpid the block pool ID * @param errCode error code to send * @param errMsg textual message to send */ void trySendErrorReport(String bpid, int errCode, String errMsg) { BPOfferService bpos = blockPoolManager.get(bpid); if (bpos == null) { throw new IllegalArgumentException("Bad block pool: " + bpid); } bpos.trySendErrorReport(errCode, errMsg); }
/** * A data node is considered to be up if one of the bp services is up */ public boolean isDatanodeUp() { for (BPOfferService bp : blockPoolManager.getAllNamenodeThreads()) { if (bp.isAlive()) { return true; } } return false; }
metrics.getJvmMetrics().setPauseMonitor(pauseMonitor); blockPoolManager = new BlockPoolManager(this); blockPoolManager.refreshNamenodes(conf);