Github user hyunsik commented on a diff in the pull request:

    https://github.com/apache/tajo/pull/748#discussion_r39004423
  
    --- Diff: 
tajo-core/src/main/java/org/apache/tajo/ha/HdfsServiceTracker.java ---
    @@ -458,21 +454,37 @@ public InetSocketAddress getMasterHttpInfo() throws 
ServiceTrackerException {
             throw new ServiceTrackerException("Active master base path must be 
a directory.");
           }
     
    -      FileStatus[] files = fs.listStatus(activeMasterBaseDir);
           /* wait for active master from HDFS */
           int pause = 
conf.getIntVar(ConfVars.TAJO_MASTER_HA_CLIENT_RETRY_PAUSE_TIME);
           int maxRetry = 
conf.getIntVar(ConfVars.TAJO_MASTER_HA_CLIENT_RETRY_MAX_NUM);
           int retry = 0;
     
    -      while (files.length < 2 && retry < maxRetry) {
    +      FileStatus[] files = fs.listStatus(activeMasterBaseDir);
    +      Path activeMasterEntry = null;
    +
    +      loop:while (retry < maxRetry) {
    +
    +        for (FileStatus eachFile : files) {
    +          //check if active file is written
    +          if 
(!eachFile.getPath().getName().equals(HAConstants.ACTIVE_LOCK_FILE) && 
eachFile.getLen() > 0) {
    +            activeMasterEntry = eachFile.getPath();
    +            break loop;
    +          }
    +        }
    +
             try {
               this.wait(pause);
             } catch (InterruptedException e) {
               throw new ServiceTrackerException(e);
             }
    +
             files = fs.listStatus(activeMasterBaseDir);
           }
     
    +      if (activeMasterEntry == null) {
    +        throw new ServiceTrackerException("No such active master in : " + 
activeMasterBaseDir);
    --- End diff --
    
    It would be better if the exception message is changed to 'Active master 
entry cannot be founded in '.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to