{"action":"created","comment":{"url":"https://api.github.com/repos/druid-io/druid/pulls/comments/59816637","id":59816637,"diff_hunk":"@@ -207,7 +272,7 @@ public TaskStatus run(final TaskToolbox toolbox) throws Exception\n \n       // Start up, set up initial offsets.\n       final Object restoredMetadata = driver.startJob();\n-      final Map<Integer, Long> nextOffsets = Maps.newHashMap();\n+      nextOffsets.clear();","path":"extensions-core/kafka-indexing-service/src/main/java/io/druid/indexing/kafka/KafkaIndexTask.java","position":182,"original_position":182,"commit_id":"65c6a1c5e709d7a99a5daacb47830827b0ae620c","original_commit_id":"65c6a1c5e709d7a99a5daacb47830827b0ae620c","user":{"login":"dclim","id":11050882,"avatar_url":"https://avatars.githubusercontent.com/u/11050882?v=3","gravatar_id":"","url":"https://api.github.com/users/dclim","html_url":"https://github.com/dclim","followers_url":"https://api.github.com/users/dclim/followers","following_url":"https://api.github.com/users/dclim/following{/other_user}","gists_url":"https://api.github.com/users/dclim/gists{/gist_id}","starred_url":"https://api.github.com/users/dclim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dclim/subscriptions","organizations_url":"https://api.github.com/users/dclim/orgs","repos_url":"https://api.github.com/users/dclim/repos","events_url":"https://api.github.com/users/dclim/events{/privacy}","received_events_url":"https://api.github.com/users/dclim/received_events","type":"User","site_admin":false},"body":"Yes you're correct. At the time, when I moved nextOffsets from local variable to class field, I hadn't checked if this method would be called multiple times or not so I put the clear in here to be sure I didn't change behavior, but looking at it now I don't think it's necessary.","created_at":"2016-04-15T01:21:47Z","updated_at":"2016-04-15T01:21:47Z","html_url":"https://github.com/druid-io/druid/pull/2730#discussion_r59816637","pull_request_url":"https://api.github.com/repos/druid-io/druid/pulls/2730","_links":{"self":{"href":"https://api.github.com/repos/druid-io/druid/pulls/comments/59816637"},"html":{"href":"https://github.com/druid-io/druid/pull/2730#discussion_r59816637"},"pull_request":{"href":"https://api.github.com/repos/druid-io/druid/pulls/2730"}}},"pull_request":{"url":"https://api.github.com/repos/druid-io/druid/pulls/2730","id":64124018,"html_url":"https://github.com/druid-io/druid/pull/2730","diff_url":"https://github.com/druid-io/druid/pull/2730.diff","patch_url":"https://github.com/druid-io/druid/pull/2730.patch","issue_url":"https://api.github.com/repos/druid-io/druid/issues/2730","number":2730,"state":"open","locked":false,"title":"add control and status endpoints to KafkaIndexTask","user":{"login":"dclim","id":11050882,"avatar_url":"https://avatars.githubusercontent.com/u/11050882?v=3","gravatar_id":"","url":"https://api.github.com/users/dclim","html_url":"https://github.com/dclim","followers_url":"https://api.github.com/users/dclim/followers","following_url":"https://api.github.com/users/dclim/following{/other_user}","gists_url":"https://api.github.com/users/dclim/gists{/gist_id}","starred_url":"https://api.github.com/users/dclim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dclim/subscriptions","organizations_url":"https://api.github.com/users/dclim/orgs","repos_url":"https://api.github.com/users/dclim/repos","events_url":"https://api.github.com/users/dclim/events{/privacy}","received_events_url":"https://api.github.com/users/dclim/received_events","type":"User","site_admin":false},"body":"Added the following HTTP endpoints to KafkaIndexTask:\r\n1) [GET /offsets/current] - Return which offsets we are currently processing\r\n2) [GET /offsets/end] - Return the offsets that the task will read until\r\n3) [POST /offsets/end] - Modify the ending offsets to allow the task to continue reading or stop early\r\n4) [POST /stop?publish=true/false] - Signal the task to stop early, either abruptly or gracefully (stop reading and publish segment with what we currently have). In both cases it returns a SUCCESS status\r\n5) [POST /pause?timeout=x] - Signal the task to pause reading, either indefinitely or with a provided timeout to resume\r\n6) [GET /status] - Return the task's state\r\n7) [POST /resume] - Signal the task to resume reading\r\n8) [GET /time/start] - Returns the timestamp when the task began running\r\n\r\nThese endpoints are required for implementing functionality for #2656, specifically:\r\n(1) exposes the offset currently being read and allows us to start the next tasks early\r\n(4) allows us to stop redundant replicas when another has completed without generating a failed status\r\n(all) allows us to stop tasks gracefully in a coordinated way across replicas (by pausing and then setting the end offsets so that they all finish at the same place) - this enables graceful immediate schema rollover as well as time-based task lifetimes instead of number of event based\r\n(all) in conjunction with a pauseAfterRead flag in KafkaIOConfig, provides a framework to enable leader/follower capabilities, where followers will pause when they are done reading their offsets until the leader assigns a new set of ending offsets\r\n\r\n","created_at":"2016-03-25T02:17:24Z","updated_at":"2016-04-15T01:21:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"23611e78f994e92b13714a7eca7803c47ae580aa","assignee":null,"milestone":{"url":"https://api.github.com/repos/druid-io/druid/milestones/18","html_url":"https://github.com/druid-io/druid/milestones/0.9.1","labels_url":"https://api.github.com/repos/druid-io/druid/milestones/18/labels","id":1526819,"number":18,"title":"0.9.1","description":"","creator":{"login":"fjy","id":428325,"avatar_url":"https://avatars.githubusercontent.com/u/428325?v=3","gravatar_id":"","url":"https://api.github.com/users/fjy","html_url":"https://github.com/fjy","followers_url":"https://api.github.com/users/fjy/followers","following_url":"https://api.github.com/users/fjy/following{/other_user}","gists_url":"https://api.github.com/users/fjy/gists{/gist_id}","starred_url":"https://api.github.com/users/fjy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fjy/subscriptions","organizations_url":"https://api.github.com/users/fjy/orgs","repos_url":"https://api.github.com/users/fjy/repos","events_url":"https://api.github.com/users/fjy/events{/privacy}","received_events_url":"https://api.github.com/users/fjy/received_events","type":"User","site_admin":false},"open_issues":24,"closed_issues":174,"state":"open","created_at":"2016-01-20T19:04:22Z","updated_at":"2016-04-14T00:27:16Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/druid-io/druid/pulls/2730/commits","review_comments_url":"https://api.github.com/repos/druid-io/druid/pulls/2730/comments","review_comment_url":"https://api.github.com/repos/druid-io/druid/pulls/comments{/number}","comments_url":"https://api.github.com/repos/druid-io/druid/issues/2730/comments","statuses_url":"https://api.github.com/repos/druid-io/druid/statuses/65c6a1c5e709d7a99a5daacb47830827b0ae620c","head":{"label":"dclim:kafka-index-task-endpoints","ref":"kafka-index-task-endpoints","sha":"65c6a1c5e709d7a99a5daacb47830827b0ae620c","user":{"login":"dclim","id":11050882,"avatar_url":"https://avatars.githubusercontent.com/u/11050882?v=3","gravatar_id":"","url":"https://api.github.com/users/dclim","html_url":"https://github.com/dclim","followers_url":"https://api.github.com/users/dclim/followers","following_url":"https://api.github.com/users/dclim/following{/other_user}","gists_url":"https://api.github.com/users/dclim/gists{/gist_id}","starred_url":"https://api.github.com/users/dclim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dclim/subscriptions","organizations_url":"https://api.github.com/users/dclim/orgs","repos_url":"https://api.github.com/users/dclim/repos","events_url":"https://api.github.com/users/dclim/events{/privacy}","received_events_url":"https://api.github.com/users/dclim/received_events","type":"User","site_admin":false},"repo":{"id":42546365,"name":"druid","full_name":"dclim/druid","owner":{"login":"dclim","id":11050882,"avatar_url":"https://avatars.githubusercontent.com/u/11050882?v=3","gravatar_id":"","url":"https://api.github.com/users/dclim","html_url":"https://github.com/dclim","followers_url":"https://api.github.com/users/dclim/followers","following_url":"https://api.github.com/users/dclim/following{/other_user}","gists_url":"https://api.github.com/users/dclim/gists{/gist_id}","starred_url":"https://api.github.com/users/dclim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dclim/subscriptions","organizations_url":"https://api.github.com/users/dclim/orgs","repos_url":"https://api.github.com/users/dclim/repos","events_url":"https://api.github.com/users/dclim/events{/privacy}","received_events_url":"https://api.github.com/users/dclim/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dclim/druid","description":"Column oriented distributed data store ideal for powering interactive applications","fork":true,"url":"https://api.github.com/repos/dclim/druid","forks_url":"https://api.github.com/repos/dclim/druid/forks","keys_url":"https://api.github.com/repos/dclim/druid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dclim/druid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dclim/druid/teams","hooks_url":"https://api.github.com/repos/dclim/druid/hooks","issue_events_url":"https://api.github.com/repos/dclim/druid/issues/events{/number}","events_url":"https://api.github.com/repos/dclim/druid/events","assignees_url":"https://api.github.com/repos/dclim/druid/assignees{/user}","branches_url":"https://api.github.com/repos/dclim/druid/branches{/branch}","tags_url":"https://api.github.com/repos/dclim/druid/tags","blobs_url":"https://api.github.com/repos/dclim/druid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dclim/druid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dclim/druid/git/refs{/sha}","trees_url":"https://api.github.com/repos/dclim/druid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dclim/druid/statuses/{sha}","languages_url":"https://api.github.com/repos/dclim/druid/languages","stargazers_url":"https://api.github.com/repos/dclim/druid/stargazers","contributors_url":"https://api.github.com/repos/dclim/druid/contributors","subscribers_url":"https://api.github.com/repos/dclim/druid/subscribers","subscription_url":"https://api.github.com/repos/dclim/druid/subscription","commits_url":"https://api.github.com/repos/dclim/druid/commits{/sha}","git_commits_url":"https://api.github.com/repos/dclim/druid/git/commits{/sha}","comments_url":"https://api.github.com/repos/dclim/druid/comments{/number}","issue_comment_url":"https://api.github.com/repos/dclim/druid/issues/comments{/number}","contents_url":"https://api.github.com/repos/dclim/druid/contents/{+path}","compare_url":"https://api.github.com/repos/dclim/druid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dclim/druid/merges","archive_url":"https://api.github.com/repos/dclim/druid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dclim/druid/downloads","issues_url":"https://api.github.com/repos/dclim/druid/issues{/number}","pulls_url":"https://api.github.com/repos/dclim/druid/pulls{/number}","milestones_url":"https://api.github.com/repos/dclim/druid/milestones{/number}","notifications_url":"https://api.github.com/repos/dclim/druid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dclim/druid/labels{/name}","releases_url":"https://api.github.com/repos/dclim/druid/releases{/id}","deployments_url":"https://api.github.com/repos/dclim/druid/deployments","created_at":"2015-09-15T21:02:07Z","updated_at":"2016-02-01T17:26:20Z","pushed_at":"2016-04-14T20:52:29Z","git_url":"git://github.com/dclim/druid.git","ssh_url":"git@github.com:dclim/druid.git","clone_url":"https://github.com/dclim/druid.git","svn_url":"https://github.com/dclim/druid","homepage":"http://druid.io","size":104939,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"druid-io:master","ref":"master","sha":"a26134575bea28cf4656e3c277984e7da307c500","user":{"login":"druid-io","id":4203474,"avatar_url":"https://avatars.githubusercontent.com/u/4203474?v=3","gravatar_id":"","url":"https://api.github.com/users/druid-io","html_url":"https://github.com/druid-io","followers_url":"https://api.github.com/users/druid-io/followers","following_url":"https://api.github.com/users/druid-io/following{/other_user}","gists_url":"https://api.github.com/users/druid-io/gists{/gist_id}","starred_url":"https://api.github.com/users/druid-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/druid-io/subscriptions","organizations_url":"https://api.github.com/users/druid-io/orgs","repos_url":"https://api.github.com/users/druid-io/repos","events_url":"https://api.github.com/users/druid-io/events{/privacy}","received_events_url":"https://api.github.com/users/druid-io/received_events","type":"Organization","site_admin":false},"repo":{"id":6358188,"name":"druid","full_name":"druid-io/druid","owner":{"login":"druid-io","id":4203474,"avatar_url":"https://avatars.githubusercontent.com/u/4203474?v=3","gravatar_id":"","url":"https://api.github.com/users/druid-io","html_url":"https://github.com/druid-io","followers_url":"https://api.github.com/users/druid-io/followers","following_url":"https://api.github.com/users/druid-io/following{/other_user}","gists_url":"https://api.github.com/users/druid-io/gists{/gist_id}","starred_url":"https://api.github.com/users/druid-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/druid-io/subscriptions","organizations_url":"https://api.github.com/users/druid-io/orgs","repos_url":"https://api.github.com/users/druid-io/repos","events_url":"https://api.github.com/users/druid-io/events{/privacy}","received_events_url":"https://api.github.com/users/druid-io/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/druid-io/druid","description":"Column oriented distributed data store ideal for powering interactive applications","fork":false,"url":"https://api.github.com/repos/druid-io/druid","forks_url":"https://api.github.com/repos/druid-io/druid/forks","keys_url":"https://api.github.com/repos/druid-io/druid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/druid-io/druid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/druid-io/druid/teams","hooks_url":"https://api.github.com/repos/druid-io/druid/hooks","issue_events_url":"https://api.github.com/repos/druid-io/druid/issues/events{/number}","events_url":"https://api.github.com/repos/druid-io/druid/events","assignees_url":"https://api.github.com/repos/druid-io/druid/assignees{/user}","branches_url":"https://api.github.com/repos/druid-io/druid/branches{/branch}","tags_url":"https://api.github.com/repos/druid-io/druid/tags","blobs_url":"https://api.github.com/repos/druid-io/druid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/druid-io/druid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/druid-io/druid/git/refs{/sha}","trees_url":"https://api.github.com/repos/druid-io/druid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/druid-io/druid/statuses/{sha}","languages_url":"https://api.github.com/repos/druid-io/druid/languages","stargazers_url":"https://api.github.com/repos/druid-io/druid/stargazers","contributors_url":"https://api.github.com/repos/druid-io/druid/contributors","subscribers_url":"https://api.github.com/repos/druid-io/druid/subscribers","subscription_url":"https://api.github.com/repos/druid-io/druid/subscription","commits_url":"https://api.github.com/repos/druid-io/druid/commits{/sha}","git_commits_url":"https://api.github.com/repos/druid-io/druid/git/commits{/sha}","comments_url":"https://api.github.com/repos/druid-io/druid/comments{/number}","issue_comment_url":"https://api.github.com/repos/druid-io/druid/issues/comments{/number}","contents_url":"https://api.github.com/repos/druid-io/druid/contents/{+path}","compare_url":"https://api.github.com/repos/druid-io/druid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/druid-io/druid/merges","archive_url":"https://api.github.com/repos/druid-io/druid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/druid-io/druid/downloads","issues_url":"https://api.github.com/repos/druid-io/druid/issues{/number}","pulls_url":"https://api.github.com/repos/druid-io/druid/pulls{/number}","milestones_url":"https://api.github.com/repos/druid-io/druid/milestones{/number}","notifications_url":"https://api.github.com/repos/druid-io/druid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/druid-io/druid/labels{/name}","releases_url":"https://api.github.com/repos/druid-io/druid/releases{/id}","deployments_url":"https://api.github.com/repos/druid-io/druid/deployments","created_at":"2012-10-23T19:08:07Z","updated_at":"2016-04-15T01:19:30Z","pushed_at":"2016-04-14T22:41:09Z","git_url":"git://github.com/druid-io/druid.git","ssh_url":"git@github.com:druid-io/druid.git","clone_url":"https://github.com/druid-io/druid.git","svn_url":"https://github.com/druid-io/druid","homepage":"http://druid.io","size":128877,"stargazers_count":3036,"watchers_count":3036,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":669,"mirror_url":null,"open_issues_count":406,"forks":669,"open_issues":406,"watchers":3036,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/druid-io/druid/pulls/2730"},"html":{"href":"https://github.com/druid-io/druid/pull/2730"},"issue":{"href":"https://api.github.com/repos/druid-io/druid/issues/2730"},"comments":{"href":"https://api.github.com/repos/druid-io/druid/issues/2730/comments"},"review_comments":{"href":"https://api.github.com/repos/druid-io/druid/pulls/2730/comments"},"review_comment":{"href":"https://api.github.com/repos/druid-io/druid/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/druid-io/druid/pulls/2730/commits"},"statuses":{"href":"https://api.github.com/repos/druid-io/druid/statuses/65c6a1c5e709d7a99a5daacb47830827b0ae620c"}}}}