aswinshakil commented on code in PR #3867:
URL: https://github.com/apache/ozone/pull/3867#discussion_r1006184832
##########
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:
Thanks for the detailed explanation. My initial doubt was
`commandCounts.clear();` was added now in this patch, I was just wondering why
wasn't it added before. I guess the initial thought was that the command not
reported by DN should be 0, it would be cleared anyway (with 0) by the
`commandCounts.put(command, cmdCount)`.
The changes look good to me.
--
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]