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

erose 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 cbbddc6fdc HDDS-7630. Show detailed OMResponse when 
OzoneManagerDoubleBuffer terminates (#4075)
cbbddc6fdc is described below

commit cbbddc6fdcaeb4e62e9617519f8eda615e296a34
Author: Symious <[email protected]>
AuthorDate: Wed Jan 11 01:05:26 2023 +0800

    HDDS-7630. Show detailed OMResponse when OzoneManagerDoubleBuffer 
terminates (#4075)
---
 .../ozone/om/ratis/OzoneManagerDoubleBuffer.java   | 29 ++++++++++++++--------
 1 file changed, 19 insertions(+), 10 deletions(-)

diff --git 
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerDoubleBuffer.java
 
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerDoubleBuffer.java
index 905f0c768d..4a255f263f 100644
--- 
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerDoubleBuffer.java
+++ 
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerDoubleBuffer.java
@@ -275,8 +275,9 @@ public final class OzoneManagerDoubleBuffer {
 
             AtomicReference<String> lastTraceId = new AtomicReference<>();
             readyBuffer.iterator().forEachRemaining((entry) -> {
+              OMResponse omResponse = null;
               try {
-                OMResponse omResponse = entry.getResponse().getOMResponse();
+                omResponse = entry.getResponse().getOMResponse();
                 lastTraceId.set(omResponse.getTraceID());
                 addToBatchWithTrace(omResponse,
                     (SupplierWithIOException<Void>) () -> {
@@ -290,7 +291,9 @@ public final class OzoneManagerDoubleBuffer {
               } catch (IOException ex) {
                 // During Adding to RocksDB batch entry got an exception.
                 // We should terminate the OM.
-                terminate(ex);
+                terminate(ex, 1, omResponse);
+              } catch (Throwable t) {
+                terminate(t, 2, omResponse);
               }
             });
 
@@ -386,11 +389,9 @@ public final class OzoneManagerDoubleBuffer {
               + "exit.", Thread.currentThread().getName());
         }
       } catch (IOException ex) {
-        terminate(ex);
+        terminate(ex, 1);
       } catch (Throwable t) {
-        final String s = "OMDoubleBuffer flush thread " +
-            Thread.currentThread().getName() + " encountered Throwable error";
-        ExitUtils.terminate(2, s, t, LOG);
+        terminate(t, 2);
       }
     }
   }
@@ -480,10 +481,18 @@ public final class OzoneManagerDoubleBuffer {
 
   }
 
-  private void terminate(IOException ex) {
-    String message = "During flush to DB encountered error in " +
-        "OMDoubleBuffer flush thread " + Thread.currentThread().getName();
-    ExitUtils.terminate(1, message, ex, LOG);
+  private void terminate(Throwable t, int status) {
+    terminate(t, status, null);
+  }
+
+  private void terminate(Throwable t, int status, OMResponse omResponse) {
+    StringBuilder message = new StringBuilder(
+        "During flush to DB encountered error in " +
+        "OMDoubleBuffer flush thread " + Thread.currentThread().getName());
+    if (omResponse != null) {
+      message.append(" when handling OMRequest: ").append(omResponse);
+    }
+    ExitUtils.terminate(status, message.toString(), t, LOG);
   }
 
   /**


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

Reply via email to