sarvekshayr commented on code in PR #8079:
URL: https://github.com/apache/ozone/pull/8079#discussion_r2028247029


##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/replicas/MetadataCheck.java:
##########
@@ -0,0 +1,156 @@
+/*
+ * 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.debug.replicas;
+
+import static 
org.apache.hadoop.hdds.protocol.proto.HddsProtos.ReplicationFactor.ONE;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.List;
+import java.util.Map;
+import org.apache.hadoop.hdds.client.StandaloneReplicationConfig;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import org.apache.hadoop.hdds.protocol.DatanodeDetails;
+import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos;
+import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
+import org.apache.hadoop.hdds.scm.XceiverClientManager;
+import org.apache.hadoop.hdds.scm.XceiverClientSpi;
+import org.apache.hadoop.hdds.scm.cli.ContainerOperationClient;
+import org.apache.hadoop.hdds.scm.pipeline.Pipeline;
+import org.apache.hadoop.hdds.scm.storage.ContainerProtocolCalls;
+import org.apache.hadoop.hdds.server.JsonUtils;
+import org.apache.hadoop.ozone.client.OzoneClient;
+import org.apache.hadoop.ozone.client.OzoneKeyDetails;
+import org.apache.hadoop.ozone.om.helpers.OmKeyArgs;
+import org.apache.hadoop.ozone.om.helpers.OmKeyInfo;
+import org.apache.hadoop.ozone.om.helpers.OmKeyLocationInfo;
+import org.apache.hadoop.ozone.om.protocol.OzoneManagerProtocol;
+import org.slf4j.Logger;
+
+/**
+ * Checks block existence using GetBlock calls to the Datanodes.
+ */
+public class MetadataCheck implements ReplicaVerifier {
+
+  private OzoneClient client;
+  private Logger log;
+  private PrintWriter printWriter;
+  private OzoneConfiguration conf;
+
+  public MetadataCheck(OzoneClient client, Logger log, PrintWriter 
printWriter, OzoneConfiguration conf) {
+    this.client = client;
+    this.log = log;
+    this.printWriter = printWriter;
+    this.conf = conf;
+  }
+
+  @Override
+  public void verifyKey(OzoneKeyDetails keyDetails) {
+    ObjectNode result = JsonUtils.createObjectNode(null);
+
+    try (ContainerOperationClient containerOperationClient = new 
ContainerOperationClient(conf);
+         XceiverClientManager xceiverClientManager = 
containerOperationClient.getXceiverClientManager()) {
+
+      OzoneManagerProtocol ozoneManagerClient = 
client.getObjectStore().getClientProxy().getOzoneManagerClient();

Review Comment:
   You're right, client initialization will be revisited as part of unifying 
output. For now, we are retaining the current approach.



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