Package org.apache.tajo.master.DefaultFragmentScheduleAlgorithm

Examples of org.apache.tajo.master.DefaultFragmentScheduleAlgorithm.FragmentsPerDisk


  private TopologyCache topologyCache = new TopologyCache();
  private int totalFragmentNum = 0;

  private FragmentsPerDisk getHostFragmentSet(String host, Integer diskId) {
    Map<Integer, FragmentsPerDisk> fragmentsPerDiskMap;
    FragmentsPerDisk fragmentsPerDisk;
    if (fragmentHostMapping.containsKey(host)) {
      fragmentsPerDiskMap = fragmentHostMapping.get(host);
    } else {
      fragmentsPerDiskMap = new HashMap<Integer, FragmentsPerDisk>();
      fragmentHostMapping.put(host, fragmentsPerDiskMap);
    }
    if (fragmentsPerDiskMap.containsKey(diskId)) {
      fragmentsPerDisk = fragmentsPerDiskMap.get(diskId);
    } else {
      fragmentsPerDisk = new FragmentsPerDisk(diskId);
      fragmentsPerDiskMap.put(diskId, fragmentsPerDisk);
    }
    return fragmentsPerDisk;
  }
View Full Code Here


    totalFragmentNum++;
  }

  private void addFragment(String host, Integer diskId, FragmentPair fragmentPair) {
    host = topologyCache.normalize(host);
    FragmentsPerDisk fragmentsPerDisk = getHostFragmentSet(host, diskId);
    fragmentsPerDisk.addFragmentPair(fragmentPair);

    int priority;
    HostAndDisk hostAndDisk = new HostAndDisk(host, diskId);
    if (totalHostPriority.containsKey(hostAndDisk)) {
      priority = totalHostPriority.get(hostAndDisk).priority;
View Full Code Here

    }

    Map<Integer, FragmentsPerDisk> fragmentsPerDiskMap = fragmentHostMapping.get(normalizedHost);
    List<Integer> disks = Lists.newArrayList(fragmentsPerDiskMap.keySet());
    Collections.shuffle(disks);
    FragmentsPerDisk fragmentsPerDisk = null;
    FragmentPair fragmentPair = null;

    for (Integer diskId : disks) {
      fragmentsPerDisk = fragmentsPerDiskMap.get(diskId);
      if (fragmentsPerDisk != null && !fragmentsPerDisk.isEmpty()) {
        fragmentPair = getBestFragment(fragmentsPerDisk);
      }
      if (fragmentPair != null) {
        return fragmentPair;
      }
View Full Code Here

  public FragmentPair getHostLocalFragment(String host, Integer diskId) {
    String normalizedHost = NetUtils.normalizeHost(host);
    if (fragmentHostMapping.containsKey(normalizedHost)) {
      Map<Integer, FragmentsPerDisk> fragmentsPerDiskMap = fragmentHostMapping.get(normalizedHost);
      if (fragmentsPerDiskMap.containsKey(diskId)) {
        FragmentsPerDisk fragmentsPerDisk = fragmentsPerDiskMap.get(diskId);
        if (!fragmentsPerDisk.isEmpty()) {
          return getBestFragment(fragmentsPerDisk);
        }
      }
    }
    return null;
View Full Code Here

    for (int i = 0; i < hosts.length; i++) {
      String normalizedHost = NetUtils.normalizeHost(hosts[i]);
      Map<Integer, FragmentsPerDisk> diskFragmentMap = fragmentHostMapping.get(normalizedHost);

      if (diskFragmentMap != null) {
        FragmentsPerDisk fragmentsPerDisk = diskFragmentMap.get(diskIds[i]);
        if (fragmentsPerDisk != null) {
          boolean isRemoved = fragmentsPerDisk.removeFragmentPair(fragmentPair);
          if (isRemoved) {
            if (fragmentsPerDisk.size() == 0) {
              diskFragmentMap.remove(diskIds[i]);
              if (diskFragmentMap.size() == 0) {
                fragmentHostMapping.remove(normalizedHost);
              }
            }
View Full Code Here

TOP

Related Classes of org.apache.tajo.master.DefaultFragmentScheduleAlgorithm.FragmentsPerDisk

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.