You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@celeborn.apache.org by "boneanxs (via GitHub)" <gi...@apache.org> on 2023/02/27 08:15:22 UTC

[GitHub] [incubator-celeborn] boneanxs commented on a diff in pull request #1279: [CELEBORN-342] Fix the wrong avg produce bytes in Congestion control

boneanxs commented on code in PR #1279:
URL: https://github.com/apache/incubator-celeborn/pull/1279#discussion_r1118404081


##########
worker/src/main/java/org/apache/celeborn/service/deploy/worker/congestcontrol/BufferStatusHub.java:
##########
@@ -71,4 +71,12 @@ public BufferStatusHub(int timeWindowsInSecs) {
   protected BufferStatusNode newEmptyNode() {
     return new BufferStatusNode();
   }
+
+  public long avgBytesPerSec() {
+    long currentNumBytes = sum().numBytes();
+    if (currentNumBytes > 0) {
+      return currentNumBytes * 1000 / (long) getCurrentTimeWindowsInMills();
+    }
+    return 0L;

Review Comment:
   if `currentNumBytes` is 0, means there is no bytes being added, and `getCurrentTimeWindowsInMills` could be zero, causing the arithmetic exception



-- 
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: issues-unsubscribe@celeborn.apache.org

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