{"action":"created","comment":{"url":"https://api.github.com/repos/apache/kafka/pulls/comments/39088701","id":39088701,"diff_hunk":"@@ -119,6 +123,11 @@ public Fetcher(ConsumerNetworkClient client,\n      * @param cluster The current cluster metadata\n      */\n     public void initFetches(Cluster cluster) {\n+        // Don't initiate fetch if we already have records available from previous fetchRequest\n+        // This may happen when there is OffsetOutOfRange exception from previous fetchRequest\n+        if (!records.isEmpty())","path":"clients/src/main/java/org/apache/kafka/clients/consumer/internals/Fetcher.java","position":31,"original_position":31,"commit_id":"4fb44f97f8a2657d41d4678ce3aa63314ef351ff","original_commit_id":"4fb44f97f8a2657d41d4678ce3aa63314ef351ff","user":{"login":"lindong28","id":5873403,"avatar_url":"https://avatars.githubusercontent.com/u/5873403?v=3","gravatar_id":"","url":"https://api.github.com/users/lindong28","html_url":"https://github.com/lindong28","followers_url":"https://api.github.com/users/lindong28/followers","following_url":"https://api.github.com/users/lindong28/following{/other_user}","gists_url":"https://api.github.com/users/lindong28/gists{/gist_id}","starred_url":"https://api.github.com/users/lindong28/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lindong28/subscriptions","organizations_url":"https://api.github.com/users/lindong28/orgs","repos_url":"https://api.github.com/users/lindong28/repos","events_url":"https://api.github.com/users/lindong28/events{/privacy}","received_events_url":"https://api.github.com/users/lindong28/received_events","type":"User","site_admin":false},"body":"I think we both agree that buffering the fetched data will require much more thought and effort than throwing away data and re-fetch. Can you elaborate the benefit of buffering fetched data over throwing away data, that makes these effort worthwhile?\r\n\r\nSpecifically, could you explain why it is more natural to buffer the data? I think throwing away data is more intuitive -- user calls poll(); there is exception; user handles it; and try poll() again. It is common, for example in batch processing system, to start your job all over after exception and failure handling. Starting from where you left is really an optimization that comes later in time.\r\n\r\nHere is another reason why buffering the fetched data can be problematic. Suppose the poll() caused exception, \r\n\r\n\r\n\r\n","created_at":"2015-09-09T20:01:01Z","updated_at":"2015-09-09T20:01:01Z","html_url":"https://github.com/apache/kafka/pull/118#discussion_r39088701","pull_request_url":"https://api.github.com/repos/apache/kafka/pulls/118","_links":{"self":{"href":"https://api.github.com/repos/apache/kafka/pulls/comments/39088701"},"html":{"href":"https://github.com/apache/kafka/pull/118#discussion_r39088701"},"pull_request":{"href":"https://api.github.com/repos/apache/kafka/pulls/118"}}},"pull_request":{"url":"https://api.github.com/repos/apache/kafka/pulls/118","id":41740083,"html_url":"https://github.com/apache/kafka/pull/118","diff_url":"https://github.com/apache/kafka/pull/118.diff","patch_url":"https://github.com/apache/kafka/pull/118.patch","issue_url":"https://api.github.com/repos/apache/kafka/issues/118","number":118,"state":"open","locked":false,"title":"KAFKA-2390; OffsetOutOfRangeException should contain the Offset and Partition info.","user":{"login":"lindong28","id":5873403,"avatar_url":"https://avatars.githubusercontent.com/u/5873403?v=3","gravatar_id":"","url":"https://api.github.com/users/lindong28","html_url":"https://github.com/lindong28","followers_url":"https://api.github.com/users/lindong28/followers","following_url":"https://api.github.com/users/lindong28/following{/other_user}","gists_url":"https://api.github.com/users/lindong28/gists{/gist_id}","starred_url":"https://api.github.com/users/lindong28/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lindong28/subscriptions","organizations_url":"https://api.github.com/users/lindong28/orgs","repos_url":"https://api.github.com/users/lindong28/repos","events_url":"https://api.github.com/users/lindong28/events{/privacy}","received_events_url":"https://api.github.com/users/lindong28/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-08-06T00:06:40Z","updated_at":"2015-09-09T20:01:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3616268f2011dcbeed7471b350ef639e078a08f5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/kafka/pulls/118/commits","review_comments_url":"https://api.github.com/repos/apache/kafka/pulls/118/comments","review_comment_url":"https://api.github.com/repos/apache/kafka/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/kafka/issues/118/comments","statuses_url":"https://api.github.com/repos/apache/kafka/statuses/4fb44f97f8a2657d41d4678ce3aa63314ef351ff","head":{"label":"lindong28:KAFKA-2390","ref":"KAFKA-2390","sha":"4fb44f97f8a2657d41d4678ce3aa63314ef351ff","user":{"login":"lindong28","id":5873403,"avatar_url":"https://avatars.githubusercontent.com/u/5873403?v=3","gravatar_id":"","url":"https://api.github.com/users/lindong28","html_url":"https://github.com/lindong28","followers_url":"https://api.github.com/users/lindong28/followers","following_url":"https://api.github.com/users/lindong28/following{/other_user}","gists_url":"https://api.github.com/users/lindong28/gists{/gist_id}","starred_url":"https://api.github.com/users/lindong28/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lindong28/subscriptions","organizations_url":"https://api.github.com/users/lindong28/orgs","repos_url":"https://api.github.com/users/lindong28/repos","events_url":"https://api.github.com/users/lindong28/events{/privacy}","received_events_url":"https://api.github.com/users/lindong28/received_events","type":"User","site_admin":false},"repo":{"id":21054638,"name":"kafka","full_name":"lindong28/kafka","owner":{"login":"lindong28","id":5873403,"avatar_url":"https://avatars.githubusercontent.com/u/5873403?v=3","gravatar_id":"","url":"https://api.github.com/users/lindong28","html_url":"https://github.com/lindong28","followers_url":"https://api.github.com/users/lindong28/followers","following_url":"https://api.github.com/users/lindong28/following{/other_user}","gists_url":"https://api.github.com/users/lindong28/gists{/gist_id}","starred_url":"https://api.github.com/users/lindong28/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lindong28/subscriptions","organizations_url":"https://api.github.com/users/lindong28/orgs","repos_url":"https://api.github.com/users/lindong28/repos","events_url":"https://api.github.com/users/lindong28/events{/privacy}","received_events_url":"https://api.github.com/users/lindong28/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lindong28/kafka","description":"Mirror of Apache Kafka","fork":true,"url":"https://api.github.com/repos/lindong28/kafka","forks_url":"https://api.github.com/repos/lindong28/kafka/forks","keys_url":"https://api.github.com/repos/lindong28/kafka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lindong28/kafka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lindong28/kafka/teams","hooks_url":"https://api.github.com/repos/lindong28/kafka/hooks","issue_events_url":"https://api.github.com/repos/lindong28/kafka/issues/events{/number}","events_url":"https://api.github.com/repos/lindong28/kafka/events","assignees_url":"https://api.github.com/repos/lindong28/kafka/assignees{/user}","branches_url":"https://api.github.com/repos/lindong28/kafka/branches{/branch}","tags_url":"https://api.github.com/repos/lindong28/kafka/tags","blobs_url":"https://api.github.com/repos/lindong28/kafka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lindong28/kafka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lindong28/kafka/git/refs{/sha}","trees_url":"https://api.github.com/repos/lindong28/kafka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lindong28/kafka/statuses/{sha}","languages_url":"https://api.github.com/repos/lindong28/kafka/languages","stargazers_url":"https://api.github.com/repos/lindong28/kafka/stargazers","contributors_url":"https://api.github.com/repos/lindong28/kafka/contributors","subscribers_url":"https://api.github.com/repos/lindong28/kafka/subscribers","subscription_url":"https://api.github.com/repos/lindong28/kafka/subscription","commits_url":"https://api.github.com/repos/lindong28/kafka/commits{/sha}","git_commits_url":"https://api.github.com/repos/lindong28/kafka/git/commits{/sha}","comments_url":"https://api.github.com/repos/lindong28/kafka/comments{/number}","issue_comment_url":"https://api.github.com/repos/lindong28/kafka/issues/comments{/number}","contents_url":"https://api.github.com/repos/lindong28/kafka/contents/{+path}","compare_url":"https://api.github.com/repos/lindong28/kafka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lindong28/kafka/merges","archive_url":"https://api.github.com/repos/lindong28/kafka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lindong28/kafka/downloads","issues_url":"https://api.github.com/repos/lindong28/kafka/issues{/number}","pulls_url":"https://api.github.com/repos/lindong28/kafka/pulls{/number}","milestones_url":"https://api.github.com/repos/lindong28/kafka/milestones{/number}","notifications_url":"https://api.github.com/repos/lindong28/kafka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lindong28/kafka/labels{/name}","releases_url":"https://api.github.com/repos/lindong28/kafka/releases{/id}","created_at":"2014-06-20T22:40:57Z","updated_at":"2014-06-20T22:40:58Z","pushed_at":"2015-09-09T03:14:50Z","git_url":"git://github.com/lindong28/kafka.git","ssh_url":"git@github.com:lindong28/kafka.git","clone_url":"https://github.com/lindong28/kafka.git","svn_url":"https://github.com/lindong28/kafka","homepage":null,"size":21693,"stargazers_count":0,"watchers_count":0,"language":"Scala","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":"0.8.1"}},"base":{"label":"apache:trunk","ref":"trunk","sha":"f25731265ef63e5440a188b3e5553c31fb9a397b","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":2211243,"name":"kafka","full_name":"apache/kafka","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/kafka","description":"Mirror of Apache Kafka","fork":false,"url":"https://api.github.com/repos/apache/kafka","forks_url":"https://api.github.com/repos/apache/kafka/forks","keys_url":"https://api.github.com/repos/apache/kafka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/kafka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/kafka/teams","hooks_url":"https://api.github.com/repos/apache/kafka/hooks","issue_events_url":"https://api.github.com/repos/apache/kafka/issues/events{/number}","events_url":"https://api.github.com/repos/apache/kafka/events","assignees_url":"https://api.github.com/repos/apache/kafka/assignees{/user}","branches_url":"https://api.github.com/repos/apache/kafka/branches{/branch}","tags_url":"https://api.github.com/repos/apache/kafka/tags","blobs_url":"https://api.github.com/repos/apache/kafka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/kafka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/kafka/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/kafka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/kafka/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/kafka/languages","stargazers_url":"https://api.github.com/repos/apache/kafka/stargazers","contributors_url":"https://api.github.com/repos/apache/kafka/contributors","subscribers_url":"https://api.github.com/repos/apache/kafka/subscribers","subscription_url":"https://api.github.com/repos/apache/kafka/subscription","commits_url":"https://api.github.com/repos/apache/kafka/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/kafka/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/kafka/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/kafka/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/kafka/contents/{+path}","compare_url":"https://api.github.com/repos/apache/kafka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/kafka/merges","archive_url":"https://api.github.com/repos/apache/kafka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/kafka/downloads","issues_url":"https://api.github.com/repos/apache/kafka/issues{/number}","pulls_url":"https://api.github.com/repos/apache/kafka/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/kafka/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/kafka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/kafka/labels{/name}","releases_url":"https://api.github.com/repos/apache/kafka/releases{/id}","created_at":"2011-08-15T18:06:16Z","updated_at":"2015-09-09T15:58:14Z","pushed_at":"2015-09-09T20:00:15Z","git_url":"git://github.com/apache/kafka.git","ssh_url":"git@github.com:apache/kafka.git","clone_url":"https://github.com/apache/kafka.git","svn_url":"https://github.com/apache/kafka","homepage":null,"size":33192,"stargazers_count":1890,"watchers_count":1890,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1136,"mirror_url":"git://git.apache.org/kafka.git","open_issues_count":78,"forks":1136,"open_issues":78,"watchers":1890,"default_branch":"trunk"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/kafka/pulls/118"},"html":{"href":"https://github.com/apache/kafka/pull/118"},"issue":{"href":"https://api.github.com/repos/apache/kafka/issues/118"},"comments":{"href":"https://api.github.com/repos/apache/kafka/issues/118/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/kafka/pulls/118/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/kafka/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/kafka/pulls/118/commits"},"statuses":{"href":"https://api.github.com/repos/apache/kafka/statuses/4fb44f97f8a2657d41d4678ce3aa63314ef351ff"}}}}