You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by na...@apache.org on 2021/04/19 09:41:15 UTC

[ignite-extensions] branch master updated: IGNITE-14570 Add checkpoint methods to statistics handlers (#57)

This is an automated email from the ASF dual-hosted git repository.

namelchev pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite-extensions.git


The following commit(s) were added to refs/heads/master by this push:
     new 9f1fb29  IGNITE-14570 Add checkpoint methods to statistics handlers (#57)
9f1fb29 is described below

commit 9f1fb295c1efe58ed8957b84ed7c6ddbe36b6408
Author: Nikita Amelchev <ns...@gmail.com>
AuthorDate: Mon Apr 19 12:41:07 2021 +0300

    IGNITE-14570 Add checkpoint methods to statistics handlers (#57)
---
 .../IgnitePerformanceStatisticsHandler.java        | 13 +++++
 .../handlers/PrintHandler.java                     | 63 ++++++++++++++++++++++
 .../PerformanceStatisticsPrinterTest.java          | 11 +++-
 3 files changed, 85 insertions(+), 2 deletions(-)

diff --git a/modules/performance-statistics-ext/src/main/java/org/apache/ignite/internal/performancestatistics/handlers/IgnitePerformanceStatisticsHandler.java b/modules/performance-statistics-ext/src/main/java/org/apache/ignite/internal/performancestatistics/handlers/IgnitePerformanceStatisticsHandler.java
index 31e79f4..5660ef3 100644
--- a/modules/performance-statistics-ext/src/main/java/org/apache/ignite/internal/performancestatistics/handlers/IgnitePerformanceStatisticsHandler.java
+++ b/modules/performance-statistics-ext/src/main/java/org/apache/ignite/internal/performancestatistics/handlers/IgnitePerformanceStatisticsHandler.java
@@ -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.
+    }
 }
diff --git a/modules/performance-statistics-ext/src/main/java/org/apache/ignite/internal/performancestatistics/handlers/PrintHandler.java b/modules/performance-statistics-ext/src/main/java/org/apache/ignite/internal/performancestatistics/handlers/PrintHandler.java
index df27ae8..53c10e1 100644
--- a/modules/performance-statistics-ext/src/main/java/org/apache/ignite/internal/performancestatistics/handlers/PrintHandler.java
+++ b/modules/performance-statistics-ext/src/main/java/org/apache/ignite/internal/performancestatistics/handlers/PrintHandler.java
@@ -31,7 +31,9 @@ import org.jetbrains.annotations.Nullable;
 
 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 class PrintHandler implements PerformanceStatisticsHandler {
         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()));
diff --git a/modules/performance-statistics-ext/src/test/java/org/apache/ignite/internal/performancestatistics/PerformanceStatisticsPrinterTest.java b/modules/performance-statistics-ext/src/test/java/org/apache/ignite/internal/performancestatistics/PerformanceStatisticsPrinterTest.java
index f7dcd14..8e5e3a3 100644
--- a/modules/performance-statistics-ext/src/test/java/org/apache/ignite/internal/performancestatistics/PerformanceStatisticsPrinterTest.java
+++ b/modules/performance-statistics-ext/src/test/java/org/apache/ignite/internal/performancestatistics/PerformanceStatisticsPrinterTest.java
@@ -48,7 +48,9 @@ import static org.apache.ignite.internal.processors.performancestatistics.FilePe
 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 class PerformanceStatisticsPrinterTest {
             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 class PerformanceStatisticsPrinterTest {
                 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 class PerformanceStatisticsPrinterTest {
 
     /** */
     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<>();