{"action":"created","comment":{"url":"https://api.github.com/repos/apache/tajo/pulls/comments/39004423","id":39004423,"diff_hunk":"@@ -458,21 +454,37 @@ public InetSocketAddress getMasterHttpInfo() throws ServiceTrackerException {\n         throw new ServiceTrackerException(\"Active master base path must be a directory.\");\n       }\n \n-      FileStatus[] files = fs.listStatus(activeMasterBaseDir);\n       /* wait for active master from HDFS */\n       int pause = conf.getIntVar(ConfVars.TAJO_MASTER_HA_CLIENT_RETRY_PAUSE_TIME);\n       int maxRetry = conf.getIntVar(ConfVars.TAJO_MASTER_HA_CLIENT_RETRY_MAX_NUM);\n       int retry = 0;\n \n-      while (files.length < 2 && retry < maxRetry) {\n+      FileStatus[] files = fs.listStatus(activeMasterBaseDir);\n+      Path activeMasterEntry = null;\n+\n+      loop:while (retry < maxRetry) {\n+\n+        for (FileStatus eachFile : files) {\n+          //check if active file is written\n+          if (!eachFile.getPath().getName().equals(HAConstants.ACTIVE_LOCK_FILE) && eachFile.getLen() > 0) {\n+            activeMasterEntry = eachFile.getPath();\n+            break loop;\n+          }\n+        }\n+\n         try {\n           this.wait(pause);\n         } catch (InterruptedException e) {\n           throw new ServiceTrackerException(e);\n         }\n+\n         files = fs.listStatus(activeMasterBaseDir);\n       }\n \n+      if (activeMasterEntry == null) {\n+        throw new ServiceTrackerException(\"No such active master in : \" + activeMasterBaseDir);","path":"tajo-core/src/main/java/org/apache/tajo/ha/HdfsServiceTracker.java","position":65,"original_position":65,"commit_id":"5b3597405ecdf4e946132f6dafe227274ca492c5","original_commit_id":"5b3597405ecdf4e946132f6dafe227274ca492c5","user":{"login":"hyunsik","id":225941,"avatar_url":"https://avatars.githubusercontent.com/u/225941?v=3","gravatar_id":"","url":"https://api.github.com/users/hyunsik","html_url":"https://github.com/hyunsik","followers_url":"https://api.github.com/users/hyunsik/followers","following_url":"https://api.github.com/users/hyunsik/following{/other_user}","gists_url":"https://api.github.com/users/hyunsik/gists{/gist_id}","starred_url":"https://api.github.com/users/hyunsik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyunsik/subscriptions","organizations_url":"https://api.github.com/users/hyunsik/orgs","repos_url":"https://api.github.com/users/hyunsik/repos","events_url":"https://api.github.com/users/hyunsik/events{/privacy}","received_events_url":"https://api.github.com/users/hyunsik/received_events","type":"User","site_admin":false},"body":"It would be better if the exception message is changed to 'Active master entry cannot be founded in '.","created_at":"2015-09-09T03:33:28Z","updated_at":"2015-09-09T03:33:28Z","html_url":"https://github.com/apache/tajo/pull/748#discussion_r39004423","pull_request_url":"https://api.github.com/repos/apache/tajo/pulls/748","_links":{"self":{"href":"https://api.github.com/repos/apache/tajo/pulls/comments/39004423"},"html":{"href":"https://github.com/apache/tajo/pull/748#discussion_r39004423"},"pull_request":{"href":"https://api.github.com/repos/apache/tajo/pulls/748"}}},"pull_request":{"url":"https://api.github.com/repos/apache/tajo/pulls/748","id":44505517,"html_url":"https://github.com/apache/tajo/pull/748","diff_url":"https://github.com/apache/tajo/pull/748.diff","patch_url":"https://github.com/apache/tajo/pull/748.patch","issue_url":"https://api.github.com/repos/apache/tajo/issues/748","number":748,"state":"open","locked":false,"title":"TAJO-1830: Fix race condition in HdfsServiceTracker.","user":{"login":"jinossy","id":3632397,"avatar_url":"https://avatars.githubusercontent.com/u/3632397?v=3","gravatar_id":"","url":"https://api.github.com/users/jinossy","html_url":"https://github.com/jinossy","followers_url":"https://api.github.com/users/jinossy/followers","following_url":"https://api.github.com/users/jinossy/following{/other_user}","gists_url":"https://api.github.com/users/jinossy/gists{/gist_id}","starred_url":"https://api.github.com/users/jinossy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jinossy/subscriptions","organizations_url":"https://api.github.com/users/jinossy/orgs","repos_url":"https://api.github.com/users/jinossy/repos","events_url":"https://api.github.com/users/jinossy/events{/privacy}","received_events_url":"https://api.github.com/users/jinossy/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-09-09T02:49:36Z","updated_at":"2015-09-09T03:33:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"40932db0b1d282d5eb285aababf5df15e5d0fc4e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/tajo/pulls/748/commits","review_comments_url":"https://api.github.com/repos/apache/tajo/pulls/748/comments","review_comment_url":"https://api.github.com/repos/apache/tajo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/tajo/issues/748/comments","statuses_url":"https://api.github.com/repos/apache/tajo/statuses/5b3597405ecdf4e946132f6dafe227274ca492c5","head":{"label":"jinossy:TAJO-1830","ref":"TAJO-1830","sha":"5b3597405ecdf4e946132f6dafe227274ca492c5","user":{"login":"jinossy","id":3632397,"avatar_url":"https://avatars.githubusercontent.com/u/3632397?v=3","gravatar_id":"","url":"https://api.github.com/users/jinossy","html_url":"https://github.com/jinossy","followers_url":"https://api.github.com/users/jinossy/followers","following_url":"https://api.github.com/users/jinossy/following{/other_user}","gists_url":"https://api.github.com/users/jinossy/gists{/gist_id}","starred_url":"https://api.github.com/users/jinossy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jinossy/subscriptions","organizations_url":"https://api.github.com/users/jinossy/orgs","repos_url":"https://api.github.com/users/jinossy/repos","events_url":"https://api.github.com/users/jinossy/events{/privacy}","received_events_url":"https://api.github.com/users/jinossy/received_events","type":"User","site_admin":false},"repo":{"id":18086829,"name":"tajo","full_name":"jinossy/tajo","owner":{"login":"jinossy","id":3632397,"avatar_url":"https://avatars.githubusercontent.com/u/3632397?v=3","gravatar_id":"","url":"https://api.github.com/users/jinossy","html_url":"https://github.com/jinossy","followers_url":"https://api.github.com/users/jinossy/followers","following_url":"https://api.github.com/users/jinossy/following{/other_user}","gists_url":"https://api.github.com/users/jinossy/gists{/gist_id}","starred_url":"https://api.github.com/users/jinossy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jinossy/subscriptions","organizations_url":"https://api.github.com/users/jinossy/orgs","repos_url":"https://api.github.com/users/jinossy/repos","events_url":"https://api.github.com/users/jinossy/events{/privacy}","received_events_url":"https://api.github.com/users/jinossy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jinossy/tajo","description":"Mirror of Apache Tajo","fork":true,"url":"https://api.github.com/repos/jinossy/tajo","forks_url":"https://api.github.com/repos/jinossy/tajo/forks","keys_url":"https://api.github.com/repos/jinossy/tajo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jinossy/tajo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jinossy/tajo/teams","hooks_url":"https://api.github.com/repos/jinossy/tajo/hooks","issue_events_url":"https://api.github.com/repos/jinossy/tajo/issues/events{/number}","events_url":"https://api.github.com/repos/jinossy/tajo/events","assignees_url":"https://api.github.com/repos/jinossy/tajo/assignees{/user}","branches_url":"https://api.github.com/repos/jinossy/tajo/branches{/branch}","tags_url":"https://api.github.com/repos/jinossy/tajo/tags","blobs_url":"https://api.github.com/repos/jinossy/tajo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jinossy/tajo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jinossy/tajo/git/refs{/sha}","trees_url":"https://api.github.com/repos/jinossy/tajo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jinossy/tajo/statuses/{sha}","languages_url":"https://api.github.com/repos/jinossy/tajo/languages","stargazers_url":"https://api.github.com/repos/jinossy/tajo/stargazers","contributors_url":"https://api.github.com/repos/jinossy/tajo/contributors","subscribers_url":"https://api.github.com/repos/jinossy/tajo/subscribers","subscription_url":"https://api.github.com/repos/jinossy/tajo/subscription","commits_url":"https://api.github.com/repos/jinossy/tajo/commits{/sha}","git_commits_url":"https://api.github.com/repos/jinossy/tajo/git/commits{/sha}","comments_url":"https://api.github.com/repos/jinossy/tajo/comments{/number}","issue_comment_url":"https://api.github.com/repos/jinossy/tajo/issues/comments{/number}","contents_url":"https://api.github.com/repos/jinossy/tajo/contents/{+path}","compare_url":"https://api.github.com/repos/jinossy/tajo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jinossy/tajo/merges","archive_url":"https://api.github.com/repos/jinossy/tajo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jinossy/tajo/downloads","issues_url":"https://api.github.com/repos/jinossy/tajo/issues{/number}","pulls_url":"https://api.github.com/repos/jinossy/tajo/pulls{/number}","milestones_url":"https://api.github.com/repos/jinossy/tajo/milestones{/number}","notifications_url":"https://api.github.com/repos/jinossy/tajo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jinossy/tajo/labels{/name}","releases_url":"https://api.github.com/repos/jinossy/tajo/releases{/id}","created_at":"2014-03-25T02:50:18Z","updated_at":"2015-04-01T15:31:06Z","pushed_at":"2015-09-09T03:01:24Z","git_url":"git://github.com/jinossy/tajo.git","ssh_url":"git@github.com:jinossy/tajo.git","clone_url":"https://github.com/jinossy/tajo.git","svn_url":"https://github.com/jinossy/tajo","homepage":null,"size":141274,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"bdd8e76855eb0a79f22c67832edc5ce535a1a938","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":17971138,"name":"tajo","full_name":"apache/tajo","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/tajo","description":"Mirror of Apache Tajo","fork":false,"url":"https://api.github.com/repos/apache/tajo","forks_url":"https://api.github.com/repos/apache/tajo/forks","keys_url":"https://api.github.com/repos/apache/tajo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/tajo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/tajo/teams","hooks_url":"https://api.github.com/repos/apache/tajo/hooks","issue_events_url":"https://api.github.com/repos/apache/tajo/issues/events{/number}","events_url":"https://api.github.com/repos/apache/tajo/events","assignees_url":"https://api.github.com/repos/apache/tajo/assignees{/user}","branches_url":"https://api.github.com/repos/apache/tajo/branches{/branch}","tags_url":"https://api.github.com/repos/apache/tajo/tags","blobs_url":"https://api.github.com/repos/apache/tajo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/tajo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/tajo/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/tajo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/tajo/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/tajo/languages","stargazers_url":"https://api.github.com/repos/apache/tajo/stargazers","contributors_url":"https://api.github.com/repos/apache/tajo/contributors","subscribers_url":"https://api.github.com/repos/apache/tajo/subscribers","subscription_url":"https://api.github.com/repos/apache/tajo/subscription","commits_url":"https://api.github.com/repos/apache/tajo/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/tajo/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/tajo/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/tajo/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/tajo/contents/{+path}","compare_url":"https://api.github.com/repos/apache/tajo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/tajo/merges","archive_url":"https://api.github.com/repos/apache/tajo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/tajo/downloads","issues_url":"https://api.github.com/repos/apache/tajo/issues{/number}","pulls_url":"https://api.github.com/repos/apache/tajo/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/tajo/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/tajo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/tajo/labels{/name}","releases_url":"https://api.github.com/repos/apache/tajo/releases{/id}","created_at":"2014-03-21T07:00:07Z","updated_at":"2015-08-25T06:25:42Z","pushed_at":"2015-09-09T03:01:24Z","git_url":"git://github.com/apache/tajo.git","ssh_url":"git@github.com:apache/tajo.git","clone_url":"https://github.com/apache/tajo.git","svn_url":"https://github.com/apache/tajo","homepage":null,"size":48231,"stargazers_count":61,"watchers_count":61,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":71,"mirror_url":"git://git.apache.org/tajo.git","open_issues_count":62,"forks":71,"open_issues":62,"watchers":61,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/tajo/pulls/748"},"html":{"href":"https://github.com/apache/tajo/pull/748"},"issue":{"href":"https://api.github.com/repos/apache/tajo/issues/748"},"comments":{"href":"https://api.github.com/repos/apache/tajo/issues/748/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/tajo/pulls/748/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/tajo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/tajo/pulls/748/commits"},"statuses":{"href":"https://api.github.com/repos/apache/tajo/statuses/5b3597405ecdf4e946132f6dafe227274ca492c5"}}}}