sumitagrawl commented on code in PR #6928:
URL: https://github.com/apache/ozone/pull/6928#discussion_r1677801352
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerStateMachine.java:
##########
@@ -551,6 +579,24 @@ private OMResponse runCommand(OMRequest request, TermIndex
termIndex) {
return createErrorResponse(request, e, termIndex);
} catch (Throwable e) {
// For any Runtime exceptions, terminate OM.
+ final boolean onFailureReadonlyEnable = ozoneManager.getConfiguration()
+ .getBoolean(OMConfigKeys.OZONE_OM_ONFAILURE_READONLY,
+ OMConfigKeys.OZONE_OM_ONFAILURE_READONLY_DEFAULT);
+ if (onFailureReadonlyEnable) {
+ LOG.error("Failed to write, moving to readonly mode, Exception
occurred ", e);
+ if (readonlyMode.compareAndSet(false, true)) {
+ // update readonly mode, flush existing transaction and pause state
machine
+ readonlyMode.set(true);
+ try {
+ awaitDoubleBufferFlush();
+ } catch (InterruptedException ex) {
+ Thread.interrupted();
+ }
+ pause();
+ }
+ return createErrorResponse(request, new OMException("Exception
occurred and moving to readonly mode",
+ e, OMException.ResultCodes.READONLY_MODE), termIndex);
+ }
String errorMessage = "Request " + request + " failed with exception";
ExitUtils.terminate(1, errorMessage, e, LOG);
Review Comment:
@errose28 `4. `Handled for processResponse --> `INTERNAL_ERROR`
--
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]