Skip to content
Permalink
Browse files
IGNITE-14570 Add checkpoint methods to statistics handlers (#57)
  • Loading branch information
NSAmelchev committed Apr 19, 2021
1 parent 7a26b06 commit 9f1fb295c1efe58ed8957b84ed7c6ddbe36b6408
Showing 3 changed files with 85 additions and 2 deletions.
@@ -76,4 +76,17 @@ public interface IgnitePerformanceStatisticsHandler extends PerformanceStatistic
boolean timedOut) {
// No-op.
}

/** {@inheritDoc} */
@Override default void checkpoint(UUID nodeId, long beforeLockDuration, long lockWaitDuration,
long listenersExecDuration, long markDuration, long lockHoldDuration, long pagesWriteDuration,
long fsyncDuration, long walCpRecordFsyncDuration, long writeCpEntryDuration, long splitAndSortCpPagesDuration,
long totalDuration, long cpStartTime, int pagesSize, int dataPagesWritten, int cowPagesWritten) {
// No-op.
}

/** {@inheritDoc} */
@Override default void pagesWriteThrottle(UUID nodeId, long endTime, long duration) {
// No-op.
}
}
@@ -31,7 +31,9 @@

import static org.apache.ignite.internal.performancestatistics.util.Utils.printEscaped;
import static org.apache.ignite.internal.processors.performancestatistics.OperationType.CACHE_START;
import static org.apache.ignite.internal.processors.performancestatistics.OperationType.CHECKPOINT;
import static org.apache.ignite.internal.processors.performancestatistics.OperationType.JOB;
import static org.apache.ignite.internal.processors.performancestatistics.OperationType.PAGES_WRITE_THROTTLE;
import static org.apache.ignite.internal.processors.performancestatistics.OperationType.QUERY;
import static org.apache.ignite.internal.processors.performancestatistics.OperationType.QUERY_READS;
import static org.apache.ignite.internal.processors.performancestatistics.OperationType.TASK;
@@ -216,6 +218,67 @@ public PrintHandler(PrintStream ps, @Nullable BitSet ops, long from, long to, @N
ps.println("}");
}

/** {@inheritDoc} */
@Override public void checkpoint(UUID nodeId, long beforeLockDuration, long lockWaitDuration, long listenersExecDuration,
long markDuration, long lockHoldDuration, long pagesWriteDuration, long fsyncDuration,
long walCpRecordFsyncDuration, long writeCpEntryDuration, long splitAndSortCpPagesDuration, long totalDuration,
long cpStartTime, int pagesSize, int dataPagesWritten, int cowPagesWritten) {
if (skip(CHECKPOINT, cpStartTime))
return;

ps.print("{\"op\":\"" + CHECKPOINT);
ps.print("\",\"nodeId\":\"");
ps.print(nodeId);
ps.print("\",\"beforeLockDuration\":");
ps.print(beforeLockDuration);
ps.print(",\"lockWaitDuration\":");
ps.print(lockWaitDuration);
ps.print(",\"listenersExecDuration\":");
ps.print(listenersExecDuration);
ps.print(",\"markDuration\":");
ps.print(markDuration);
ps.print(",\"lockHoldDuration\":");
ps.print(lockHoldDuration);
ps.print(",\"pagesWriteDuration\":");
ps.print(pagesWriteDuration);
ps.print(",\"fsyncDuration\":");
ps.print(fsyncDuration);
ps.print(",\"walCpRecordFsyncDuration\":");
ps.print(walCpRecordFsyncDuration);
ps.print(",\"writeCpEntryDuration\":");
ps.print(writeCpEntryDuration);
ps.print(",\"splitAndSortCpPagesDuration\":");
ps.print(splitAndSortCpPagesDuration);
ps.print(",\"totalDuration\":");
ps.print(totalDuration);
ps.print(",\"startTime\":");
ps.print(cpStartTime);
ps.print(",\"pagesSize\":");
ps.print(pagesSize);
ps.print(",\"dataPagesWritten\":");
ps.print(dataPagesWritten);
ps.print(",\"cowPagesWritten\":");
ps.print(cowPagesWritten);
ps.println("}");
}

