Java 类org.apache.hadoop.hbase.master.SplitLogManager.ResubmitDirective 实例源码

项目:ditb    文件:ZKSplitLogManagerCoordination.java   
@Override
public boolean resubmitTask(String path, Task task, ResubmitDirective directive) {
  // its ok if this thread misses the update to task.deleted. It will fail later
  if (task.status != IN_PROGRESS) {
    return false;
  }
  int version;
  if (directive != FORCE) {
    // We're going to resubmit:
    // 1) immediately if the worker server is now marked as dead
    // 2) after a configurable timeout if the server is not marked as dead but has still not
    // finished the task. This allows to continue if the worker cannot actually handle it,
    // for any reason.
    final long time = EnvironmentEdgeManager.currentTime() - task.last_update;
    final boolean alive =
        details.getMaster().getServerManager() != null ? details.getMaster().getServerManager()
            .isServerOnline(task.cur_worker_name) : true;
    if (alive && time < timeout) {
      LOG.trace("Skipping the resubmit of " + task.toString() + "  because the server "
          + task.cur_worker_name + " is not marked as dead, we waited for " + time
          + " while the timeout is " + timeout);
      return false;
    }

    if (task.unforcedResubmits.get() >= resubmitThreshold) {
      if (!task.resubmitThresholdReached) {
        task.resubmitThresholdReached = true;
        SplitLogCounters.tot_mgr_resubmit_threshold_reached.incrementAndGet();
        LOG.info("Skipping resubmissions of task " + path + " because threshold "
            + resubmitThreshold + " reached");
      }
      return false;
    }
    // race with heartbeat() that might be changing last_version
    version = task.last_version;
  } else {
    SplitLogCounters.tot_mgr_resubmit_force.incrementAndGet();
    version = -1;
  }
  LOG.info("resubmitting task " + path);
  task.incarnation.incrementAndGet();
  boolean result = resubmit(this.details.getServerName(), path, version);
  if (!result) {
    task.heartbeatNoDetails(EnvironmentEdgeManager.currentTime());
    return false;
  }
  // don't count forced resubmits
  if (directive != FORCE) {
    task.unforcedResubmits.incrementAndGet();
  }
  task.setUnassigned();
  rescan(Long.MAX_VALUE);
  SplitLogCounters.tot_mgr_resubmit.incrementAndGet();
  return true;
}
项目:ditb    文件:ZKSplitLogManagerCoordination.java   
private void resubmitOrFail(String path, ResubmitDirective directive) {
  if (resubmitTask(path, findOrCreateOrphanTask(path), directive) == false) {
    setDone(path, FAILURE);
  }
}
项目:pbase    文件:ZKSplitLogManagerCoordination.java   
@Override
public boolean resubmitTask(String path, Task task, ResubmitDirective directive) {
  // its ok if this thread misses the update to task.deleted. It will fail later
  if (task.status != IN_PROGRESS) {
    return false;
  }
  int version;
  if (directive != FORCE) {
    // We're going to resubmit:
    // 1) immediately if the worker server is now marked as dead
    // 2) after a configurable timeout if the server is not marked as dead but has still not
    // finished the task. This allows to continue if the worker cannot actually handle it,
    // for any reason.
    final long time = EnvironmentEdgeManager.currentTime() - task.last_update;
    final boolean alive =
        details.getMaster().getServerManager() != null ? details.getMaster().getServerManager()
            .isServerOnline(task.cur_worker_name) : true;
    if (alive && time < timeout) {
      LOG.trace("Skipping the resubmit of " + task.toString() + "  because the server "
          + task.cur_worker_name + " is not marked as dead, we waited for " + time
          + " while the timeout is " + timeout);
      return false;
    }

    if (task.unforcedResubmits.get() >= resubmitThreshold) {
      if (!task.resubmitThresholdReached) {
        task.resubmitThresholdReached = true;
        SplitLogCounters.tot_mgr_resubmit_threshold_reached.incrementAndGet();
        LOG.info("Skipping resubmissions of task " + path + " because threshold "
            + resubmitThreshold + " reached");
      }
      return false;
    }
    // race with heartbeat() that might be changing last_version
    version = task.last_version;
  } else {
    SplitLogCounters.tot_mgr_resubmit_force.incrementAndGet();
    version = -1;
  }
  LOG.info("resubmitting task " + path);
  task.incarnation++;
  boolean result = resubmit(this.details.getServerName(), path, version);
  if (!result) {
    task.heartbeatNoDetails(EnvironmentEdgeManager.currentTime());
    return false;
  }
  // don't count forced resubmits
  if (directive != FORCE) {
    task.unforcedResubmits.incrementAndGet();
  }
  task.setUnassigned();
  rescan(Long.MAX_VALUE);
  SplitLogCounters.tot_mgr_resubmit.incrementAndGet();
  return true;
}
项目:pbase    文件:ZKSplitLogManagerCoordination.java   
private void resubmitOrFail(String path, ResubmitDirective directive) {
  if (resubmitTask(path, findOrCreateOrphanTask(path), directive) == false) {
    setDone(path, FAILURE);
  }
}
项目:hbase    文件:ZKSplitLogManagerCoordination.java   
@Override
public boolean resubmitTask(String path, Task task, ResubmitDirective directive) {
  // its ok if this thread misses the update to task.deleted. It will fail later
  if (task.status != IN_PROGRESS) {
    return false;
  }
  int version;
  if (directive != FORCE) {
    // We're going to resubmit:
    // 1) immediately if the worker server is now marked as dead
    // 2) after a configurable timeout if the server is not marked as dead but has still not
    // finished the task. This allows to continue if the worker cannot actually handle it,
    // for any reason.
    final long time = EnvironmentEdgeManager.currentTime() - task.last_update;
    final boolean alive =
        details.getMaster().getServerManager() != null ? details.getMaster().getServerManager()
            .isServerOnline(task.cur_worker_name) : true;
    if (alive && time < timeout) {
      LOG.trace("Skipping the resubmit of " + task.toString() + "  because the server "
          + task.cur_worker_name + " is not marked as dead, we waited for " + time
          + " while the timeout is " + timeout);
      return false;
    }

    if (task.unforcedResubmits.get() >= resubmitThreshold) {
      if (!task.resubmitThresholdReached) {
        task.resubmitThresholdReached = true;
        SplitLogCounters.tot_mgr_resubmit_threshold_reached.increment();
        LOG.info("Skipping resubmissions of task " + path + " because threshold "
            + resubmitThreshold + " reached");
      }
      return false;
    }
    // race with heartbeat() that might be changing last_version
    version = task.last_version;
  } else {
    SplitLogCounters.tot_mgr_resubmit_force.increment();
    version = -1;
  }
  LOG.info("Resubmitting task " + path);
  task.incarnation.incrementAndGet();
  boolean result = resubmit(path, version);
  if (!result) {
    task.heartbeatNoDetails(EnvironmentEdgeManager.currentTime());
    return false;
  }
  // don't count forced resubmits
  if (directive != FORCE) {
    task.unforcedResubmits.incrementAndGet();
  }
  task.setUnassigned();
  rescan(Long.MAX_VALUE);
  SplitLogCounters.tot_mgr_resubmit.increment();
  return true;
}
项目:hbase    文件:ZKSplitLogManagerCoordination.java   
private void resubmitOrFail(String path, ResubmitDirective directive) {
  if (resubmitTask(path, findOrCreateOrphanTask(path), directive) == false) {
    setDone(path, FAILURE);
  }
}
项目:ditb    文件:SplitLogManagerCoordination.java   
/**
 * Resubmit the task in case if found unassigned or failed
 * @param taskName path related to task
 * @param task to resubmit
 * @param force whether it should be forced
 * @return whether it was successful
 */

boolean resubmitTask(String taskName, Task task, ResubmitDirective force);
项目:pbase    文件:SplitLogManagerCoordination.java   
/**
 * Resubmit the task in case if found unassigned or failed
 * @param taskName path related to task
 * @param task to resubmit
 * @param force whether it should be forced
 * @return whether it was successful
 */

boolean resubmitTask(String taskName, Task task, ResubmitDirective force);
项目:hbase    文件:SplitLogManagerCoordination.java   
/**
 * Resubmit the task in case if found unassigned or failed
 * @param taskName path related to task
 * @param task to resubmit
 * @param force whether it should be forced
 * @return whether it was successful
 */

boolean resubmitTask(String taskName, Task task, ResubmitDirective force);