HBASE-24823 Port HBASE-22762 Print the delta between phases in the split/merge/compact/flush transaction journals
Closes #2204 Signed-off-by: Andrew Purtell <apurtell@apache.org> Signed-off-by: Mingliang Liu <liuml07@apache.org> Signed-off-by: Viraj Jasani <vjasani@apache.org>
This commit is contained in:
parent
c39cad220d
commit
f8b887b327
|
@ -25,7 +25,6 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.hadoop.hbase.util.GsonUtil;
|
||||
import org.apache.hadoop.util.StringUtils;
|
||||
import org.apache.yetus.audience.InterfaceAudience;
|
||||
|
||||
import org.apache.hbase.thirdparty.com.google.gson.Gson;
|
||||
|
@ -271,7 +270,23 @@ class MonitoredTaskImpl implements MonitoredTask {
|
|||
|
||||
@Override
|
||||
public String prettyPrintJournal() {
|
||||
return StringUtils.join("\n\t", getStatusJournal());
|
||||
if (!journalEnabled) {
|
||||
return "";
|
||||
}
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2341,7 +2341,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
|
|||
} finally {
|
||||
if (requestNeedsCancellation) store.cancelRequestedCompaction(compaction);
|
||||
if (status != null) {
|
||||
LOG.debug("Compaction status journal for {}:\n\t{}", this.getRegionInfo().getEncodedName(),
|
||||
LOG.debug("Compaction status journal for {}:\n{}", this.getRegionInfo().getEncodedName(),
|
||||
status.prettyPrintJournal());
|
||||
status.cleanup();
|
||||
}
|
||||
|
@ -2506,7 +2506,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
|
|||
}
|
||||
} finally {
|
||||
lock.readLock().unlock();
|
||||
LOG.debug("Flush status journal for {}:\n\t{}", this.getRegionInfo().getEncodedName(),
|
||||
LOG.debug("Flush status journal for {}:\n{}", this.getRegionInfo().getEncodedName(),
|
||||
status.prettyPrintJournal());
|
||||
status.cleanup();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue