Copilot commented on code in PR #5637:
URL: https://github.com/apache/ignite-3/pull/5637#discussion_r2044100543


##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/throttling/SpeedBasedMemoryConsumptionThrottlingStrategy.java:
##########
@@ -496,5 +506,31 @@ void reset() {
     void finish() {
         cpWriteSpeed.closeInterval();
         threadIds.clear();
+
+        updateWriteVsFsyncCoefficient();
+    }
+
+    private void updateWriteVsFsyncCoefficient() {
+        CheckpointProgress progress = cpProgress.get();
+        assert progress != null;
+
+        long pagesWriteTimeMillis = progress.getPagesWriteTimeMillis();
+        long fsyncTimeMillis = progress.getFsyncTimeMillis();
+
+        double coefficient = ((double) pagesWriteTimeMillis) / 
(pagesWriteTimeMillis + fsyncTimeMillis);

Review Comment:
   Consider handling the scenario where both pagesWriteTimeMillis and 
fsyncTimeMillis are 0 to avoid a 0/0 division, which results in NaN. Adding a 
conditional check or default value would improve robustness.
   ```suggestion
           double coefficient;
           if (pagesWriteTimeMillis == 0 && fsyncTimeMillis == 0) {
               coefficient = 0.5; // Default value when both times are zero
           } else {
               coefficient = ((double) pagesWriteTimeMillis) / 
(pagesWriteTimeMillis + fsyncTimeMillis);
           }
   ```



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to