ashishkumar50 commented on code in PR #6189:
URL: https://github.com/apache/ozone/pull/6189#discussion_r1484057577
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java:
##########
@@ -2243,12 +2246,36 @@ 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) {
+ retryCount--;
Review Comment:
Added CLI error message
```
bash-4.2$ ozone sh key put vol1/bucket1/key1 file1
SCM is in safe mode, request will be retried after 3000ms
SCM is in safe mode, request will be retried after 3000ms
SCM is in safe mode, request will be retried after 3000ms
SCM is in safe mode, request will be retried after 3000ms
SCM is in safe mode, request will be retried after 3000ms
SCM_IN_SAFE_MODE SafeModePrecheck failed for allocateBlock
bash-4.2$
```
--
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]