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:
sguggilam 2020-08-06 18:42:18 +05:30 committed by Viraj Jasani
parent c39cad220d
commit f8b887b327
No known key found for this signature in database
GPG Key ID: B3D6C0B41C8ADFD5
2 changed files with 19 additions and 4 deletions

View File

@ -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();
}
}

View File

@ -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();
}