xiaoyuyao commented on a change in pull request #814:
URL: https://github.com/apache/hadoop-ozone/pull/814#discussion_r443073493
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/OMClientRequest.java
##########
@@ -220,6 +224,39 @@ protected OMResponse createErrorOMResponse(
return omResponse.build();
}
+ /**
+ * Set parameters needed for return error response to client.
+ *
+ * @param omResponse
+ * @param ex - IOException
+ * @param unDeletedKeys - Set<OmKeyInfo>
+ * @return error response need to be returned to client - OMResponse.
+ */
+ protected OMResponse createOperationKeysErrorOMResponse(
+ @Nonnull OMResponse.Builder omResponse,
+ @Nonnull IOException ex, @Nonnull Set<OmKeyInfo> unDeletedKeys) {
+ omResponse.setSuccess(false);
+ StringBuffer errorMsg = new StringBuffer();
+ errorMsg.append(exceptionErrorMessage(ex) + "\n The Keys not deleted: ");
+ UnDeletedKeysResponse.Builder resp =
+ UnDeletedKeysResponse.newBuilder();
+ for (OmKeyInfo key : unDeletedKeys) {
+ if(key != null) {
+ resp.addKeyInfo(key.getProtobuf());
+ errorMsg.append(key.getObjectInfo() + "\n");
+ }
+ }
+ if (errorMsg != null) {
+ omResponse.setMessage(errorMsg.toString());
+ }
+ // TODO: Currently all delete operations in OzoneBucket.java are void. Here
+ // we put the List of unDeletedKeys into Response. These KeyInfo can be
+ // used to continue deletion if client support delete retry.
+ omResponse.setUnDeletedKeysResponse(resp.build());
Review comment:
I think put the undeleted keys in OMResponse is good enough. Not sure if
we want to append all the key names into the string message, which can hurt the
performance when the list is huge.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]