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_r347748767
 
 

 ##########
 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:
   Here it throws ContainerNotFoundException, can we convert that to 
OMException.
   
   As in ozoneManagerRequestHandler.java L453, if it is anything other than 
OMException we throw it as INTERNAL_ERROR.
   if (ex instanceof OMException) {
         return Status.values()[((OMException) ex).getResult().ordinal()];
       } else {
         if (LOG.isDebugEnabled()) {
           LOG.debug("Unknown error occurs", ex);
         }
         return Status.INTERNAL_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