avijayanhwx commented on a change in pull request #194: HDDS-2241. Optimize the 
refresh pipeline logic used by KeyManagerImpl…
URL: https://github.com/apache/hadoop-ozone/pull/194#discussion_r348233817
 
 

 ##########
 File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java
 ##########
 @@ -688,6 +665,35 @@ public OmKeyInfo lookupKey(OmKeyArgs args, String 
clientAddress)
     }
   }
 
+  /**
+   * Refresh pipeline info in OM by asking SCM.
+   * @param value OmKeyInfo
+   */
+  @VisibleForTesting
+  protected void refreshPipeline(OmKeyInfo value) throws  IOException {
+    Map<Long, ContainerWithPipeline> containerWithPipelineMap = new 
HashMap<>();
+    for (OmKeyLocationInfoGroup key : value.getKeyLocationVersions()) {
+      for (OmKeyLocationInfo k : key.getLocationList()) {
+        // TODO: fix Some tests that may not initialize container client
+        // The production should always have containerClient initialized.
+        if (scmClient.getContainerClient() != null) {
+          if (containerWithPipelineMap.containsKey(k.getContainerID())) {
+            ContainerWithPipeline containerWithPipeline = scmClient
+                .getContainerClient()
+                .getContainerWithPipeline(k.getContainerID());
 
 Review comment:
   I don't mind changing it. But, if the SCM logs it as ContainerNotFound 
Exception in logs, we may be OK since in a way we are actually not able to 
"find" the key here? 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to