Search in sources :

Example 1 with SplitLogWorkerCoordination

use of org.apache.hadoop.hbase.coordination.SplitLogWorkerCoordination in project hbase by apache.

the class SplitLogWorker method splitLog.

/**
 * @return Result either DONE, RESIGNED, or ERR.
 */
static Status splitLog(String filename, CancelableProgressable p, Configuration conf, RegionServerServices server, LastSequenceId sequenceIdChecker, WALFactory factory) {
    Path walDir;
    FileSystem fs;
    try {
        walDir = CommonFSUtils.getWALRootDir(conf);
        fs = walDir.getFileSystem(conf);
    } catch (IOException e) {
        LOG.warn("Resigning, could not find root dir or fs", e);
        return Status.RESIGNED;
    }
    try {
        if (!processSyncReplicationWAL(filename, conf, server, fs, walDir)) {
            return Status.DONE;
        }
    } catch (IOException e) {
        LOG.warn("failed to process sync replication wal {}", filename, e);
        return Status.RESIGNED;
    }
    // encountered a bad non-retry-able persistent error.
    try {
        SplitLogWorkerCoordination splitLogWorkerCoordination = server.getCoordinatedStateManager() == null ? null : server.getCoordinatedStateManager().getSplitLogWorkerCoordination();
        if (!WALSplitter.splitLogFile(walDir, fs.getFileStatus(new Path(walDir, filename)), fs, conf, p, sequenceIdChecker, splitLogWorkerCoordination, factory, server)) {
            return Status.PREEMPTED;
        }
    } catch (InterruptedIOException iioe) {
        LOG.warn("Resigning, interrupted splitting WAL {}", filename, iioe);
        return Status.RESIGNED;
    } catch (IOException e) {
        if (e instanceof FileNotFoundException) {
            // A wal file may not exist anymore. Nothing can be recovered so move on
            LOG.warn("Done, WAL {} does not exist anymore", filename, e);
            return Status.DONE;
        }
        Throwable cause = e.getCause();
        if (e instanceof RetriesExhaustedException && (cause instanceof NotServingRegionException || cause instanceof ConnectException || cause instanceof SocketTimeoutException)) {
            LOG.warn("Resigning, can't connect to target regionserver splitting WAL {}", filename, e);
            return Status.RESIGNED;
        } else if (cause instanceof InterruptedException) {
            LOG.warn("Resigning, interrupted splitting WAL {}", filename, e);
            return Status.RESIGNED;
        }
        LOG.warn("Error splitting WAL {}", filename, e);
        return Status.ERR;
    }
    LOG.debug("Done splitting WAL {}", filename);
    return Status.DONE;
}
Also used : Path(org.apache.hadoop.fs.Path) InterruptedIOException(java.io.InterruptedIOException) SplitLogWorkerCoordination(org.apache.hadoop.hbase.coordination.SplitLogWorkerCoordination) SocketTimeoutException(java.net.SocketTimeoutException) RetriesExhaustedException(org.apache.hadoop.hbase.client.RetriesExhaustedException) NotServingRegionException(org.apache.hadoop.hbase.NotServingRegionException) FileSystem(org.apache.hadoop.fs.FileSystem) FileNotFoundException(java.io.FileNotFoundException) InterruptedIOException(java.io.InterruptedIOException) IOException(java.io.IOException) ConnectException(java.net.ConnectException)

Aggregations

FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 InterruptedIOException (java.io.InterruptedIOException)1 ConnectException (java.net.ConnectException)1 SocketTimeoutException (java.net.SocketTimeoutException)1 FileSystem (org.apache.hadoop.fs.FileSystem)1 Path (org.apache.hadoop.fs.Path)1 NotServingRegionException (org.apache.hadoop.hbase.NotServingRegionException)1 RetriesExhaustedException (org.apache.hadoop.hbase.client.RetriesExhaustedException)1 SplitLogWorkerCoordination (org.apache.hadoop.hbase.coordination.SplitLogWorkerCoordination)1