priyeshkaratha commented on code in PR #9584:
URL: https://github.com/apache/ozone/pull/9584#discussion_r2715263535


##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/DataNodeMetricsService.java:
##########
@@ -294,16 +300,23 @@ private void resetState() {
     totalNodesFailed = 0;
   }
 
-  public DataNodeMetricsServiceResponse getCollectedMetrics() {
+  public DataNodeMetricsServiceResponse getCollectedMetrics(int limit) {
     startTask();
     if (currentStatus == MetricCollectionStatus.FINISHED) {
-      return DataNodeMetricsServiceResponse.newBuilder()
+      DataNodeMetricsServiceResponse.Builder dnMetricsBuilder = 
DataNodeMetricsServiceResponse.newBuilder();
+      dnMetricsBuilder
           .setStatus(currentStatus)
-          .setPendingDeletion(pendingDeletionList)
           .setTotalPendingDeletionSize(totalPendingDeletion)
           .setTotalNodesQueried(totalNodesQueried)
-          .setTotalNodeQueryFailures(totalNodesFailed)
-          .build();
+          .setTotalNodeQueryFailures(totalNodesFailed);
+
+      if (limit < 0) {

Review Comment:
   I think we should return 400 error for limit < 0 which is not meaningful. if 
we didn't pass limit it should return full data.



##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/PendingDeletionEndpoint.java:
##########
@@ -56,15 +63,20 @@ public PendingDeletionEndpoint(
   }
 
   @GET
-  public Response getPendingDeletionByComponent(@QueryParam("component") 
String component) {
+  public Response getPendingDeletionByComponent(
+      @QueryParam("component")
+      String component,
+      @QueryParam("limit")
+      int limit
+  ) {
     if (component == null || component.isEmpty()) {
       return Response.status(Response.Status.BAD_REQUEST)
           .entity("component query parameter is required").build();
     }

Review Comment:
   add a condition for limit less than zero here, so that it can return bad 
request, it it is null or empty we can send complete list. So I suggest 
refactoring in that way.



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