/** {@inheritDoc} */
@Override public void pagesWriteThrottle(UUID nodeId, long endTime, long duration) {
long startTime = endTime - duration;

if (skip(PAGES_WRITE_THROTTLE, startTime))
return;

ps.print("{\"op\":\"" + PAGES_WRITE_THROTTLE);
ps.print("\",\"nodeId\":\"");
ps.print(nodeId);
ps.print("\",\"startTime\":");
ps.print(startTime);
ps.print(",\"duration\":");
ps.print(duration);
ps.println("}");
}

/** @return {@code True} if the operation should be skipped. */
private boolean skip(OperationType op) {
return !(ops == null || ops.get(op.id()));
@@ -48,7 +48,9 @@
import static org.apache.ignite.internal.processors.performancestatistics.OperationType.CACHE_GET;
import static org.apache.ignite.internal.processors.performancestatistics.OperationType.CACHE_PUT;
import static org.apache.ignite.internal.processors.performancestatistics.OperationType.CACHE_START;
import static org.apache.ignite.internal.processors.performancestatistics.OperationType.CHECKPOINT;
import static org.apache.ignite.internal.processors.performancestatistics.OperationType.JOB;
import static org.apache.ignite.internal.processors.performancestatistics.OperationType.PAGES_WRITE_THROTTLE;
import static org.apache.ignite.internal.processors.performancestatistics.OperationType.QUERY;
import static org.apache.ignite.internal.processors.performancestatistics.OperationType.QUERY_READS;
import static org.apache.ignite.internal.processors.performancestatistics.OperationType.TASK;
@@ -90,10 +92,12 @@ public void testOperationsFilter() throws Exception {
writer.queryReads(GridCacheQueryType.SQL_FIELDS, NODE_ID, 0, 0, 0);
writer.task(new IgniteUuid(NODE_ID, 0), "task", 0, 0, 0);
writer.job(new IgniteUuid(NODE_ID, 0), 0, 0, 0, true);
writer.checkpoint(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
writer.pagesWriteThrottle(0, 0);
});

List<OperationType> expOps = F.asList(CACHE_START, CACHE_GET, TX_COMMIT, TX_ROLLBACK, QUERY, QUERY_READS,
TASK, JOB);
TASK, JOB, CHECKPOINT, PAGES_WRITE_THROTTLE);

checkOperationFilter(null, expOps);
checkOperationFilter(F.asList(CACHE_START), F.asList(CACHE_START));
@@ -140,6 +144,8 @@ public void testStartTimeFilter() throws Exception {
writer.query(GridCacheQueryType.SQL_FIELDS, "query", 0, startTime, 0, true);
writer.task(new IgniteUuid(NODE_ID, 0), "", startTime, 0, 0);
writer.job(new IgniteUuid(NODE_ID, 0), 0, startTime, 0, true);
writer.checkpoint(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, startTime, 0, 0, 0);
writer.pagesWriteThrottle(startTime, 0);
}
});

@@ -153,7 +159,8 @@ public void testStartTimeFilter() throws Exception {

/** */
private void checkStartTimeFilter(Long fromArg, Long toArg, List<Long> expTimes) throws Exception {
List<OperationType> opsWithStartTime = F.asList(CACHE_GET, TX_COMMIT, TX_ROLLBACK, QUERY, TASK, JOB);
List<OperationType> opsWithStartTime = F.asList(CACHE_GET, TX_COMMIT, TX_ROLLBACK, QUERY, TASK, JOB, CHECKPOINT,
PAGES_WRITE_THROTTLE);

List<String> args = new LinkedList<>();

0 comments on commit 9f1fb29

Please sign in to comment.