kerneltime commented on code in PR #7076:
URL: https://github.com/apache/ozone/pull/7076#discussion_r1717354545


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/protocol/commands/ReconcileContainerCommand.java:
##########
@@ -85,4 +87,22 @@ public String toString() {
         ": containerId=" + getContainerID() +
         ", peerNodes=" + peerDatanodes;
   }
+
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) {
+      return true;
+    }
+    if (o == null || getClass() != o.getClass()) {
+      return false;
+    }
+    ReconcileContainerCommand that = (ReconcileContainerCommand) o;
+    return getContainerID() == that.getContainerID() &&
+        Objects.equals(peerDatanodes, that.peerDatanodes);
+  }
+
+  @Override
+  public int hashCode() {
+    return Objects.hash(getContainerID());

Review Comment:
   Should it include hash of the peer datanodes as well?



##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/checksum/ReconcileContainerTask.java:
##########
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.hadoop.ozone.container.checksum;
+
+import org.apache.hadoop.ozone.container.ozoneimpl.ContainerController;
+import org.apache.hadoop.ozone.container.replication.AbstractReplicationTask;
+import org.apache.hadoop.ozone.protocol.commands.ReconcileContainerCommand;
+import org.apache.hadoop.util.Time;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Objects;
+
+/**
+ * Used to execute a container reconciliation task that has been queued from 
the ReplicationSupervisor.
+ */
+public class ReconcileContainerTask extends AbstractReplicationTask {
+  private final ReconcileContainerCommand command;
+  private final DNContainerOperationClient dnClient;
+  private final ContainerController controller;
+
+  private static final Logger LOG =
+      LoggerFactory.getLogger(ReconcileContainerTask.class);
+
+  public ReconcileContainerTask(ContainerController controller,
+      DNContainerOperationClient dnClient, ReconcileContainerCommand command) {
+    super(command.getContainerID(), command.getDeadline(), command.getTerm());
+    this.command = command;
+    this.controller = controller;
+    this.dnClient = dnClient;
+  }
+
+  @Override
+  public void runTask() {
+    long start = Time.monotonicNow();
+
+    LOG.info("{}", this);
+
+    try {
+      controller.reconcileContainer(dnClient, command.getContainerID(), 
command.getPeerDatanodes());
+      setStatus(Status.DONE);
+      long elapsed = Time.monotonicNow() - start;
+      LOG.info("{} completed in {} ms", this, elapsed);

Review Comment:
   We should track this as a metric.



##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/checksum/ContainerChecksumTreeManager.java:
##########
@@ -60,10 +60,13 @@ public class ContainerChecksumTreeManager {
   public ContainerChecksumTreeManager(ConfigurationSource conf) {
     fileLock = SimpleStriped.readWriteLock(
         
conf.getObject(DatanodeConfiguration.class).getContainerChecksumLockStripes(), 
true);
-    // TODO: TO unregister metrics on stop.

Review Comment:
   This is a related todo to clean up in 
`org.apache.hadoop.ozone.container.checksum.ContainerMerkleTreeMetrics#create` 



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

Reply via email to