Revert "HBASE-19767 Fix for Master web UI shows negative values for Remaining KVs"

Applied prematurely.

This reverts commit 61b55166bf.
This commit is contained in:
Michael Stack 2018-02-21 18:02:25 -08:00
parent b328807d25
commit 2440f807bf
4 changed files with 8 additions and 16 deletions

View File

@ -1623,7 +1623,7 @@ public class HRegionServer extends HasThread implements
storefileIndexSizeKB += store.getStorefilesRootLevelIndexSize() / 1024;
CompactionProgress progress = store.getCompactionProgress();
if (progress != null) {
totalCompactingKVs += progress.getTotalCompactingKVs();
totalCompactingKVs += progress.totalCompactingKVs;
currentCompactedKVs += progress.currentCompactedKVs;
}
rootLevelIndexSizeKB += (int) (store.getStorefilesRootLevelIndexSize() / 1024);

View File

@ -1373,10 +1373,10 @@ public class HStore implements Store, HeapSize, StoreConfigInformation, Propagat
writeCompactionWalRecord(filesToCompact, sfs);
replaceStoreFiles(filesToCompact, sfs);
if (cr.isMajor()) {
majorCompactedCellsCount += getCompactionProgress().getTotalCompactingKVs();
majorCompactedCellsCount += getCompactionProgress().totalCompactingKVs;
majorCompactedCellsSize += getCompactionProgress().totalCompactedSize;
} else {
compactedCellsCount += getCompactionProgress().getTotalCompactingKVs();
compactedCellsCount += getCompactionProgress().totalCompactingKVs;
compactedCellsSize += getCompactionProgress().totalCompactedSize;
}
long outputBytes = getTotalSize(sfs);

View File

@ -20,8 +20,6 @@
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
@ -34,10 +32,9 @@ import org.slf4j.LoggerFactory;
*/
@InterfaceAudience.Private
public class CompactionProgress {
private static final Logger LOG = LoggerFactory.getLogger(CompactionProgress.class);
/** the total compacting key values in currently running compaction */
private long totalCompactingKVs;
public 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 */
@ -54,7 +51,7 @@ public class CompactionProgress {
* @return float
*/
public float getProgressPct() {
return (float)currentCompactedKVs / getTotalCompactingKVs();
return (float)currentCompactedKVs / totalCompactingKVs;
}
/**
@ -75,12 +72,7 @@ public class CompactionProgress {
/**
* @return the total compacting key values in currently running compaction
*/
public long getTotalCompactingKVs() {
if (totalCompactingKVs < currentCompactedKVs) {
LOG.warn("totalCompactingKVs={} less than currentCompactedKVs={}",
totalCompactingKVs, currentCompactedKVs);
return currentCompactedKVs;
}
public long getTotalCompactingKvs() {
return totalCompactingKVs;
}
@ -100,7 +92,7 @@ public class CompactionProgress {
@Override
public String toString() {
return String.format("%d/%d (%.2f%%)", currentCompactedKVs, getTotalCompactingKVs(),
return String.format("%d/%d (%.2f%%)", currentCompactedKVs, totalCompactingKVs,
100 * getProgressPct());
}
}

View File

@ -221,7 +221,7 @@ public class TestMajorCompaction {
if( progress != null ) {
++storeCount;
assertTrue(progress.currentCompactedKVs > 0);
assertTrue(progress.getTotalCompactingKVs() > 0);
assertTrue(progress.totalCompactingKVs > 0);
}
assertTrue(storeCount > 0);
}