You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2022/10/21 01:39:06 UTC

[GitHub] [ozone] DaveTeng0 commented on a diff in pull request #3867: HDDS-7370. Add pending commands in SCM to Datanode command count

DaveTeng0 commented on code in PR #3867:
URL: https://github.com/apache/ozone/pull/3867#discussion_r1001271796


##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestCommandQueueReportHandler.java:
##########
@@ -77,35 +79,51 @@ public void resetEventCollector() throws IOException {
   public void testQueueReportProcessed() throws NodeNotFoundException {
     DatanodeDetails dn = MockDatanodeDetails.randomDatanodeDetails();
     nodeManager.register(dn, null, null);
+
+    // Add some queued commands to be sent to the DN on this heartbeat. This
+    // means the real queued count will be the value reported plus the commands
+    // sent to the DN.
+    Map<SCMCommandProto.Type, Integer> commandsToBeSent = new HashMap<>();
+    commandsToBeSent.put(SCMCommandProto.Type.valueOf(1), 2);
+    commandsToBeSent.put(SCMCommandProto.Type.valueOf(2), 1);
+
     SCMDatanodeHeartbeatDispatcher.CommandQueueReportFromDatanode
-        commandReport = getQueueReport(dn);
+        commandReport = getQueueReport(dn, commandsToBeSent);
     commandQueueReportHandler.onMessage(commandReport, this);
 
     int commandCount = commandReport.getReport().getCommandCount();
     for (int i = 0; i < commandCount; i++) {
       int storedCount = nodeManager.getNodeQueuedCommandCount(dn,
           commandReport.getReport().getCommand(i));
-      Assertions.assertEquals(commandReport.getReport().getCount(i),
-          storedCount);
+      int expectedCount = commandReport.getReport().getCount(i);
+      // For the first two commands, we added extra commands

Review Comment:
   Hello Stephen! Just for my self-learning, why the first two commands we add extra commands~? Thanks~ :pray:



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org