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

 ##########
 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:
   If we can throw OMException with some new code/message it will be clearer. 
And it also helps when we see this kind of error. If we have same thing, we 
cannot distinguish the error.

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