HBASE-23024 Replace initcause with Constructor arg (#627)
Signed-off-by: Peter Somogyi <psomogyi@apache.org>
This commit is contained in:
parent
41990ba20a
commit
5c4d8e036f
|
@ -42,4 +42,14 @@ public class DroppedSnapshotException extends IOException {
|
|||
public DroppedSnapshotException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* DroppedSnapshotException with cause
|
||||
*
|
||||
* @param message the message for this exception
|
||||
* @param cause the cause for this exception
|
||||
*/
|
||||
public DroppedSnapshotException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,5 +55,15 @@ public class ConnectionClosingException extends IOException {
|
|||
super(string);
|
||||
}
|
||||
|
||||
/**
|
||||
* ConnectionClosingException with cause
|
||||
*
|
||||
* @param message the message for this exception
|
||||
* @param cause the cause for this exception
|
||||
*/
|
||||
public ConnectionClosingException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -8980028569652624236L;
|
||||
}
|
||||
|
|
|
@ -392,7 +392,7 @@ class BlockingRpcConnection extends RpcConnection implements Runnable {
|
|||
String msg = "Couldn't setup connection for " +
|
||||
UserGroupInformation.getLoginUser().getUserName() + " to " + serverPrincipal;
|
||||
LOG.warn(msg, ex);
|
||||
throw (IOException) new IOException(msg).initCause(ex);
|
||||
throw new IOException(msg, ex);
|
||||
}
|
||||
} else {
|
||||
LOG.warn("Exception encountered while connecting to " + "the server : " + ex);
|
||||
|
|
|
@ -32,4 +32,14 @@ public class CallTimeoutException extends IOException {
|
|||
public CallTimeoutException(final String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* CallTimeoutException with cause
|
||||
*
|
||||
* @param message the message for this exception
|
||||
* @param cause the cause for this exception
|
||||
*/
|
||||
public CallTimeoutException(final String message, final Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -168,17 +168,17 @@ class IPCUtil {
|
|||
return (SocketTimeoutException) new SocketTimeoutException(
|
||||
"Call to " + addr + " failed because " + exception).initCause(exception);
|
||||
} else if (exception instanceof ConnectionClosingException) {
|
||||
return (ConnectionClosingException) new ConnectionClosingException(
|
||||
"Call to " + addr + " failed on local exception: " + exception).initCause(exception);
|
||||
return new ConnectionClosingException("Call to " + addr + " failed on local exception: "
|
||||
+ exception, exception);
|
||||
} else if (exception instanceof ServerTooBusyException) {
|
||||
// we already have address in the exception message
|
||||
return (IOException) exception;
|
||||
} else if (exception instanceof DoNotRetryIOException) {
|
||||
return (IOException) new DoNotRetryIOException(
|
||||
"Call to " + addr + " failed on local exception: " + exception).initCause(exception);
|
||||
return new DoNotRetryIOException(
|
||||
"Call to " + addr + " failed on local exception: " + exception, exception);
|
||||
} else {
|
||||
return (IOException) new IOException(
|
||||
"Call to " + addr + " failed on local exception: " + exception).initCause(exception);
|
||||
return new IOException(
|
||||
"Call to " + addr + " failed on local exception: " + exception, exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -307,10 +307,8 @@ public abstract class CommonFSUtils {
|
|||
}
|
||||
return root;
|
||||
} catch (URISyntaxException e) {
|
||||
IOException io = new IOException("Root directory path is not a valid " +
|
||||
"URI -- check your " + HConstants.HBASE_DIR + " configuration");
|
||||
io.initCause(e);
|
||||
throw io;
|
||||
throw new IOException("Root directory path is not a valid " +
|
||||
"URI -- check your " + HConstants.HBASE_DIR + " configuration", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -515,9 +515,7 @@ public class MasterFileSystem {
|
|||
}
|
||||
} catch (DeserializationException de) {
|
||||
LOG.fatal("Please fix invalid configuration for " + dirConfKey, de);
|
||||
IOException ioe = new IOException();
|
||||
ioe.initCause(de);
|
||||
throw ioe;
|
||||
throw new IOException(de);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
LOG.fatal("Please fix invalid configuration for "
|
||||
+ dirConfKey + " " + rd.toString(), iae);
|
||||
|
|
|
@ -2692,8 +2692,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
|
|||
wal.abortCacheFlush(this.getRegionInfo().getEncodedNameAsBytes());
|
||||
}
|
||||
DroppedSnapshotException dse = new DroppedSnapshotException("region: " +
|
||||
Bytes.toStringBinary(getRegionInfo().getRegionName()));
|
||||
dse.initCause(t);
|
||||
Bytes.toStringBinary(getRegionInfo().getRegionName()), t);
|
||||
status.abort("Flush failed: " + StringUtils.stringifyException(t));
|
||||
|
||||
// Callers for flushcache() should catch DroppedSnapshotException and abort the region server.
|
||||
|
@ -5690,8 +5689,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
|
|||
// is reached, it will throw out an Error. This Error needs to be caught so it can
|
||||
// go ahead to process the minibatch with lock acquired.
|
||||
LOG.warn("Error to get row lock for " + Bytes.toStringBinary(row) + ", cause: " + error);
|
||||
IOException ioe = new IOException();
|
||||
ioe.initCause(error);
|
||||
IOException ioe = new IOException(error);
|
||||
if (traceScope != null) {
|
||||
traceScope.getSpan().addTimelineAnnotation("Error getting row lock");
|
||||
}
|
||||
|
|
|
@ -144,9 +144,7 @@ public final class SnapshotManifestV1 {
|
|||
} catch (InterruptedException e) {
|
||||
throw new InterruptedIOException(e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
IOException ex = new IOException();
|
||||
ex.initCause(e.getCause());
|
||||
throw ex;
|
||||
throw new IOException(e.getCause());
|
||||
}
|
||||
return regionsManifest;
|
||||
}
|
||||
|
|
|
@ -173,9 +173,7 @@ public final class SnapshotManifestV2 {
|
|||
if(t instanceof InvalidProtocolBufferException) {
|
||||
throw (InvalidProtocolBufferException)t;
|
||||
} else {
|
||||
IOException ex = new IOException("ExecutionException");
|
||||
ex.initCause(e.getCause());
|
||||
throw ex;
|
||||
throw new IOException("ExecutionException", e.getCause());
|
||||
}
|
||||
}
|
||||
return regionsManifest;
|
||||
|
|
|
@ -228,9 +228,7 @@ public final class SnapshotReferenceUtil {
|
|||
if (e.getCause() instanceof CorruptedSnapshotException) {
|
||||
throw new CorruptedSnapshotException(e.getCause().getMessage(), snapshotDesc);
|
||||
} else {
|
||||
IOException ex = new IOException();
|
||||
ex.initCause(e.getCause());
|
||||
throw ex;
|
||||
throw new IOException(e.getCause());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -260,9 +260,7 @@ public abstract class FSUtils extends CommonFSUtils {
|
|||
} catch (Exception e) {
|
||||
LOG.error("file system close failed: ", e);
|
||||
}
|
||||
IOException io = new IOException("File system is not available");
|
||||
io.initCause(exception);
|
||||
throw io;
|
||||
throw new IOException("File system is not available", exception);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -95,9 +95,7 @@ public class JVMClusterUtil {
|
|||
hrsc.toString() + ((target.getCause() != null)?
|
||||
target.getCause().getMessage(): ""), target);
|
||||
} catch (Exception e) {
|
||||
IOException ioe = new IOException();
|
||||
ioe.initCause(e);
|
||||
throw ioe;
|
||||
throw new IOException(e);
|
||||
}
|
||||
return new JVMClusterUtil.RegionServerThread(server, index);
|
||||
}
|
||||
|
@ -144,9 +142,7 @@ public class JVMClusterUtil {
|
|||
hmc.toString() + ((target.getCause() != null)?
|
||||
target.getCause().getMessage(): ""), target);
|
||||
} catch (Exception e) {
|
||||
IOException ioe = new IOException();
|
||||
ioe.initCause(e);
|
||||
throw ioe;
|
||||
throw new IOException(e);
|
||||
}
|
||||
return new JVMClusterUtil.MasterThread(server, index);
|
||||
}
|
||||
|
|
|
@ -246,9 +246,7 @@ public abstract class ModifyRegionUtils {
|
|||
} catch (InterruptedException e) {
|
||||
throw new InterruptedIOException(e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
IOException ex = new IOException();
|
||||
ex.initCause(e.getCause());
|
||||
throw ex;
|
||||
throw new IOException(e.getCause());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -814,11 +814,8 @@ public class WALSplitter {
|
|||
if (!skipErrors || e instanceof InterruptedIOException) {
|
||||
throw e; // Don't mark the file corrupted if interrupted, or not skipErrors
|
||||
}
|
||||
CorruptedLogFileException t =
|
||||
new CorruptedLogFileException("skipErrors=true Could not open wal " +
|
||||
path + " ignoring");
|
||||
t.initCause(e);
|
||||
throw t;
|
||||
throw new CorruptedLogFileException("skipErrors=true Could not open wal "
|
||||
+ path + " ignoring", e);
|
||||
}
|
||||
return in;
|
||||
}
|
||||
|
@ -844,11 +841,8 @@ public class WALSplitter {
|
|||
if (!skipErrors) {
|
||||
throw e;
|
||||
}
|
||||
CorruptedLogFileException t =
|
||||
new CorruptedLogFileException("skipErrors=true Ignoring exception" +
|
||||
" while parsing wal " + path + ". Marking as corrupted");
|
||||
t.initCause(e);
|
||||
throw t;
|
||||
throw new CorruptedLogFileException("skipErrors=true Ignoring exception"
|
||||
+ " while parsing wal " + path + ". Marking as corrupted", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2416,6 +2410,16 @@ public class WALSplitter {
|
|||
CorruptedLogFileException(String s) {
|
||||
super(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* CorruptedLogFileException with cause
|
||||
*
|
||||
* @param message the message for this exception
|
||||
* @param cause the cause for this exception
|
||||
*/
|
||||
CorruptedLogFileException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
|
||||
/** A struct used by getMutationsFromWALEntry */
|
||||
|
|
Loading…
Reference in New Issue