You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by il...@apache.org on 2020/01/14 12:04:43 UTC

[ignite] branch master updated: IGNITE-12403 Throttle output of bytes in PageMemoryTracker/tests - Fixes #7086.

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 50f8f8c  IGNITE-12403 Throttle output of bytes in PageMemoryTracker/tests - Fixes #7086.
50f8f8c is described below

commit 50f8f8c5bef75a516402417ead65a8e3e8f9bdf3
Author: Ilya Kasnacheev <il...@apache.org>
AuthorDate: Tue Jan 14 14:56:59 2020 +0300

    IGNITE-12403 Throttle output of bytes in PageMemoryTracker/tests - Fixes #7086.
    
    Signed-off-by: Ilya Kasnacheev <il...@gmail.com>
---
 .../persistence/wal/memtracker/PageMemoryTracker.java     | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/memtracker/PageMemoryTracker.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/memtracker/PageMemoryTracker.java
index d8a0c3d..cda87c4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/memtracker/PageMemoryTracker.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/memtracker/PageMemoryTracker.java
@@ -83,6 +83,9 @@ import static org.apache.ignite.internal.processors.cache.persistence.tree.io.Pa
  * applying page snapshots and deltas.
  */
 public class PageMemoryTracker implements IgnitePlugin {
+    /** */
+    private final long DUMP_DIFF_BYTES_LIMIT = 65536L;
+
     /** Plugin context. */
     private final PluginContext ctx;
 
@@ -101,6 +104,9 @@ public class PageMemoryTracker implements IgnitePlugin {
     /** Pages. */
     private final Map<FullPageId, DirectMemoryPage> pages = new ConcurrentHashMap<>();
 
+    /** Dumped diff bytes. */
+    private volatile long dumpedDiffBytes = 0L;
+
     /** Page slots. */
     private volatile DirectMemoryPageSlot[] pageSlots;
 
@@ -717,6 +723,9 @@ public class PageMemoryTracker implements IgnitePlugin {
      * @param buf2 Buffer 2.
      */
     private void dumpDiff(ByteBuffer buf1, ByteBuffer buf2) {
+        if (dumpedDiffBytes > DUMP_DIFF_BYTES_LIMIT)
+            return;
+
         log.error(">>> Diff:");
 
         for (int i = 0; i < Math.min(buf1.remaining(), buf2.remaining()); i++) {
@@ -725,15 +734,21 @@ public class PageMemoryTracker implements IgnitePlugin {
 
             if (b1 != b2)
                 log.error(String.format("        0x%04X: %02X %02X", i, b1, b2));
+
+            dumpedDiffBytes++;
         }
 
         if (buf1.remaining() < buf2.remaining()) {
             for (int i = buf1.remaining(); i < buf2.remaining(); i++)
                 log.error(String.format("        0x%04X:    %02X", i, buf2.get(buf2.position() + i)));
+
+            dumpedDiffBytes++;
         }
         else if (buf1.remaining() > buf2.remaining()) {
             for (int i = buf2.remaining(); i < buf1.remaining(); i++)
                 log.error(String.format("        0x%04X: %02X", i, buf1.get(buf1.position() + i)));
+
+            dumpedDiffBytes++;
         }
     }