zuston commented on code in PR #494:
URL: https://github.com/apache/incubator-uniffle/pull/494#discussion_r1080755756


##########
server/src/main/java/org/apache/uniffle/server/ShuffleTaskInfo.java:
##########
@@ -124,4 +136,32 @@ public long getPartitionDataSize(int shuffleId, int 
partitionId) {
     return size;
   }
 
+  public boolean hasHugePartition() {
+    return existHugePartition;
+  }
+
+  public int getHugePartitionSize() {
+    return hugePartitionTags.values().stream().map(x -> x.size()).reduce((x, 
y) -> x + y).orElse(0);
+  }
+
+  public void markHugePartition(int shuffleId, int partitionId) {
+    if (!existHugePartition) {
+      synchronized (this) {
+        if (!existHugePartition) {
+          ShuffleServerMetrics.gaugeAppWithHugePartitionNum.inc();
+          ShuffleServerMetrics.counterTotalAppWithHugePartitionNum.inc();
+          existHugePartition = true;
+        }
+      }
+    }
+
+    hugePartitionTags.computeIfAbsent(shuffleId, key -> 
Maps.newConcurrentMap());
+
+    hugePartitionTags.get(shuffleId).computeIfAbsent(partitionId, key -> {

Review Comment:
   > You can leverage set's  boolean add(E e); method's return boolean to 
update metrics conditionally
   
   Got it. ConcurrentHashSet is adapted for this.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to