This is an automated email from the ASF dual-hosted git repository.

adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 8930666c30f HDDS-17578. Terminate OM if Ratis log fails (#12155)
8930666c30f is described below

commit 8930666c30f531964aab1a9e6fdfecf5f6d2951b
Author: Siyao Meng <[email protected]>
AuthorDate: Tue Nov 24 23:53:26 2026 -0800

    HDDS-17578. Terminate OM if Ratis log fails (#12155)
    
    Co-authored-by: Claude Opus 5.5 <[email protected]>
---
 .../hadoop/ozone/om/ratis/OzoneManagerStateMachine.java   |  7 +++++++
 .../ozone/om/ratis/TestOzoneManagerStateMachine.java      | 15 +++++++++++++++
 2 files changed, 22 insertions(+)

diff --git 
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerStateMachine.java
 
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerStateMachine.java
index 848b6b0c6cc..c201a8ff968 100644
--- 
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerStateMachine.java
+++ 
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerStateMachine.java
@@ -202,6 +202,13 @@ public void notifyLeaderReady() {
     ozoneManager.getOMServiceManager().notifyStatusChanged();
   }
 
+  @Override
+  public void notifyLogFailed(Throwable cause, RaftProtos.LogEntryProto 
failedEntry) {
+    // Ratis fails every later write to this log until restart, so the OM 
could neither lead nor catch up.
+    final String entry = failedEntry == null ? "a log segment" : 
String.valueOf(TermIndex.valueOf(failedEntry));
+    ExitUtils.terminate(1, "OM Ratis log failed at " + entry + ", terminating 
OM.", cause, LOG);
+  }
+
   @Override
   public void notifyNotLeader(Collection<TransactionContext> pendingEntries) {
     LOG.info("current leader OM steps down.");
diff --git 
a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/ratis/TestOzoneManagerStateMachine.java
 
b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/ratis/TestOzoneManagerStateMachine.java
index 837b5c7d534..8caa84b5308 100644
--- 
a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/ratis/TestOzoneManagerStateMachine.java
+++ 
b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/ratis/TestOzoneManagerStateMachine.java
@@ -682,6 +682,21 @@ public void testProcessResponseMetadataErrorTerminates() {
         () -> sm.processResponse(response));
   }
 
+  @Test
+  public void testNotifyLogFailedTerminates() {
+    IOException cause = new IOException("Raft log write failed");
+    try {
+      assertThatThrownBy(() -> sm.notifyLogFailed(cause, null))
+          .isInstanceOfSatisfying(ExitUtils.ExitException.class, e -> 
assertThat(e.getStatus()).isEqualTo(1))
+          .hasCause(cause);
+      assertThatThrownBy(() -> sm.notifyLogFailed(cause, 
LogProtoUtils.toLogEntryProto(7, 2, 7)))
+          .isInstanceOfSatisfying(ExitUtils.ExitException.class, e -> 
assertThat(e.getStatus()).isEqualTo(1))
+          .hasMessageContaining(TermIndex.valueOf(2, 7).toString());
+    } finally {
+      ExitUtils.clear();
+    }
+  }
+
   // --- createErrorResponse tests ---
 
   @Test


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to