hdfs多副本删除策略

2020-06-09  本文已影响0人  sunTengSt

代码:

chooseExcessReplicates

// split nodes into two sets
// moreThanOne contains nodes on rack with more than one replica
// exactlyOne contains the remaining nodes
splitNodesWithRack(candidates, rackMap, moreThanOne, exactlyOne);

// pick one node to delete that favors the delete hint
// otherwise pick one with least space from priSet if it is not empty
// otherwise one node with least space from remains
//oldestHeartbeat
if(lastHeartbeat < oldestHeartbeat) {
  oldestHeartbeat = lastHeartbeat;
  oldestHeartbeatStorage = storage;
}
//HDFS可用空间
if (minSpace > free) {
  minSpace = free;
  minSpaceStorage = storage;
}

oldestHeartbeat

long oldestHeartbeat =
  now() - heartbeatInterval * tolerateHeartbeatMultiplier;
  
this.tolerateHeartbeatMultiplier = conf.getInt(
DFSConfigKeys.DFS_NAMENODE_TOLERATE_HEARTBEAT_MULTIPLIER_KEY,4);
this.heartbeatInterval = conf.getLong(
    DFSConfigKeys.DFS_HEARTBEAT_INTERVAL_KEY,3) * 1000;
public static long now() {
  return System.currentTimeMillis();
}
上一篇 下一篇

猜你喜欢

热点阅读