hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zhang...@apache.org
Subject [34/50] [abbrv] hbase git commit: HBASE-19767 Fix for Master web UI shows negative values for Remaining KVs
Date Thu, 22 Feb 2018 06:59:23 GMT
HBASE-19767 Fix for Master web UI shows negative values for Remaining KVs

Negative Remaining KVs and progress percent greater than 100 is because CompactionProgress#totalCompactingKVs
is sometimes less than CompactionProgress#currentCompactedKVs.
Changes add a getter to CompactionProgress#totalCompactingKVs and from inside getter warning
is logged. currentCompactedKVs are return when totalCompactingKVs are less than current.


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/61b55166
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/61b55166
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/61b55166

Branch: refs/heads/HBASE-19064
Commit: 61b55166bf7fe9edc4e8105f217463ed6e693d17
Parents: 3a39942
Author: Umesh Agashe <uagashe@cloudera.com>
Authored: Wed Feb 21 13:59:59 2018 -0800
Committer: Michael Stack <stack@apache.org>
Committed: Wed Feb 21 15:14:24 2018 -0800

----------------------------------------------------------------------
 .../hadoop/hbase/regionserver/HRegionServer.java    |  2 +-
 .../apache/hadoop/hbase/regionserver/HStore.java    |  4 ++--
 .../compactions/CompactionProgress.java             | 16 ++++++++++++----
 .../hbase/regionserver/TestMajorCompaction.java     |  2 +-
 4 files changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/61b55166/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
index 49b7b80..a76dec2 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
@@ -1623,7 +1623,7 @@ public class HRegionServer extends HasThread implements
       storefileIndexSizeKB += store.getStorefilesRootLevelIndexSize() / 1024;
       CompactionProgress progress = store.getCompactionProgress();
       if (progress != null) {
-        totalCompactingKVs += progress.totalCompactingKVs;
+        totalCompactingKVs += progress.getTotalCompactingKVs();
         currentCompactedKVs += progress.currentCompactedKVs;
       }
       rootLevelIndexSizeKB += (int) (store.getStorefilesRootLevelIndexSize() / 1024);

http://git-wip-us.apache.org/repos/asf/hbase/blob/61b55166/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
index bef50b4..c0ef3ef 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
@@ -1373,10 +1373,10 @@ public class HStore implements Store, HeapSize, StoreConfigInformation,
Propagat
     writeCompactionWalRecord(filesToCompact, sfs);
     replaceStoreFiles(filesToCompact, sfs);
     if (cr.isMajor()) {
-      majorCompactedCellsCount += getCompactionProgress().totalCompactingKVs;
+      majorCompactedCellsCount += getCompactionProgress().getTotalCompactingKVs();
       majorCompactedCellsSize += getCompactionProgress().totalCompactedSize;
     } else {
-      compactedCellsCount += getCompactionProgress().totalCompactingKVs;
+      compactedCellsCount += getCompactionProgress().getTotalCompactingKVs();
       compactedCellsSize += getCompactionProgress().totalCompactedSize;
     }
     long outputBytes = getTotalSize(sfs);

http://git-wip-us.apache.org/repos/asf/hbase/blob/61b55166/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionProgress.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionProgress.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionProgress.java
index d40651a..577276e 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionProgress.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionProgress.java
@@ -20,6 +20,8 @@
 package org.apache.hadoop.hbase.regionserver.compactions;
 
 import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * This class holds information relevant for tracking the progress of a
@@ -32,9 +34,10 @@ import org.apache.yetus.audience.InterfaceAudience;
  */
 @InterfaceAudience.Private
 public class CompactionProgress {
+  private static final Logger LOG = LoggerFactory.getLogger(CompactionProgress.class);
 
   /** the total compacting key values in currently running compaction */
-  public long totalCompactingKVs;
+  private long totalCompactingKVs;
   /** the completed count of key values in currently running compaction */
   public long currentCompactedKVs = 0;
   /** the total size of data processed by the currently running compaction, in bytes */
@@ -51,7 +54,7 @@ public class CompactionProgress {
    * @return float
    */
   public float getProgressPct() {
-    return (float)currentCompactedKVs / totalCompactingKVs;
+    return (float)currentCompactedKVs / getTotalCompactingKVs();
   }
 
   /**
@@ -72,7 +75,12 @@ public class CompactionProgress {
   /**
    * @return the total compacting key values in currently running compaction
    */
-  public long getTotalCompactingKvs() {
+  public long getTotalCompactingKVs() {
+    if (totalCompactingKVs < currentCompactedKVs) {
+      LOG.warn("totalCompactingKVs={} less than currentCompactedKVs={}",
+          totalCompactingKVs, currentCompactedKVs);
+      return currentCompactedKVs;
+    }
     return totalCompactingKVs;
   }
 
@@ -92,7 +100,7 @@ public class CompactionProgress {
 
   @Override
   public String toString() {
-    return String.format("%d/%d (%.2f%%)", currentCompactedKVs, totalCompactingKVs,
+    return String.format("%d/%d (%.2f%%)", currentCompactedKVs, getTotalCompactingKVs(),
       100 * getProgressPct());
   }
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/61b55166/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMajorCompaction.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMajorCompaction.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMajorCompaction.java
index ee717f9..4fdd6b3 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMajorCompaction.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMajorCompaction.java
@@ -221,7 +221,7 @@ public class TestMajorCompaction {
       if( progress != null ) {
         ++storeCount;
         assertTrue(progress.currentCompactedKVs > 0);
-        assertTrue(progress.totalCompactingKVs > 0);
+        assertTrue(progress.getTotalCompactingKVs() > 0);
       }
       assertTrue(storeCount > 0);
     }


Mime
View raw message