Phillippko commented on code in PR #5645:
URL: https://github.com/apache/ignite-3/pull/5645#discussion_r2046439609


##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/throttling/IntervalBasedMeasurement.java:
##########
@@ -105,7 +106,9 @@ long getSpeedOpsPerSec(long curNanoTime) {
     long getSpeedOpsPerSecReadOnly() {
         MeasurementInterval interval = measurementIntervalAtomicRef.get();
 
-        long curNanoTime = System.nanoTime();
+        long curNanoTime = interval == null || interval.endNanoTime == 0
+                ? System.nanoTime()
+                : interval.endNanoTime;
 
         return calcSpeed(interval, curNanoTime);

Review Comment:
   endNanoTime? 
   
   Current name doesn't reflect that we can take time from the interval



##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/throttling/IntervalBasedMeasurement.java:
##########
@@ -245,7 +273,7 @@ void finishInterval() {
     public long getAverage() {
         long time = System.nanoTime();
 
-        return avgMeasurementWithHistorical(interval(time), time);
+        return avgMeasurementWithHistorical(interval(false, time), time);

Review Comment:
   Now it can't start new interval, can it? "This method may start new interval 
measurement or switch current"



##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/PersistentPageMemory.java:
##########
@@ -2177,8 +2193,9 @@ public void finishCheckpoint() {
      * Checks if the Checkpoint Buffer is currently close to exhaustion.
      */
     public boolean isCpBufferOverflowThresholdExceeded() {
-        if (writeThrottle != null) {
-            return writeThrottle.isCpBufferOverflowThresholdExceeded();
+        PagesWriteThrottlePolicy writeThrottle0 = writeThrottle;

Review Comment:
   ```suggestion
           PagesWriteThrottlePolicy writeThrottle = this.writeThrottle;
   ```



##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/throttling/IntervalBasedMeasurement.java:
##########
@@ -163,12 +166,17 @@ private boolean isOutdated(@Nullable MeasurementInterval 
interval, long curNanoT
      * @param curNanoTime Current nano time.
      * @return Interval to use.
      */
-    private MeasurementInterval interval(long curNanoTime) {
+    @Contract("true, _ -> !null")
+    private MeasurementInterval interval(boolean canInit, long curNanoTime) {

Review Comment:
   please add param to javadoc



-- 
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