smengcl commented on code in PR #6189:
URL: https://github.com/apache/ozone/pull/6189#discussion_r1484019183
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java:
##########
@@ -258,6 +259,10 @@ public final class
OzoneManagerProtocolClientSideTranslatorPB
= new ThreadLocal<>();
private boolean s3AuthCheck;
+
+ public static final int BLOCK_ALLOCATION_RETRY_COUNT = 5;
+ public static final int BLOCK_ALLOCATION_RETRY_WAIT_TIME_MS = 3000;
Review Comment:
1. Is 15 seconds enough for SCM to go out of safe mode during rolling
restart?
2. Would this be made configurable later?
##########
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:
Is it possible to print some messages (to stderr) for a CLI client so the
user is informed of the wait? Otherwise it would look like the CLI is stuck.
--
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]