adwetojha commented on code in PR #11752:
URL: https://github.com/apache/ozone/pull/11752#discussion_r4388502211
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java:
##########
@@ -2627,33 +2642,36 @@ public OpenKeySession createFile(OmKeyArgs args,
OMRequest omRequest = createOMRequest(Type.CreateFile)
.setCreateFileRequest(createFileRequest)
.build();
- CreateFileResponse resp =
handleSubmitRequestAndSCMSafeModeRetry(omRequest).getCreateFileResponse();
+ CreateFileResponse resp =
handleSubmitRequestWithBlockAllocationRetry(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;
+ private OMResponse handleSubmitRequestWithBlockAllocationRetry(OMRequest
omRequest) throws IOException {
+ int retryCount = blockAllocationRetryCount;
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. Will retry in " +
- BLOCK_ALLOCATION_RETRY_WAIT_TIME_MS + "ms");
- retryCount--;
- try {
- Thread.sleep(BLOCK_ALLOCATION_RETRY_WAIT_TIME_MS);
- continue;
- } catch (InterruptedException ex) {
- throw new OMException(ex.getMessage(),
ResultCodes.SCM_IN_SAFE_MODE);
- }
- } else if (e.getResult().equals(SCM_IN_SAFE_MODE) && retryCount == 0) {
- throw new OMException(e.getMessage(), ResultCodes.SCM_IN_SAFE_MODE);
+ if ((e.getResult() != SCM_IN_SAFE_MODE && e.getResult() !=
KEY_ALLOCATION_PIPELINE_NOT_FOUND)
+ || retryCount == 0) {
+ throw e;
+ }
+ if (retryCount == blockAllocationRetryCount) {
+ LOG.warn("Block allocation failed with {}. Retrying up to {} times
at {}ms intervals",
Review Comment:
Thanks for pointing this out! I've restored a concise stderr message on
every retry for both `SCM_IN_SAFE_MODE` and `KEY_ALLOCATION_ERROR`, so CLI
users can see retry progress even when logging is disabled.
I've also added regression tests covering stderr output and retry exhaustion.
--
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]