sodonnel commented on code in PR #3867:
URL: https://github.com/apache/ozone/pull/3867#discussion_r1006189303
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/DatanodeInfo.java:
##########
@@ -286,11 +286,20 @@ public void setNodeStatus(NodeStatus newNodeStatus) {
* Set the current command counts for this datanode, as reported in the last
* heartbeat.
* @param cmds Proto message containing a list of command count pairs.
+ * @param commandsToBeSent Summary of commands which will be sent to the DN
+ * as the heartbeat is processed and should be added
+ * to the command count.
*/
- public void setCommandCounts(CommandQueueReportProto cmds) {
+ public void setCommandCounts(CommandQueueReportProto cmds,
+ Map<SCMCommandProto.Type, Integer> commandsToBeSent) {
try {
int count = cmds.getCommandCount();
+ Map<SCMCommandProto.Type, Integer> mutableCmds
+ = new HashMap<>(commandsToBeSent);
lock.writeLock().lock();
+ // Purge the existing counts, as each report should completely replace
+ // the existing counts.
+ commandCounts.clear();
Review Comment:
Yea not sure why I didn't have that before. I guess we could omit it, but I
should not do any harm either.
--
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]