HDFS-12583. Ozone: Fix swallow exceptions which makes hard to debug failures. Contributed by Yiqun Lin.
This commit is contained in:
parent
9445a9267f
commit
d19b4c8763
@ -156,7 +156,8 @@ public XceiverClientSpi call() throws Exception {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new IOException("Exception getting XceiverClient.", e);
|
throw new IOException(
|
||||||
|
"Exception getting XceiverClient: " + e.toString(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ private synchronized void readChunkFromContainer(int readChunkOffset)
|
|||||||
readChunkResponse = ContainerProtocolCalls.readChunk(xceiverClient,
|
readChunkResponse = ContainerProtocolCalls.readChunk(xceiverClient,
|
||||||
chunks.get(readChunkOffset), key, traceID);
|
chunks.get(readChunkOffset), key, traceID);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new IOException("Unexpected OzoneException", e);
|
throw new IOException("Unexpected OzoneException: " + e.toString(), e);
|
||||||
}
|
}
|
||||||
chunkOffset = readChunkOffset;
|
chunkOffset = readChunkOffset;
|
||||||
ByteString byteString = readChunkResponse.getData();
|
ByteString byteString = readChunkResponse.getData();
|
||||||
|
@ -151,7 +151,8 @@ public synchronized void close() throws IOException {
|
|||||||
}
|
}
|
||||||
putKey(xceiverClient, containerKeyData.build(), traceID);
|
putKey(xceiverClient, containerKeyData.build(), traceID);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new IOException("Unexpected Storage Container Exception", e);
|
throw new IOException(
|
||||||
|
"Unexpected Storage Container Exception: " + e.toString(), e);
|
||||||
} finally {
|
} finally {
|
||||||
xceiverClientManager.releaseClient(xceiverClient);
|
xceiverClientManager.releaseClient(xceiverClient);
|
||||||
xceiverClientManager = null;
|
xceiverClientManager = null;
|
||||||
@ -218,7 +219,8 @@ private synchronized void writeChunkToContainer() throws IOException {
|
|||||||
try {
|
try {
|
||||||
writeChunk(xceiverClient, chunk, key, data, traceID);
|
writeChunk(xceiverClient, chunk, key, data, traceID);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new IOException("Unexpected Storage Container Exception", e);
|
throw new IOException(
|
||||||
|
"Unexpected Storage Container Exception: " + e.toString(), e);
|
||||||
}
|
}
|
||||||
containerKeyData.addChunks(chunk);
|
containerKeyData.addChunks(chunk);
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ public Response handleCall(String volume, String bucket, Request request,
|
|||||||
return response;
|
return response;
|
||||||
|
|
||||||
} catch (IllegalArgumentException argEx) {
|
} catch (IllegalArgumentException argEx) {
|
||||||
LOG.debug("Invalid bucket. ex:{}", argEx);
|
LOG.error("Invalid bucket. ex:{}", argEx);
|
||||||
throw ErrorTable.newError(ErrorTable.INVALID_BUCKET_NAME, userArgs,
|
throw ErrorTable.newError(ErrorTable.INVALID_BUCKET_NAME, userArgs,
|
||||||
argEx);
|
argEx);
|
||||||
} catch (IOException fsExp) {
|
} catch (IOException fsExp) {
|
||||||
@ -149,7 +149,7 @@ void getAclsFromHeaders(BucketArgs args, boolean parseRemoveACL)
|
|||||||
*/
|
*/
|
||||||
void handleIOException(String bucket, String reqID, String hostName,
|
void handleIOException(String bucket, String reqID, String hostName,
|
||||||
IOException fsExp) throws OzoneException {
|
IOException fsExp) throws OzoneException {
|
||||||
LOG.debug("IOException: {}", fsExp);
|
LOG.error("IOException: {}", fsExp);
|
||||||
|
|
||||||
OzoneException exp = null;
|
OzoneException exp = null;
|
||||||
if (fsExp instanceof FileAlreadyExistsException) {
|
if (fsExp instanceof FileAlreadyExistsException) {
|
||||||
|
@ -94,9 +94,10 @@ public Response handleCall(String volume, String bucket, String key,
|
|||||||
return response;
|
return response;
|
||||||
|
|
||||||
} catch (IllegalArgumentException argExp) {
|
} catch (IllegalArgumentException argExp) {
|
||||||
LOG.debug("Invalid bucket in key call. ex:{}", argExp);
|
LOG.error("Invalid bucket in key call. ex:{}", argExp);
|
||||||
throw newError(INVALID_BUCKET_NAME, userArgs, argExp);
|
throw newError(INVALID_BUCKET_NAME, userArgs, argExp);
|
||||||
} catch (IOException fsExp) {
|
} catch (IOException fsExp) {
|
||||||
|
LOG.error("IOException. ex : {}", fsExp);
|
||||||
// Map KEY_NOT_FOUND to INVALID_KEY
|
// Map KEY_NOT_FOUND to INVALID_KEY
|
||||||
if (fsExp.getMessage().endsWith(
|
if (fsExp.getMessage().endsWith(
|
||||||
KeySpaceManagerProtocolProtos.Status.KEY_NOT_FOUND.name())) {
|
KeySpaceManagerProtocolProtos.Status.KEY_NOT_FOUND.name())) {
|
||||||
@ -105,10 +106,9 @@ public Response handleCall(String volume, String bucket, String key,
|
|||||||
|
|
||||||
// TODO : Handle errors from the FileSystem , let us map to server error
|
// TODO : Handle errors from the FileSystem , let us map to server error
|
||||||
// for now.
|
// for now.
|
||||||
LOG.debug("IOException. ex : {}", fsExp);
|
|
||||||
throw ErrorTable.newError(ErrorTable.SERVER_ERROR, userArgs, fsExp);
|
throw ErrorTable.newError(ErrorTable.SERVER_ERROR, userArgs, fsExp);
|
||||||
} catch (NoSuchAlgorithmException algoEx) {
|
} catch (NoSuchAlgorithmException algoEx) {
|
||||||
LOG.debug("NoSuchAlgorithmException. Probably indicates an unusual java "
|
LOG.error("NoSuchAlgorithmException. Probably indicates an unusual java "
|
||||||
+ "installation. ex : {}", algoEx);
|
+ "installation. ex : {}", algoEx);
|
||||||
throw ErrorTable.newError(SERVER_ERROR, userArgs, algoEx);
|
throw ErrorTable.newError(SERVER_ERROR, userArgs, algoEx);
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ public Response handleCall(String volume, Request request, UriInfo info,
|
|||||||
return response;
|
return response;
|
||||||
|
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
LOG.debug("illegal argument. {}", ex);
|
LOG.error("illegal argument. {}", ex);
|
||||||
throw ErrorTable.newError(ErrorTable.INVALID_VOLUME_NAME, userArgs, ex);
|
throw ErrorTable.newError(ErrorTable.INVALID_VOLUME_NAME, userArgs, ex);
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
handleIOException(volume, reqID, hostName, ex);
|
handleIOException(volume, reqID, hostName, ex);
|
||||||
@ -130,6 +130,7 @@ public abstract Response doProcess(VolumeArgs args)
|
|||||||
*/
|
*/
|
||||||
private void handleIOException(String volume, String reqID, String hostName,
|
private void handleIOException(String volume, String reqID, String hostName,
|
||||||
IOException fsExp) throws OzoneException {
|
IOException fsExp) throws OzoneException {
|
||||||
|
LOG.error("IOException: {}", fsExp);
|
||||||
OzoneException exp = null;
|
OzoneException exp = null;
|
||||||
|
|
||||||
if ((fsExp != null && fsExp.getMessage().endsWith(
|
if ((fsExp != null && fsExp.getMessage().endsWith(
|
||||||
@ -161,7 +162,6 @@ private void handleIOException(String volume, String reqID, String hostName,
|
|||||||
exp.setMessage(fsExp.getMessage());
|
exp.setMessage(fsExp.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG.debug("IOException: {}", exp);
|
|
||||||
throw exp;
|
throw exp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user