Apache9 edited a comment on pull request #1909:
URL: https://github.com/apache/hbase/pull/1909#issuecomment-654218536


   > > I do not fully understand the logic here, why it is OK to use localhost 
if the returned hostAndWeight is null? We will only use the related methods to 
get hostAndWeight for the local machine?
   > 
   > Good question, the input host might be other machine in distributed mode, 
but in that case the hostAndWeights will not use localhost as host name(get 
from BlockLocation.hosts), so it is ok.
   
   I do not get your point...
   ```
     private float getBlockLocalityIndexInternal(String host, Visitor visitor) {
       float localityIndex = 0;
       HostAndWeight hostAndWeight = this.hostAndWeights.get(host);
       if (hostAndWeight == null) {
         hostAndWeight = this.hostAndWeights.get(HConstants.LOCALHOST);
       }
       if (hostAndWeight != null && uniqueBlocksTotalWeight != 0) {
         localityIndex = visitor.visit(hostAndWeight);
       }
       return localityIndex;
     }
   ```
   The modified code is like this, no matter what is the host passed in, you 
will always use localhost to get the hostAndWeight again if the first get 
returns null? What do you mean by 'but in that case the hostAndWeights will not 
use localhost as host name'?


----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to