HBASE-17763 IPCUtil.wrapException will wrap DoNotRetryIOException with IOException

This commit is contained in:
zhangduo 2017-03-09 17:29:55 +08:00
parent ab5970773a
commit ed6e5d6999
2 changed files with 11 additions and 6 deletions

View File

@ -28,6 +28,7 @@ import java.net.InetSocketAddress;
import java.net.SocketTimeoutException;
import java.nio.ByteBuffer;
import org.apache.hadoop.hbase.DoNotRetryIOException;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.exceptions.ConnectionClosingException;
import org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos.CellBlockMeta;
@ -168,6 +169,12 @@ class IPCUtil {
} else if (exception instanceof ConnectionClosingException) {
return (ConnectionClosingException) new ConnectionClosingException(
"Call to " + addr + " failed on local exception: " + exception).initCause(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);
} else {
return (IOException) new IOException(
"Call to " + addr + " failed on local exception: " + exception).initCause(exception);

View File

@ -1494,7 +1494,7 @@ public class TestHCM {
p.addColumn(FAM_NAM, new byte[]{0}, new byte[]{0});
table.put(p);
} catch (RetriesExhaustedWithDetailsException e) {
if (e.exceptions.get(0).getCause() instanceof ServerTooBusyException) {
if (e.exceptions.get(0) instanceof ServerTooBusyException) {
getServerBusyException = 1;
}
} catch (IOException ignore) {
@ -1514,12 +1514,10 @@ public class TestHCM {
public void run() {
try {
Get g = new Get(ROW);
g.addColumn(FAM_NAM, new byte[]{0});
g.addColumn(FAM_NAM, new byte[] { 0 });
table.get(g);
} catch (RetriesExhaustedException e) {
if (e.getCause().getCause() instanceof ServerTooBusyException) {
getServerBusyException = 1;
}
} catch (ServerTooBusyException e) {
getServerBusyException = 1;
} catch (IOException ignore) {
}
}