HBASE-23024 Replace initcause with Constructor arg (#627)
Signed-off-by: Peter Somogyi <psomogyi@apache.org>
This commit is contained in:
parent
9198525501
commit
0dbae8f0e1
|
@ -40,4 +40,14 @@ public class DroppedSnapshotException extends IOException {
|
||||||
public DroppedSnapshotException(String message) {
|
public DroppedSnapshotException(String message) {
|
||||||
super(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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,4 +33,13 @@ public class ConnectionClosedException extends HBaseIOException {
|
||||||
super(string);
|
super(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ConnectionClosedException with cause
|
||||||
|
*
|
||||||
|
* @param message the message for this exception
|
||||||
|
* @param cause the cause for this exception
|
||||||
|
*/
|
||||||
|
public ConnectionClosedException(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,5 +53,15 @@ public class ConnectionClosingException extends IOException {
|
||||||
super(string);
|
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;
|
private static final long serialVersionUID = -8980028569652624236L;
|
||||||
}
|
}
|
||||||
|
|
|
@ -410,7 +410,7 @@ class BlockingRpcConnection extends RpcConnection implements Runnable {
|
||||||
String msg = "Couldn't setup connection for "
|
String msg = "Couldn't setup connection for "
|
||||||
+ UserGroupInformation.getLoginUser().getUserName() + " to " + serverPrincipal;
|
+ UserGroupInformation.getLoginUser().getUserName() + " to " + serverPrincipal;
|
||||||
LOG.warn(msg, ex);
|
LOG.warn(msg, ex);
|
||||||
throw (IOException) new IOException(msg).initCause(ex);
|
throw new IOException(msg, ex);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOG.warn("Exception encountered while connecting to " + "the server : " + ex);
|
LOG.warn("Exception encountered while connecting to " + "the server : " + ex);
|
||||||
|
|
|
@ -30,4 +30,14 @@ public class CallTimeoutException extends HBaseIOException {
|
||||||
public CallTimeoutException(final String msg) {
|
public CallTimeoutException(final String msg) {
|
||||||
super(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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,8 +180,8 @@ class IPCUtil {
|
||||||
return (IOException) new SocketTimeoutException(
|
return (IOException) new SocketTimeoutException(
|
||||||
"Call to " + addr + " failed because " + error).initCause(error);
|
"Call to " + addr + " failed because " + error).initCause(error);
|
||||||
} else if (error instanceof ConnectionClosingException) {
|
} else if (error instanceof ConnectionClosingException) {
|
||||||
return (IOException) new ConnectionClosingException(
|
return new ConnectionClosingException("Call to " + addr + " failed on local exception: "
|
||||||
"Call to " + addr + " failed on local exception: " + error).initCause(error);
|
+ error, error);
|
||||||
} else if (error instanceof ServerTooBusyException) {
|
} else if (error instanceof ServerTooBusyException) {
|
||||||
// we already have address in the exception message
|
// we already have address in the exception message
|
||||||
return (IOException) error;
|
return (IOException) error;
|
||||||
|
@ -195,22 +195,22 @@ class IPCUtil {
|
||||||
| InvocationTargetException | NoSuchMethodException | SecurityException e) {
|
| InvocationTargetException | NoSuchMethodException | SecurityException e) {
|
||||||
// just ignore, will just new a DoNotRetryIOException instead below
|
// just ignore, will just new a DoNotRetryIOException instead below
|
||||||
}
|
}
|
||||||
return (IOException) new DoNotRetryIOException(
|
return new DoNotRetryIOException("Call to " + addr + " failed on local exception: "
|
||||||
"Call to " + addr + " failed on local exception: " + error).initCause(error);
|
+ error, error);
|
||||||
} else if (error instanceof ConnectionClosedException) {
|
} else if (error instanceof ConnectionClosedException) {
|
||||||
return (IOException) new ConnectionClosedException(
|
return new ConnectionClosedException("Call to " + addr + " failed on local exception: "
|
||||||
"Call to " + addr + " failed on local exception: " + error).initCause(error);
|
+ error, error);
|
||||||
} else if (error instanceof CallTimeoutException) {
|
} else if (error instanceof CallTimeoutException) {
|
||||||
return (IOException) new CallTimeoutException(
|
return new CallTimeoutException("Call to " + addr + " failed on local exception: "
|
||||||
"Call to " + addr + " failed on local exception: " + error).initCause(error);
|
+ error, error);
|
||||||
} else if (error instanceof ClosedChannelException) {
|
} else if (error instanceof ClosedChannelException) {
|
||||||
// ClosedChannelException does not have a constructor which takes a String but it is a
|
// ClosedChannelException does not have a constructor which takes a String but it is a
|
||||||
// connection exception so we keep its original type
|
// connection exception so we keep its original type
|
||||||
return (IOException) error;
|
return (IOException) error;
|
||||||
} else if (error instanceof TimeoutException) {
|
} else if (error instanceof TimeoutException) {
|
||||||
// TimeoutException is not an IOException, let's convert it to TimeoutIOException.
|
// TimeoutException is not an IOException, let's convert it to TimeoutIOException.
|
||||||
return (IOException) new TimeoutIOException(
|
return new TimeoutIOException("Call to " + addr + " failed on local exception: "
|
||||||
"Call to " + addr + " failed on local exception: " + error).initCause(error);
|
+ error, error);
|
||||||
} else {
|
} else {
|
||||||
// try our best to keep the original exception type
|
// try our best to keep the original exception type
|
||||||
if (error instanceof IOException) {
|
if (error instanceof IOException) {
|
||||||
|
@ -224,8 +224,8 @@ class IPCUtil {
|
||||||
// just ignore, will just new an IOException instead below
|
// just ignore, will just new an IOException instead below
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (IOException) new HBaseIOException(
|
return new HBaseIOException("Call to " + addr + " failed on local exception: "
|
||||||
"Call to " + addr + " failed on local exception: " + error).initCause(error);
|
+ error, error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -309,10 +309,8 @@ public abstract class CommonFSUtils {
|
||||||
}
|
}
|
||||||
return root;
|
return root;
|
||||||
} catch (URISyntaxException e) {
|
} catch (URISyntaxException e) {
|
||||||
IOException io = new IOException("Root directory path is not a valid " +
|
throw new IOException("Root directory path is not a valid " +
|
||||||
"URI -- check your " + HConstants.HBASE_DIR + " configuration");
|
"URI -- check your " + HConstants.HBASE_DIR + " configuration", e);
|
||||||
io.initCause(e);
|
|
||||||
throw io;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -275,9 +275,7 @@ public class MasterFileSystem {
|
||||||
} catch (DeserializationException de) {
|
} catch (DeserializationException de) {
|
||||||
LOG.error(HBaseMarkers.FATAL, "Please fix invalid configuration for "
|
LOG.error(HBaseMarkers.FATAL, "Please fix invalid configuration for "
|
||||||
+ HConstants.HBASE_DIR, de);
|
+ HConstants.HBASE_DIR, de);
|
||||||
IOException ioe = new IOException();
|
throw new IOException(de);
|
||||||
ioe.initCause(de);
|
|
||||||
throw ioe;
|
|
||||||
} catch (IllegalArgumentException iae) {
|
} catch (IllegalArgumentException iae) {
|
||||||
LOG.error(HBaseMarkers.FATAL, "Please fix invalid configuration for "
|
LOG.error(HBaseMarkers.FATAL, "Please fix invalid configuration for "
|
||||||
+ HConstants.HBASE_DIR + " " + rd.toString(), iae);
|
+ HConstants.HBASE_DIR + " " + rd.toString(), iae);
|
||||||
|
|
|
@ -2877,8 +2877,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
|
||||||
wal.abortCacheFlush(this.getRegionInfo().getEncodedNameAsBytes());
|
wal.abortCacheFlush(this.getRegionInfo().getEncodedNameAsBytes());
|
||||||
}
|
}
|
||||||
DroppedSnapshotException dse = new DroppedSnapshotException("region: " +
|
DroppedSnapshotException dse = new DroppedSnapshotException("region: " +
|
||||||
Bytes.toStringBinary(getRegionInfo().getRegionName()));
|
Bytes.toStringBinary(getRegionInfo().getRegionName()), t);
|
||||||
dse.initCause(t);
|
|
||||||
status.abort("Flush failed: " + StringUtils.stringifyException(t));
|
status.abort("Flush failed: " + StringUtils.stringifyException(t));
|
||||||
|
|
||||||
// Callers for flushcache() should catch DroppedSnapshotException and abort the region server.
|
// Callers for flushcache() should catch DroppedSnapshotException and abort the region server.
|
||||||
|
@ -5983,8 +5982,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
|
// 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.
|
// go ahead to process the minibatch with lock acquired.
|
||||||
LOG.warn("Error to get row lock for " + Bytes.toStringBinary(row) + ", cause: " + error);
|
LOG.warn("Error to get row lock for " + Bytes.toStringBinary(row) + ", cause: " + error);
|
||||||
IOException ioe = new IOException();
|
IOException ioe = new IOException(error);
|
||||||
ioe.initCause(error);
|
|
||||||
TraceUtil.addTimelineAnnotation("Error getting row lock");
|
TraceUtil.addTimelineAnnotation("Error getting row lock");
|
||||||
throw ioe;
|
throw ioe;
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -149,9 +149,7 @@ public final class SnapshotManifestV1 {
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
throw new InterruptedIOException(e.getMessage());
|
throw new InterruptedIOException(e.getMessage());
|
||||||
} catch (ExecutionException e) {
|
} catch (ExecutionException e) {
|
||||||
IOException ex = new IOException();
|
throw new IOException(e.getCause());
|
||||||
ex.initCause(e.getCause());
|
|
||||||
throw ex;
|
|
||||||
}
|
}
|
||||||
return regionsManifest;
|
return regionsManifest;
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,9 +178,7 @@ public final class SnapshotManifestV2 {
|
||||||
if(t instanceof InvalidProtocolBufferException) {
|
if(t instanceof InvalidProtocolBufferException) {
|
||||||
throw (InvalidProtocolBufferException)t;
|
throw (InvalidProtocolBufferException)t;
|
||||||
} else {
|
} else {
|
||||||
IOException ex = new IOException("ExecutionException");
|
throw new IOException("ExecutionException", e.getCause());
|
||||||
ex.initCause(e.getCause());
|
|
||||||
throw ex;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return regionsManifest;
|
return regionsManifest;
|
||||||
|
|
|
@ -231,9 +231,7 @@ public final class SnapshotReferenceUtil {
|
||||||
throw new CorruptedSnapshotException(e.getCause().getMessage(),
|
throw new CorruptedSnapshotException(e.getCause().getMessage(),
|
||||||
ProtobufUtil.createSnapshotDesc(snapshotDesc));
|
ProtobufUtil.createSnapshotDesc(snapshotDesc));
|
||||||
} else {
|
} else {
|
||||||
IOException ex = new IOException();
|
throw new IOException(e.getCause());
|
||||||
ex.initCause(e.getCause());
|
|
||||||
throw ex;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -266,9 +266,7 @@ public abstract class FSUtils extends CommonFSUtils {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.error("file system close failed: ", e);
|
LOG.error("file system close failed: ", e);
|
||||||
}
|
}
|
||||||
IOException io = new IOException("File system is not available");
|
throw new IOException("File system is not available", exception);
|
||||||
io.initCause(exception);
|
|
||||||
throw io;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -91,9 +91,7 @@ public class JVMClusterUtil {
|
||||||
hrsc.toString() + ((target.getCause() != null)?
|
hrsc.toString() + ((target.getCause() != null)?
|
||||||
target.getCause().getMessage(): ""), target);
|
target.getCause().getMessage(): ""), target);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
IOException ioe = new IOException();
|
throw new IOException(e);
|
||||||
ioe.initCause(e);
|
|
||||||
throw ioe;
|
|
||||||
}
|
}
|
||||||
return new JVMClusterUtil.RegionServerThread(server, index);
|
return new JVMClusterUtil.RegionServerThread(server, index);
|
||||||
}
|
}
|
||||||
|
@ -136,9 +134,7 @@ public class JVMClusterUtil {
|
||||||
hmc.toString() + ((target.getCause() != null)?
|
hmc.toString() + ((target.getCause() != null)?
|
||||||
target.getCause().getMessage(): ""), target);
|
target.getCause().getMessage(): ""), target);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
IOException ioe = new IOException();
|
throw new IOException(e);
|
||||||
ioe.initCause(e);
|
|
||||||
throw ioe;
|
|
||||||
}
|
}
|
||||||
return new JVMClusterUtil.MasterThread(server, index);
|
return new JVMClusterUtil.MasterThread(server, index);
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,9 +218,7 @@ public abstract class ModifyRegionUtils {
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
throw new InterruptedIOException(e.getMessage());
|
throw new InterruptedIOException(e.getMessage());
|
||||||
} catch (ExecutionException e) {
|
} catch (ExecutionException e) {
|
||||||
IOException ex = new IOException();
|
throw new IOException(e.getCause());
|
||||||
ex.initCause(e.getCause());
|
|
||||||
throw ex;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -377,11 +377,8 @@ public class WALSplitter {
|
||||||
if (!skipErrors || e instanceof InterruptedIOException) {
|
if (!skipErrors || e instanceof InterruptedIOException) {
|
||||||
throw e; // Don't mark the file corrupted if interrupted, or not skipErrors
|
throw e; // Don't mark the file corrupted if interrupted, or not skipErrors
|
||||||
}
|
}
|
||||||
CorruptedLogFileException t =
|
throw new CorruptedLogFileException("skipErrors=true Could not open wal "
|
||||||
new CorruptedLogFileException("skipErrors=true Could not open wal " +
|
+ path + " ignoring", e);
|
||||||
path + " ignoring");
|
|
||||||
t.initCause(e);
|
|
||||||
throw t;
|
|
||||||
}
|
}
|
||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
|
@ -405,11 +402,8 @@ public class WALSplitter {
|
||||||
if (!skipErrors) {
|
if (!skipErrors) {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
CorruptedLogFileException t =
|
throw new CorruptedLogFileException("skipErrors=true Ignoring exception"
|
||||||
new CorruptedLogFileException("skipErrors=true Ignoring exception" + " while parsing wal "
|
+ " while parsing wal " + path + ". Marking as corrupted", e);
|
||||||
+ path + ". Marking as corrupted");
|
|
||||||
t.initCause(e);
|
|
||||||
throw t;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -570,5 +564,16 @@ public class WALSplitter {
|
||||||
CorruptedLogFileException(String s) {
|
CorruptedLogFileException(String s) {
|
||||||
super(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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue