You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@tajo.apache.org by jinossy <gi...@git.apache.org> on 2015/09/09 04:49:38 UTC

[GitHub] tajo pull request: TAJO-1830: Fix race condition in HdfsServiceTra...

GitHub user jinossy opened a pull request:

    https://github.com/apache/tajo/pull/748

    TAJO-1830: Fix race condition in HdfsServiceTracker.

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jinossy/tajo TAJO-1830

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/tajo/pull/748.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #748
    
----
commit 02102c5506caddedc7b0637f2394a4585afbb546
Author: Jinho Kim <jh...@apache.org>
Date:   2015-09-09T02:48:44Z

    TAJO-1830: Fix race condition in HdfsServiceTracker.

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] tajo pull request: TAJO-1830: Fix race condition in HdfsServiceTra...

Posted by jinossy <gi...@git.apache.org>.
Github user jinossy commented on the pull request:

    https://github.com/apache/tajo/pull/748#issuecomment-138886350
  
    triggered it


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] tajo pull request: TAJO-1830: Fix race condition in HdfsServiceTra...

Posted by hyunsik <gi...@git.apache.org>.
Github user hyunsik commented on the pull request:

    https://github.com/apache/tajo/pull/748#issuecomment-138832282
  
    Could you trigger it?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] tajo pull request: TAJO-1830: Fix race condition in HdfsServiceTra...

Posted by jinossy <gi...@git.apache.org>.
Github user jinossy commented on the pull request:

    https://github.com/apache/tajo/pull/748#issuecomment-138789635
  
    Thanks for the review
    I've update the patch that reflects your comments


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] tajo pull request: TAJO-1830: Fix race condition in HdfsServiceTra...

Posted by hyunsik <gi...@git.apache.org>.
Github user hyunsik commented on a diff in the pull request:

    https://github.com/apache/tajo/pull/748#discussion_r39006028
  
    --- 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);
    --- End diff --
    
    It would be better if it is moved into the inner loop. If so, it will handle the case where the master entry is created during retrying.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] tajo pull request: TAJO-1830: Fix race condition in HdfsServiceTra...

Posted by hyunsik <gi...@git.apache.org>.
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] tajo pull request: TAJO-1830: Fix race condition in HdfsServiceTra...

Posted by hyunsik <gi...@git.apache.org>.
Github user hyunsik commented on the pull request:

    https://github.com/apache/tajo/pull/748#issuecomment-139237793
  
    +1
    
    The patch looks good to me.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] tajo pull request: TAJO-1830: Fix race condition in HdfsServiceTra...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/tajo/pull/748


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---