Janus Chow created HDDS-4824:
--------------------------------

             Summary: StateContext set the same reports repeatedly
                 Key: HDDS-4824
                 URL: https://issues.apache.org/jira/browse/HDDS-4824
             Project: Apache Ozone
          Issue Type: Improvement
            Reporter: Janus Chow
            Assignee: Janus Chow


In StateContext.addReport(GeneratedMessage report), the report was added to 
containerReports, nodeReports or pipelineReports for each endpoint loop, but 
the three reports keep the lastest full report for the whole context, there is 
no need to set the value in each endpoint loop. 

The original code is as follows:
{code:java}
for (InetSocketAddress endpoint : endpoints) {
  if (reportType.equals(CONTAINER_REPORTS_PROTO_NAME)) {
    containerReports.set(report);
  } else if (reportType.equals(NODE_REPORT_PROTO_NAME)) {
    nodeReport.set(report);
  } else if (reportType.equals(PIPELINE_REPORTS_PROTO_NAME)) {
    pipelineReports.set(report);
  } else if (ACCEPTED_INCREMENTAL_REPORT_TYPE_SET.contains(reportType)) {
    synchronized (incrementalReportsQueue) {
      incrementalReportsQueue.get(endpoint).add(report);
    }
  } else {
    throw new IllegalArgumentException(
        "Unidentified report message type: " + reportType);
  }
}
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to