drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bitblender <...@git.apache.org>
Subject [GitHub] drill pull request #921: DRILL-4286 Graceful shutdown of drillbit
Date Wed, 15 Nov 2017 00:23:01 GMT
Github user bitblender commented on a diff in the pull request:

    https://github.com/apache/drill/pull/921#discussion_r151003788
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/server/DrillbitContext.java
---
    @@ -157,10 +157,29 @@ public DrillConfig getConfig() {
         return context.getConfig();
       }
     
    -  public Collection<DrillbitEndpoint> getBits() {
    +  public Collection<DrillbitEndpoint> getAvailableBits() {
         return coord.getAvailableEndpoints();
       }
     
    +  public Collection<DrillbitEndpoint> getBits() {
    +    return coord.getOnlineEndPoints();
    +  }
    +  
    +  public boolean isOnline(DrillbitEndpoint endpoint) { return endpoint.getState().equals(DrillbitEndpoint.State.ONLINE);
}
    +
    +  public boolean isForemanOnline() {
    +    DrillbitEndpoint foreman = getEndpoint();
    +    Collection<DrillbitEndpoint> dbs = getAvailableBits();
    +    for( DrillbitEndpoint db : dbs) {
    +      if( db.getAddress().equals(foreman.getAddress()) && db.getUserPort() ==
foreman.getUserPort()) {
    --- End diff --
    
    Can you please explain the logic in isForemanOnline(). Why do you have to get the list
of endpoints from ZK and then check for foreman in that list before making the isOnline test
? Why can't it be done on the foreman object? Is this to make sure that the state is updated
in ZK before refusing to take queries ?
    Why do you assume that the foreman is online if the foreman is not found in the list of
endPoints? 
    i.e. if it is not in the dbs list
    why do you return true in that case ?


---

Mime
View raw message