smengcl commented on code in PR #6189:
URL: https://github.com/apache/ozone/pull/6189#discussion_r1484132704
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java:
##########
@@ -2243,12 +2246,38 @@ public OpenKeySession createFile(OmKeyArgs args,
OMRequest omRequest = createOMRequest(Type.CreateFile)
.setCreateFileRequest(createFileRequest)
.build();
- CreateFileResponse resp =
- handleError(submitRequest(omRequest)).getCreateFileResponse();
+ CreateFileResponse resp =
handleSubmitRequestAndSCMSafeModeRetry(omRequest).getCreateFileResponse();
+
return new OpenKeySession(resp.getID(),
OmKeyInfo.getFromProtobuf(resp.getKeyInfo()), resp.getOpenVersion());
}
+
+ @Nonnull
+ private OMResponse handleSubmitRequestAndSCMSafeModeRetry(OMRequest
omRequest) throws IOException {
+ int retryCount = BLOCK_ALLOCATION_RETRY_COUNT;
+ while (true) {
+ try {
+ return handleError(submitRequest(omRequest));
+ } catch (OMException e) {
+ if (e.getResult().equals(SCM_IN_SAFE_MODE) && retryCount > 0) {
+ System.err.println("SCM is in safe mode, request will be retried
after " +
+ BLOCK_ALLOCATION_RETRY_WAIT_TIME_MS + "ms");
Review Comment:
```suggestion
System.err.println("SCM is in safe mode. Will retry in " +
BLOCK_ALLOCATION_RETRY_WAIT_TIME_MS + "ms");
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]