somandal commented on code in PR #15368:
URL: https://github.com/apache/pinot/pull/15368#discussion_r2019852047


##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/rebalance/RebalanceSummaryResult.java:
##########
@@ -306,18 +298,107 @@ public Map<String, ServerSegmentChangeInfo> 
getServerSegmentChangeInfo() {
     }
   }
 
+  @JsonInclude(JsonInclude.Include.NON_NULL)
+  public static class ConsumingSegmentToBeMovedSummary {
+    private final int _numConsumingSegmentsToBeMoved;
+    private final int _numServerGettingConsumingSegmentsAdded;
+    // the top N consuming segments with most offsets to be consumed by a 
server. this is essentially the difference
+    // between the latest offset of the stream and the segment's start offset 
of the stream
+    private final Map<String, Integer> 
_consumingSegmentsToBeMovedWithMostOffsetsToCatchUp;
+    // top N oldest consuming segments. the age of a segment is determined by 
its creation time
+    private final Map<String, Integer> 
_oldestConsumingSegmentsToBeMovedInMinutes;
+    private final Map<String, ConsumingSegmentSummaryPerServer> 
_serverConsumingSegmentSummary;
+
+    /**
+     * Constructor for ConsumingSegmentInfo
+     * @param numConsumingSegmentsToBeMoved total number of consuming segments 
to be moved as part of this rebalance
+     * @param numServerGettingConsumingSegmentsAdded maximum bytes of 
consuming segments to be moved to catch up
+     * @param consumingSegmentsToBeMovedWithMostOffsetsToCatchUp top consuming 
segments to be moved to catch up
+     * @param oldestConsumingSegmentsToBeMovedInMinutes oldest consuming 
segments to be moved to catch up
+     * @param serverConsumingSegmentSummary offsets of consuming segments to 
be moved to catch up per
+     *                                                   server
+     */
+    @JsonCreator
+    public ConsumingSegmentToBeMovedSummary(
+        @JsonProperty("numConsumingSegmentsToBeMoved") int 
numConsumingSegmentsToBeMoved,
+        @JsonProperty("numServerGettingConsumingSegmentsAdded") int 
numServerGettingConsumingSegmentsAdded,
+        @JsonProperty("consumingSegmentsToBeMovedWithMostOffsetsToCatchUp") 
@Nullable
+        Map<String, Integer> 
consumingSegmentsToBeMovedWithMostOffsetsToCatchUp,
+        @JsonProperty("oldestConsumingSegmentsToBeMovedInMinutes") @Nullable
+        Map<String, Integer> oldestConsumingSegmentsToBeMovedInMinutes,
+        @JsonProperty("serverConsumingSegmentSummary") @Nullable
+        Map<String, ConsumingSegmentSummaryPerServer> 
serverConsumingSegmentSummary) {
+      _numConsumingSegmentsToBeMoved = numConsumingSegmentsToBeMoved;
+      _numServerGettingConsumingSegmentsAdded = 
numServerGettingConsumingSegmentsAdded;
+      _consumingSegmentsToBeMovedWithMostOffsetsToCatchUp = 
consumingSegmentsToBeMovedWithMostOffsetsToCatchUp;
+      _oldestConsumingSegmentsToBeMovedInMinutes = 
oldestConsumingSegmentsToBeMovedInMinutes;
+      _serverConsumingSegmentSummary = serverConsumingSegmentSummary;
+    }
+
+    @JsonProperty
+    public int getNumConsumingSegmentsToBeMoved() {
+      return _numConsumingSegmentsToBeMoved;
+    }
+
+    @JsonProperty
+    public int getNumServerGettingConsumingSegmentsAdded() {
+      return _numServerGettingConsumingSegmentsAdded;
+    }
+
+    @JsonProperty
+    public Map<String, Integer> 
getConsumingSegmentsToBeMovedWithMostOffsetsToCatchUp() {
+      return _consumingSegmentsToBeMovedWithMostOffsetsToCatchUp;
+    }
+
+    @JsonProperty
+    public Map<String, Integer> getOldestConsumingSegmentsToBeMovedInMinutes() 
{
+      return _oldestConsumingSegmentsToBeMovedInMinutes;
+    }
+
+    @JsonProperty
+    public Map<String, ConsumingSegmentSummaryPerServer> 
getServerConsumingSegmentSummary() {
+      return _serverConsumingSegmentSummary;
+    }
+
+    public static class ConsumingSegmentSummaryPerServer {
+      private final int _numConsumingSegmentToBeAdded;
+      // How much offset this server would need to catch up to consume its 
newly added consuming segments from their
+      // start offset to latest offset in the topic
+      private final Integer _totalOffsetsToCatchUpAcrossAllConsumingSegments;

Review Comment:
   can we use `int` instead of `Integer` and just set this to `-1` if it is 
invalid? I'd much prefer that over this being an object that needs to be set to 
`null`. Also there is overhead to using `Integer` over `int`, so it is better 
not to use it if there is a workaround.



-- 
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: commits-unsubscr...@pinot.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to