sumitagrawl commented on code in PR #11423:
URL: https://github.com/apache/ozone/pull/11423#discussion_r4389942677


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/StateContext.java:
##########
@@ -375,16 +375,40 @@ public void putBackReports(List<Message> reportsToPutBack,
    */
   public List<Message> getAllAvailableReports(
       HostAndPort endpoint) {
-    int maxLimit = Integer.MAX_VALUE;
-    // TODO: It is highly unlikely that we will reach maxLimit for the number
-    //       for the number of reports, specially as it does not apply to the
-    //       number of entries in a report. But if maxLimit is hit, should a
-    //       heartbeat be scheduled ASAP? Should full reports not included be
-    //       dropped? Currently this code will keep the full reports not sent
-    //       and include it in the next heartbeat.
+    return getAllAvailableReportsUpToLimit(endpoint, Integer.MAX_VALUE);
+  }
+
+  /**
+   * Returns up to {@code maxLimit} available reports for the endpoint,
+   * removing them from the queue. Any reports beyond the limit stay queued
+   * and are returned by a later call; callers can use {@link
+   * #hasPendingReports(HostAndPort)} to detect that case and schedule a
+   * follow-up heartbeat.
+   *
+   * @return List of reports
+   */
+  public List<Message> getAllAvailableReports(
+      HostAndPort endpoint, int maxLimit) {
     return getAllAvailableReportsUpToLimit(endpoint, maxLimit);
   }
 
+  /**
+   * Returns true if any reports are still queued for the endpoint.
+   */
+  public boolean hasPendingReports(HostAndPort endpoint) {
+    synchronized (incrementalReportsQueue) {
+      List<Message> reportsForEndpoint = incrementalReportsQueue.get(endpoint);
+      if (reportsForEndpoint != null && !reportsForEndpoint.isEmpty()) {
+        return true;
+      }
+    }
+    Map<String, AtomicBoolean> fullReports =

Review Comment:
   Before FCR (Full container report every hour as default), all ICR needs to 
be processed. Sending ICR after FCR can have issue, like container is added 
closed, but ICR is sending action as CLOSING. We need `fully analyze the impact 
`of this before making partial OR need clear ICR (except delete container ICR).



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