{"action":"created","comment":{"url":"https://api.github.com/repos/apache/accumulo/pulls/comments/60850768","id":60850768,"diff_hunk":"@@ -329,6 +331,8 @@ private void processFailures(Map<KeyExtent,List<Range>> failures, ResultReceiver\n \n     // since the first call to binRanges clipped the ranges to within a tablet, we should not get only\n     // bin to the set of failed tablets\n+    if (!locator.isValid())\n+      locator = new TimeoutTabletLocator(TabletLocator.getLocator(instance, new Text(table)), timeout);","path":"core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java","position":14,"original_position":14,"commit_id":"62630b97d3dccf4cba92ecb83e05a96bedd17a3a","original_commit_id":"62630b97d3dccf4cba92ecb83e05a96bedd17a3a","user":{"login":"dhutchis","id":1687158,"avatar_url":"https://avatars.githubusercontent.com/u/1687158?v=3","gravatar_id":"","url":"https://api.github.com/users/dhutchis","html_url":"https://github.com/dhutchis","followers_url":"https://api.github.com/users/dhutchis/followers","following_url":"https://api.github.com/users/dhutchis/following{/other_user}","gists_url":"https://api.github.com/users/dhutchis/gists{/gist_id}","starred_url":"https://api.github.com/users/dhutchis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhutchis/subscriptions","organizations_url":"https://api.github.com/users/dhutchis/orgs","repos_url":"https://api.github.com/users/dhutchis/repos","events_url":"https://api.github.com/users/dhutchis/events{/privacy}","received_events_url":"https://api.github.com/users/dhutchis/received_events","type":"User","site_admin":false},"body":"I see what you are saying @wjsl -- various QueryTask threads could potentially read that their locators are not valid and then all replace the locator.  If n threads try to do this with unfortunate timing, then there are n-1 creations of a new TimeoutTabletLocator that are thrown away.  It's not a particularly bad problem since the end result is correct no matter what, but it would be nice to guard against it.\r\n\r\nWhat do you think of this:\r\n\r\n```java\r\nif (!locator.isValid())\r\n  synchronized (TabletServerBatchReaderIterator.this) {\r\n    if (!locator.isValid())\r\n      locator = new TimeoutTabletLocator(TabletLocator.getLocator(instance, new Text(table)), timeout);\r\n  }\r\n```\r\n\r\nI would do something similar for `ConditionalWriterImpl`. The `TabletServerBatchWriter` is safe.","created_at":"2016-04-24T19:53:44Z","updated_at":"2016-04-24T19:53:44Z","html_url":"https://github.com/apache/accumulo/pull/96#discussion_r60850768","pull_request_url":"https://api.github.com/repos/apache/accumulo/pulls/96","_links":{"self":{"href":"https://api.github.com/repos/apache/accumulo/pulls/comments/60850768"},"html":{"href":"https://github.com/apache/accumulo/pull/96#discussion_r60850768"},"pull_request":{"href":"https://api.github.com/repos/apache/accumulo/pulls/96"}}},"pull_request":{"url":"https://api.github.com/repos/apache/accumulo/pulls/96","id":67600898,"html_url":"https://github.com/apache/accumulo/pull/96","diff_url":"https://github.com/apache/accumulo/pull/96.diff","patch_url":"https://github.com/apache/accumulo/pull/96.patch","issue_url":"https://api.github.com/repos/apache/accumulo/issues/96","number":96,"state":"open","locked":false,"title":"ACCUMULO-4229 BatchWriter Locator cache out-of-sync when shared with tserver","user":{"login":"dhutchis","id":1687158,"avatar_url":"https://avatars.githubusercontent.com/u/1687158?v=3","gravatar_id":"","url":"https://api.github.com/users/dhutchis","html_url":"https://github.com/dhutchis","followers_url":"https://api.github.com/users/dhutchis/followers","following_url":"https://api.github.com/users/dhutchis/following{/other_user}","gists_url":"https://api.github.com/users/dhutchis/gists{/gist_id}","starred_url":"https://api.github.com/users/dhutchis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhutchis/subscriptions","organizations_url":"https://api.github.com/users/dhutchis/orgs","repos_url":"https://api.github.com/users/dhutchis/repos","events_url":"https://api.github.com/users/dhutchis/events{/privacy}","received_events_url":"https://api.github.com/users/dhutchis/received_events","type":"User","site_admin":false},"body":"This adds two ITs and a fix. The first IT passes and establishes a baseline. The second IT failed before the fix but now passes after the fix.\r\n\r\nThe fix has the client ConditionalWriter, BatchWriter, and BatchScanner check to see if a locally cached Locator is out of date due to the static TabletLocator cache being cleared.\r\n\r\nThere is no addition to public API. I include some utility classes that help run the tests.","created_at":"2016-04-23T08:48:02Z","updated_at":"2016-04-24T19:53:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cc3895b96e200e74c4561820af66e5f619ad3e25","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/accumulo/pulls/96/commits","review_comments_url":"https://api.github.com/repos/apache/accumulo/pulls/96/comments","review_comment_url":"https://api.github.com/repos/apache/accumulo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/accumulo/issues/96/comments","statuses_url":"https://api.github.com/repos/apache/accumulo/statuses/62630b97d3dccf4cba92ecb83e05a96bedd17a3a","head":{"label":"dhutchis:ACCUMULO-4229","ref":"ACCUMULO-4229","sha":"62630b97d3dccf4cba92ecb83e05a96bedd17a3a","user":{"login":"dhutchis","id":1687158,"avatar_url":"https://avatars.githubusercontent.com/u/1687158?v=3","gravatar_id":"","url":"https://api.github.com/users/dhutchis","html_url":"https://github.com/dhutchis","followers_url":"https://api.github.com/users/dhutchis/followers","following_url":"https://api.github.com/users/dhutchis/following{/other_user}","gists_url":"https://api.github.com/users/dhutchis/gists{/gist_id}","starred_url":"https://api.github.com/users/dhutchis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhutchis/subscriptions","organizations_url":"https://api.github.com/users/dhutchis/orgs","repos_url":"https://api.github.com/users/dhutchis/repos","events_url":"https://api.github.com/users/dhutchis/events{/privacy}","received_events_url":"https://api.github.com/users/dhutchis/received_events","type":"User","site_admin":false},"repo":{"id":31956508,"name":"accumulo","full_name":"dhutchis/accumulo","owner":{"login":"dhutchis","id":1687158,"avatar_url":"https://avatars.githubusercontent.com/u/1687158?v=3","gravatar_id":"","url":"https://api.github.com/users/dhutchis","html_url":"https://github.com/dhutchis","followers_url":"https://api.github.com/users/dhutchis/followers","following_url":"https://api.github.com/users/dhutchis/following{/other_user}","gists_url":"https://api.github.com/users/dhutchis/gists{/gist_id}","starred_url":"https://api.github.com/users/dhutchis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhutchis/subscriptions","organizations_url":"https://api.github.com/users/dhutchis/orgs","repos_url":"https://api.github.com/users/dhutchis/repos","events_url":"https://api.github.com/users/dhutchis/events{/privacy}","received_events_url":"https://api.github.com/users/dhutchis/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dhutchis/accumulo","description":"Mirror of Apache Accumulo","fork":true,"url":"https://api.github.com/repos/dhutchis/accumulo","forks_url":"https://api.github.com/repos/dhutchis/accumulo/forks","keys_url":"https://api.github.com/repos/dhutchis/accumulo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dhutchis/accumulo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dhutchis/accumulo/teams","hooks_url":"https://api.github.com/repos/dhutchis/accumulo/hooks","issue_events_url":"https://api.github.com/repos/dhutchis/accumulo/issues/events{/number}","events_url":"https://api.github.com/repos/dhutchis/accumulo/events","assignees_url":"https://api.github.com/repos/dhutchis/accumulo/assignees{/user}","branches_url":"https://api.github.com/repos/dhutchis/accumulo/branches{/branch}","tags_url":"https://api.github.com/repos/dhutchis/accumulo/tags","blobs_url":"https://api.github.com/repos/dhutchis/accumulo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dhutchis/accumulo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dhutchis/accumulo/git/refs{/sha}","trees_url":"https://api.github.com/repos/dhutchis/accumulo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dhutchis/accumulo/statuses/{sha}","languages_url":"https://api.github.com/repos/dhutchis/accumulo/languages","stargazers_url":"https://api.github.com/repos/dhutchis/accumulo/stargazers","contributors_url":"https://api.github.com/repos/dhutchis/accumulo/contributors","subscribers_url":"https://api.github.com/repos/dhutchis/accumulo/subscribers","subscription_url":"https://api.github.com/repos/dhutchis/accumulo/subscription","commits_url":"https://api.github.com/repos/dhutchis/accumulo/commits{/sha}","git_commits_url":"https://api.github.com/repos/dhutchis/accumulo/git/commits{/sha}","comments_url":"https://api.github.com/repos/dhutchis/accumulo/comments{/number}","issue_comment_url":"https://api.github.com/repos/dhutchis/accumulo/issues/comments{/number}","contents_url":"https://api.github.com/repos/dhutchis/accumulo/contents/{+path}","compare_url":"https://api.github.com/repos/dhutchis/accumulo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dhutchis/accumulo/merges","archive_url":"https://api.github.com/repos/dhutchis/accumulo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dhutchis/accumulo/downloads","issues_url":"https://api.github.com/repos/dhutchis/accumulo/issues{/number}","pulls_url":"https://api.github.com/repos/dhutchis/accumulo/pulls{/number}","milestones_url":"https://api.github.com/repos/dhutchis/accumulo/milestones{/number}","notifications_url":"https://api.github.com/repos/dhutchis/accumulo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dhutchis/accumulo/labels{/name}","releases_url":"https://api.github.com/repos/dhutchis/accumulo/releases{/id}","deployments_url":"https://api.github.com/repos/dhutchis/accumulo/deployments","created_at":"2015-03-10T12:36:59Z","updated_at":"2015-04-14T20:55:12Z","pushed_at":"2016-04-23T08:42:54Z","git_url":"git://github.com/dhutchis/accumulo.git","ssh_url":"git@github.com:dhutchis/accumulo.git","clone_url":"https://github.com/dhutchis/accumulo.git","svn_url":"https://github.com/dhutchis/accumulo","homepage":"","size":48789,"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:1.6","ref":"1.6","sha":"0fee43f50239465835e084467d937120f69c7cb0","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":2524488,"name":"accumulo","full_name":"apache/accumulo","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/accumulo","description":"Mirror of Apache Accumulo","fork":false,"url":"https://api.github.com/repos/apache/accumulo","forks_url":"https://api.github.com/repos/apache/accumulo/forks","keys_url":"https://api.github.com/repos/apache/accumulo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/accumulo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/accumulo/teams","hooks_url":"https://api.github.com/repos/apache/accumulo/hooks","issue_events_url":"https://api.github.com/repos/apache/accumulo/issues/events{/number}","events_url":"https://api.github.com/repos/apache/accumulo/events","assignees_url":"https://api.github.com/repos/apache/accumulo/assignees{/user}","branches_url":"https://api.github.com/repos/apache/accumulo/branches{/branch}","tags_url":"https://api.github.com/repos/apache/accumulo/tags","blobs_url":"https://api.github.com/repos/apache/accumulo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/accumulo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/accumulo/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/accumulo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/accumulo/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/accumulo/languages","stargazers_url":"https://api.github.com/repos/apache/accumulo/stargazers","contributors_url":"https://api.github.com/repos/apache/accumulo/contributors","subscribers_url":"https://api.github.com/repos/apache/accumulo/subscribers","subscription_url":"https://api.github.com/repos/apache/accumulo/subscription","commits_url":"https://api.github.com/repos/apache/accumulo/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/accumulo/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/accumulo/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/accumulo/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/accumulo/contents/{+path}","compare_url":"https://api.github.com/repos/apache/accumulo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/accumulo/merges","archive_url":"https://api.github.com/repos/apache/accumulo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/accumulo/downloads","issues_url":"https://api.github.com/repos/apache/accumulo/issues{/number}","pulls_url":"https://api.github.com/repos/apache/accumulo/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/accumulo/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/accumulo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/accumulo/labels{/name}","releases_url":"https://api.github.com/repos/apache/accumulo/releases{/id}","deployments_url":"https://api.github.com/repos/apache/accumulo/deployments","created_at":"2011-10-06T07:00:09Z","updated_at":"2016-04-24T06:30:49Z","pushed_at":"2016-04-23T08:48:02Z","git_url":"git://github.com/apache/accumulo.git","ssh_url":"git@github.com:apache/accumulo.git","clone_url":"https://github.com/apache/accumulo.git","svn_url":"https://github.com/apache/accumulo","homepage":"","size":64334,"stargazers_count":215,"watchers_count":215,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":117,"mirror_url":"git://git.apache.org/accumulo.git","open_issues_count":5,"forks":117,"open_issues":5,"watchers":215,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/accumulo/pulls/96"},"html":{"href":"https://github.com/apache/accumulo/pull/96"},"issue":{"href":"https://api.github.com/repos/apache/accumulo/issues/96"},"comments":{"href":"https://api.github.com/repos/apache/accumulo/issues/96/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/accumulo/pulls/96/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/accumulo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/accumulo/pulls/96/commits"},"statuses":{"href":"https://api.github.com/repos/apache/accumulo/statuses/62630b97d3dccf4cba92ecb83e05a96bedd17a3a"}}}}