hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject [hbase] branch branch-1.3 updated: Amend HBASE-22762 Print the delta between phases in the split/merge/compact/flush transaction journals
Date Fri, 02 Aug 2019 02:23:18 GMT
This is an automated email from the ASF dual-hosted git repository.

apurtell pushed a commit to branch branch-1.3
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-1.3 by this push:
     new 45230dc  Amend HBASE-22762 Print the delta between phases in the split/merge/compact/flush
transaction journals
45230dc is described below

commit 45230dca1f2972f5293d0c8fda1b47b0c30d7113
Author: Andrew Purtell <apurtell@apache.org>
AuthorDate: Thu Aug 1 18:18:24 2019 -0700

    Amend HBASE-22762 Print the delta between phases in the split/merge/compact/flush transaction
journals
    
    Update merge, compact, and flush transaction journals too
---
 .../hadoop/hbase/monitoring/MonitoredTaskImpl.java     | 16 ++++++++++++++--
 .../org/apache/hadoop/hbase/regionserver/HRegion.java  |  8 ++++++--
 .../hadoop/hbase/regionserver/RegionMergeRequest.java  |  1 +
 .../hbase/regionserver/RegionMergeTransactionImpl.java | 18 ++++++++++++++++++
 .../apache/hadoop/hbase/regionserver/SplitRequest.java |  3 +--
 .../hbase/regionserver/SplitTransactionImpl.java       |  7 +++----
 6 files changed, 43 insertions(+), 10 deletions(-)

diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/monitoring/MonitoredTaskImpl.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/monitoring/MonitoredTaskImpl.java
index ed04212..4f373c4 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/monitoring/MonitoredTaskImpl.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/monitoring/MonitoredTaskImpl.java
@@ -19,7 +19,6 @@
 package org.apache.hadoop.hbase.monitoring;
 
 import org.apache.hadoop.hbase.classification.InterfaceAudience;
-import org.apache.hadoop.util.StringUtils;
 import org.codehaus.jackson.map.ObjectMapper;
 
 import java.io.IOException;
@@ -269,7 +268,20 @@ class MonitoredTaskImpl implements MonitoredTask {
 
   @Override
   public String prettyPrintJournal() {
-    return StringUtils.join("\n\t", getStatusJournal());
+    StringBuilder sb = new StringBuilder();
+    for (int i = 0; i < journal.size(); i++) {
+      StatusJournalEntry je = journal.get(i);
+      sb.append(je.toString());
+      if (i != 0) {
+        StatusJournalEntry jep = journal.get(i-1);
+        long delta = je.getTimeStamp() - jep.getTimeStamp();
+        if (delta != 0) {
+          sb.append(" (+" + delta + " ms)");
+        }
+      }
+      sb.append("\n");
+    }
+    return sb.toString();
   }
 
 }
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
index 074503f..5cf550d 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
@@ -2032,7 +2032,9 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver,
Regi
     } finally {
       if (requestNeedsCancellation) store.cancelRequestedCompaction(compaction);
       if (status != null) {
-        LOG.debug("Compaction status journal:\n\t" + status.prettyPrintJournal());
+        if (LOG.isDebugEnabled()) {
+          LOG.debug("Compaction status journal:\n" + status.prettyPrintJournal());
+        }
         status.cleanup();
       }
     }
@@ -2138,7 +2140,9 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver,
Regi
       }
     } finally {
       lock.readLock().unlock();
-      LOG.debug("Flush status journal:\n\t" + status.prettyPrintJournal());
+      if (LOG.isDebugEnabled()) {
+        LOG.debug("Flush status journal:\n" + status.prettyPrintJournal());
+      }
       status.cleanup();
     }
   }
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionMergeRequest.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionMergeRequest.java
index 4d806aa..4856ffc 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionMergeRequest.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionMergeRequest.java
@@ -129,6 +129,7 @@ class RegionMergeRequest implements Runnable {
           + mt.getMergedRegionInfo().getRegionNameAsString()
           + ". Region merge took "
           + StringUtils.formatTimeDiff(EnvironmentEdgeManager.currentTime(), startTime));
+      LOG.info("Merge transaction journal:\n" + mt.toString());
     } catch (IOException ex) {
       LOG.error("Merge failed " + this,
           RemoteExceptionHandler.checkIOException(ex));
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionMergeTransactionImpl.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionMergeTransactionImpl.java
index 03aa059..93528fe 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionMergeTransactionImpl.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionMergeTransactionImpl.java
@@ -43,6 +43,7 @@ import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.coordination.BaseCoordinatedStateManager;
 import org.apache.hadoop.hbase.coordination.RegionMergeCoordination.RegionMergeDetails;
 import org.apache.hadoop.hbase.protobuf.generated.RegionServerStatusProtos.RegionStateTransition.TransitionCode;
+import org.apache.hadoop.hbase.regionserver.SplitTransaction.JournalEntry;
 import org.apache.hadoop.hbase.regionserver.SplitTransactionImpl.LoggingProgressable;
 import org.apache.hadoop.hbase.security.User;
 import org.apache.hadoop.hbase.util.Bytes;
@@ -968,4 +969,21 @@ public class RegionMergeTransactionImpl implements RegionMergeTransaction
{
     return rsServices;
   }
 
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder();
+    for (int i = 0; i < journal.size(); i++) {
+      JournalEntry je = journal.get(i);
+      sb.append(je.toString());
+      if (i != 0) {
+        JournalEntry jep = journal.get(i-1);
+        long delta = je.getTimeStamp() - jep.getTimeStamp();
+        if (delta != 0) {
+          sb.append(" (+" + delta + " ms)");
+        }
+      }
+      sb.append("\n");
+    }
+    return sb.toString();
+  }
 }
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SplitRequest.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SplitRequest.java
index 5a62495..79aaa5c 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SplitRequest.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SplitRequest.java
@@ -138,9 +138,8 @@ class SplitRequest implements Runnable {
             + st.getFirstDaughter().getRegionNameAsString() + ", "
             + st.getSecondDaughter().getRegionNameAsString() + ". Split took "
             + StringUtils.formatTimeDiff(EnvironmentEdgeManager.currentTime(), startTime));
+        LOG.info("Split transaction journal:\n" + st.toString());
       }
-      // Always log the split transaction journal
-      LOG.info("Split transaction journal:\n" + st.toString());
     }
   }
 
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SplitTransactionImpl.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SplitTransactionImpl.java
index f0ae7bb..093ea89 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SplitTransactionImpl.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SplitTransactionImpl.java
@@ -1066,16 +1066,15 @@ public class SplitTransactionImpl implements SplitTransaction {
     StringBuilder sb = new StringBuilder();
     for (int i = 0; i < journal.size(); i++) {
       JournalEntry je = journal.get(i);
-      sb.append( je.toString());
+      sb.append(je.toString());
       if (i != 0) {
         JournalEntry jep = journal.get(i-1);
         long delta = je.getTimeStamp() - jep.getTimeStamp();
         if (delta != 0) {
-          sb.append(" (+" + delta + " ms)\n");
-        } else {
-          sb.append("\n");
+          sb.append(" (+" + delta + " ms)");
         }
       }
+      sb.append("\n");
     }
     return sb.toString();
   }


Mime
View raw message