Search in sources :

Example 1 with WALSplitterHandler

use of org.apache.hadoop.hbase.regionserver.handler.WALSplitterHandler in project hbase by apache.

the class ZkSplitLogWorkerCoordination method submitTask.

/**
   * Submit a log split task to executor service
   * @param curTask task to submit
   * @param curTaskZKVersion current version of task
   */
void submitTask(final String curTask, final RecoveryMode mode, final int curTaskZKVersion, final int reportPeriod) {
    final MutableInt zkVersion = new MutableInt(curTaskZKVersion);
    CancelableProgressable reporter = new CancelableProgressable() {

        private long last_report_at = 0;

        @Override
        public boolean progress() {
            long t = EnvironmentEdgeManager.currentTime();
            if ((t - last_report_at) > reportPeriod) {
                last_report_at = t;
                int latestZKVersion = attemptToOwnTask(false, watcher, server.getServerName(), curTask, mode, zkVersion.intValue());
                if (latestZKVersion < 0) {
                    LOG.warn("Failed to heartbeat the task" + curTask);
                    return false;
                }
                zkVersion.setValue(latestZKVersion);
            }
            return true;
        }
    };
    ZkSplitLogWorkerCoordination.ZkSplitTaskDetails splitTaskDetails = new ZkSplitLogWorkerCoordination.ZkSplitTaskDetails();
    splitTaskDetails.setTaskNode(curTask);
    splitTaskDetails.setCurTaskZKVersion(zkVersion);
    WALSplitterHandler hsh = new WALSplitterHandler(server, this, splitTaskDetails, reporter, this.tasksInProgress, splitTaskExecutor, mode);
    server.getExecutorService().submit(hsh);
}
Also used : WALSplitterHandler(org.apache.hadoop.hbase.regionserver.handler.WALSplitterHandler) MutableInt(org.apache.commons.lang.mutable.MutableInt) CancelableProgressable(org.apache.hadoop.hbase.util.CancelableProgressable)

Aggregations

MutableInt (org.apache.commons.lang.mutable.MutableInt)1 WALSplitterHandler (org.apache.hadoop.hbase.regionserver.handler.WALSplitterHandler)1 CancelableProgressable (org.apache.hadoop.hbase.util.CancelableProgressable)1