ibessonov commented on code in PR #806:
URL: https://github.com/apache/ignite-3/pull/806#discussion_r875630206


##########
modules/page-memory/src/test/java/org/apache/ignite/internal/pagememory/persistence/checkpoint/CheckpointerTest.java:
##########
@@ -316,6 +357,50 @@ void testDoCheckpoint() throws Exception {
         
assertEquals(checkpointer.currentProgress().currentCheckpointPagesCount(), 3);
     }
 
+    @Test
+    void testNextCheckpointInterval() {
+        AtomicLong checkpointFrequency = new AtomicLong();
+        AtomicInteger checkpointFrequencyDeviation = new AtomicInteger();
+
+        Checkpointer checkpointer = new Checkpointer(
+                log,
+                "test",
+                null,
+                null,
+                mock(CheckpointWorkflow.class),
+                mock(CheckpointPagesWriterFactory.class),
+                1,
+                checkpointFrequency::get,
+                checkpointFrequencyDeviation::get
+        );
+
+        // Checks case 0 deviation.
+
+        checkpointFrequencyDeviation.set(0);
+
+        checkpointFrequency.set(1_000);
+        assertEquals(1_000, checkpointer.nextCheckpointInterval());
+
+        checkpointFrequency.set(2_000);
+        assertEquals(2_000, checkpointer.nextCheckpointInterval());
+
+        // Checks for non-zero deviation.
+
+        checkpointFrequencyDeviation.set(10);
+
+        assertThat(
+                checkpointer.nextCheckpointInterval(),
+                allOf(greaterThanOrEqualTo(1_900L), lessThanOrEqualTo(2_100L))
+        );
+
+        checkpointFrequencyDeviation.set(200);

Review Comment:
   I suppose that we should have an upper limit for this value, no one will 
ever set it to 200, it's insane :)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to