Throttle output of bytes in PageMemoryTracker/tests - Fixes
@@ -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++;
}
}
