hadoop 2.6.0 hdfs ReplicationMonitor 源代码分析
来源:互联网 发布:手机按键屏蔽软件 编辑:程序博客网 时间:2024/05/27 20:17
ReplicationMonitor每一段时间执行computeDatanodeWork,processPendingReplications,然后再sleep一段时间。
private class ReplicationMonitor implements Runnable { @Override public void run() { while (namesystem.isRunning()) { try { // Process replication work only when active NN is out of safe mode. if (namesystem.isPopulatingReplQueues()) { computeDatanodeWork(); processPendingReplications(); } Thread.sleep(replicationRecheckInterval); } catch (Throwable t) { if (!namesystem.isRunning()) { LOG.info("Stopping ReplicationMonitor."); if (!(t instanceof InterruptedException)) { LOG.info("ReplicationMonitor received an exception" + " while shutting down.", t); } break; } else if (!checkNSRunning && t instanceof InterruptedException) { LOG.info("Stopping ReplicationMonitor for testing."); break; } LOG.fatal("ReplicationMonitor thread received Runtime exception. ", t); terminate(1, t); } } } }
computeDatanodeWork的代码如下:
/** * Compute block replication and block invalidation work that can be scheduled * on data-nodes. The datanode will be informed of this work at the next * heartbeat. * * @return number of blocks scheduled for replication or removal. */ int computeDatanodeWork() { // Blocks should not be replicated or removed if in safe mode. // It's OK to check safe mode here w/o holding lock, in the worst // case extra replications will be scheduled, and these will get // fixed up later. if (namesystem.isInSafeMode()) { return 0; } final int numlive = heartbeatManager.getLiveDatanodeCount(); final int blocksToProcess = numlive * this.blocksReplWorkMultiplier; final int nodesToProcess = (int) Math.ceil(numlive * this.blocksInvalidateWorkPct); int workFound = this.computeReplicationWork(blocksToProcess); // Update counters namesystem.writeLock(); try { this.updateState(); this.scheduledReplicationBlocksCount = workFound; } finally { namesystem.writeUnlock(); } workFound += this.computeInvalidateWork(nodesToProcess); return workFound; }
0 0
- hadoop 2.6.0 hdfs ReplicationMonitor 源代码分析
- Hadoop源代码分析 - HDFS
- hadoop 2.6.0 org.apache.hadoop.hdfs.server.blockmanagement。HeartbeatManager源代码分析
- HDFS源码分析数据块复制监控线程ReplicationMonitor(一)
- HDFS源码分析数据块复制监控线程ReplicationMonitor(二)
- hadoop 2.6.0 LightWeightGSet源代码分析
- Hadoop 2.6.0 FSDirectory源代码分析
- hadoop 2.6.0 JvmPauseMonitor源代码分析
- hadoop 2.6.0 CorruptReplicasMap源代码分析
- hadoop2.X之HDFS集群管理:ReplicationMonitor
- hadoop 2.6 IntrusiveCollection 源代码分析
- hadoop 2.6 PendingBlockInfo源代码分析
- hadoop 2.6 NetworkTopology源代码分析
- hadoop 2.6 HdfsServerConstants源代码分析
- Hadoop源码分析-HDFS
- Hadoop: HDFS数据流分析
- Hadoop源码分析笔记(六):HDFS源代码结构和基于IPC调用接口
- Hadoop学习九:hdfs源代码调试
- Codeforces 617C Watering Flowers (Round #340 (Div. 2) C题) nlogn算法
- Dubbo与Zookeeper、SpringMVC整合和使用(负载均衡、容错)
- JSON数据格式及解析下
- Hack6 为ViewGroup添加动画效果
- iOS开发-进阶:图像进行压缩方法汇总
- hadoop 2.6.0 hdfs ReplicationMonitor 源代码分析
- 第 9 章 单位和值
- AngularJs自定义服务(一)——$provide
- JDK1.8 HashMap源码分析
- jenkins邮件插件Email Extension Plugin的安装与配置
- hdu1241 深度搜索
- javascript 中的console.log由浅入
- Attribute "title" has already been defined 异常解决
- How to control your dust collection with an Arduino (it's easy)