mgao0 opened a new issue #1313:
URL: https://github.com/apache/helix/issues/1313


   ### Describe the bug
   The customized view latency metric calculation code needs two improvements:
   1. Better handling to avoid NPE: 
   partitionStartTimeMap is of type Map<String, Long>. 
   `long timestamp = partitionStartTimeMap.get(instanceName);`
   The implicit conversion from Long to long could throw null pointer exception 
if the get() returns null.
   2. Reduce noise in the log
   `   if (!stateMapEntry.getValue().equals(oldStateMap.get(instanceName))) { `
   `              long timestamp = partitionStartTimeMap.get(instanceName);`
   `              if (timestamp > 0) {`
   `                
customizedViewMonitor.recordUpdateToAggregationLatency(curTime - timestamp);`
    `             } else {`
    `              LOG.warn(`
   `                    "Failed to find customized state update time stamp for 
resource {} partition {}, instance {}, on cluster {} the` `number should be 
positive.",`
   `                    resourceName, partitionName, instanceName, 
clusterName);`
   `              }`
   `            }`
   In current code, if the customized state is deleted, it still enters this if 
condition, and will eventual log a warning message in the logs. It creates too 
much noise. We want to: 1. if it's a deletion we don't enter this condition 2. 
Reduce the log level to info because it's not a critical failure
   
   ### To Reproduce
   N/A
   
   ### Expected behavior
   Prevent the NPE.
   Not log for deletion of customized state.
   
   ### Additional context
   Add any other context about the problem here.
   


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

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