Java 类org.apache.hadoop.hdfs.server.balancer.Matcher 实例源码

项目:hadoop    文件:Mover.java   
boolean scheduleMoveReplica(DBlock db, Source source,
    List<StorageType> targetTypes) {
  // Match storage on the same node
  if (chooseTargetInSameNode(db, source, targetTypes)) {
    return true;
  }

  if (dispatcher.getCluster().isNodeGroupAware()) {
    if (chooseTarget(db, source, targetTypes, Matcher.SAME_NODE_GROUP)) {
      return true;
    }
  }

  // Then, match nodes on the same rack
  if (chooseTarget(db, source, targetTypes, Matcher.SAME_RACK)) {
    return true;
  }
  // At last, match all remaining nodes
  return chooseTarget(db, source, targetTypes, Matcher.ANY_OTHER);
}
项目:hadoop    文件:Mover.java   
boolean chooseTarget(DBlock db, Source source,
    List<StorageType> targetTypes, Matcher matcher) {
  final NetworkTopology cluster = dispatcher.getCluster(); 
  for (StorageType t : targetTypes) {
    for(StorageGroup target : storages.getTargetStorages(t)) {
      if (matcher.match(cluster, source.getDatanodeInfo(),
          target.getDatanodeInfo())) {
        final PendingMove pm = source.addPendingMove(db, target);
        if (pm != null) {
          dispatcher.executePendingMove(pm);
          return true;
        }
      }
    }
  }
  return false;
}
项目:aliyun-oss-hadoop-fs    文件:Mover.java   
boolean scheduleMoveReplica(DBlock db, Source source,
    List<StorageType> targetTypes) {
  // Match storage on the same node
  if (chooseTargetInSameNode(db, source, targetTypes)) {
    return true;
  }

  if (dispatcher.getCluster().isNodeGroupAware()) {
    if (chooseTarget(db, source, targetTypes, Matcher.SAME_NODE_GROUP)) {
      return true;
    }
  }

  // Then, match nodes on the same rack
  if (chooseTarget(db, source, targetTypes, Matcher.SAME_RACK)) {
    return true;
  }
  // At last, match all remaining nodes
  return chooseTarget(db, source, targetTypes, Matcher.ANY_OTHER);
}
项目:aliyun-oss-hadoop-fs    文件:Mover.java   
boolean chooseTarget(DBlock db, Source source,
    List<StorageType> targetTypes, Matcher matcher) {
  final NetworkTopology cluster = dispatcher.getCluster(); 
  for (StorageType t : targetTypes) {
    for(StorageGroup target : storages.getTargetStorages(t)) {
      if (matcher.match(cluster, source.getDatanodeInfo(),
          target.getDatanodeInfo())) {
        final PendingMove pm = source.addPendingMove(db, target);
        if (pm != null) {
          dispatcher.executePendingMove(pm);
          return true;
        }
      }
    }
  }
  return false;
}
项目:big-c    文件:Mover.java   
boolean scheduleMoveReplica(DBlock db, Source source,
    List<StorageType> targetTypes) {
  // Match storage on the same node
  if (chooseTargetInSameNode(db, source, targetTypes)) {
    return true;
  }

  if (dispatcher.getCluster().isNodeGroupAware()) {
    if (chooseTarget(db, source, targetTypes, Matcher.SAME_NODE_GROUP)) {
      return true;
    }
  }

  // Then, match nodes on the same rack
  if (chooseTarget(db, source, targetTypes, Matcher.SAME_RACK)) {
    return true;
  }
  // At last, match all remaining nodes
  return chooseTarget(db, source, targetTypes, Matcher.ANY_OTHER);
}
项目:big-c    文件:Mover.java   
boolean chooseTarget(DBlock db, Source source,
    List<StorageType> targetTypes, Matcher matcher) {
  final NetworkTopology cluster = dispatcher.getCluster(); 
  for (StorageType t : targetTypes) {
    for(StorageGroup target : storages.getTargetStorages(t)) {
      if (matcher.match(cluster, source.getDatanodeInfo(),
          target.getDatanodeInfo())) {
        final PendingMove pm = source.addPendingMove(db, target);
        if (pm != null) {
          dispatcher.executePendingMove(pm);
          return true;
        }
      }
    }
  }
  return false;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:Mover.java   
boolean scheduleMoveReplica(DBlock db, Source source,
    List<StorageType> targetTypes) {
  // Match storage on the same node
  if (chooseTargetInSameNode(db, source, targetTypes)) {
    return true;
  }

  if (dispatcher.getCluster().isNodeGroupAware()) {
    if (chooseTarget(db, source, targetTypes, Matcher.SAME_NODE_GROUP)) {
      return true;
    }
  }

  // Then, match nodes on the same rack
  if (chooseTarget(db, source, targetTypes, Matcher.SAME_RACK)) {
    return true;
  }
  // At last, match all remaining nodes
  return chooseTarget(db, source, targetTypes, Matcher.ANY_OTHER);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:Mover.java   
boolean chooseTarget(DBlock db, Source source,
    List<StorageType> targetTypes, Matcher matcher) {
  final NetworkTopology cluster = dispatcher.getCluster(); 
  for (StorageType t : targetTypes) {
    for(StorageGroup target : storages.getTargetStorages(t)) {
      if (matcher.match(cluster, source.getDatanodeInfo(),
          target.getDatanodeInfo())) {
        final PendingMove pm = source.addPendingMove(db, target);
        if (pm != null) {
          dispatcher.executePendingMove(pm);
          return true;
        }
      }
    }
  }
  return false;
}
项目:FlexMap    文件:Mover.java   
boolean chooseTarget(DBlock db, Source source,
    List<StorageType> targetTypes, Matcher matcher) {
  final NetworkTopology cluster = dispatcher.getCluster(); 
  for (StorageType t : targetTypes) {
    for(StorageGroup target : storages.getTargetStorages(t)) {
      if (matcher.match(cluster, source.getDatanodeInfo(),
          target.getDatanodeInfo())) {
        final PendingMove pm = source.addPendingMove(db, target);
        if (pm != null) {
          dispatcher.executePendingMove(pm);
          return true;
        }
      }
    }
  }
  return false;
}
项目:FlexMap    文件:Mover.java   
boolean scheduleMoveReplica(DBlock db, Source source,
    List<StorageType> targetTypes) {
  if (dispatcher.getCluster().isNodeGroupAware()) {
    if (chooseTarget(db, source, targetTypes, Matcher.SAME_NODE_GROUP)) {
      return true;
    }
  }

  // Then, match nodes on the same rack
  if (chooseTarget(db, source, targetTypes, Matcher.SAME_RACK)) {
    return true;
  }
  // At last, match all remaining nodes
  return chooseTarget(db, source, targetTypes, Matcher.ANY_OTHER);
}