{"action":"created","comment":{"url":"https://api.github.com/repos/apache/kafka/pulls/comments/44831451","id":44831451,"diff_hunk":"@@ -92,55 +174,40 @@ def _worker(self, idx, node):\n \n         for line in node.account.ssh_capture(cmd):\n             event = self.try_parse_json(line.strip())\n-            if event is not None:\n-                with self.lock:\n-                    name = event[\"name\"]\n-                    if name == \"shutdown_complete\":\n-                        self._handle_shutdown_complete(node)\n-                    if name == \"offsets_committed\":\n-                        self._handle_offsets_committed(node, event)\n-                    elif name == \"records_consumed\":\n-                        self._handle_records_consumed(node, event)\n-                    elif name == \"partitions_revoked\":\n-                        self._handle_partitions_revoked(node, event)\n-                    elif name == \"partitions_assigned\":\n-                        self._handle_partitions_assigned(node, event)\n-\n-    def _handle_shutdown_complete(self, node):\n-        if node in self.joined:\n-            self.joined.remove(node)\n-\n-    def _handle_offsets_committed(self, node, event):\n-        if event[\"success\"]:\n-            for offset_commit in event[\"offsets\"]:\n-                topic = offset_commit[\"topic\"]\n-                partition = offset_commit[\"partition\"]\n-                tp = TopicPartition(topic, partition)\n-                self.committed_offsets[tp] = offset_commit[\"offset\"]\n-\n-    def _handle_records_consumed(self, node, event):\n-        for topic_partition in event[\"partitions\"]:\n-            topic = topic_partition[\"topic\"]\n-            partition = topic_partition[\"partition\"]\n-            tp = TopicPartition(topic, partition)\n-            self.consumed_positions[tp] = topic_partition[\"maxOffset\"] + 1\n-        self.total_records += event[\"count\"]\n-\n-    def _handle_partitions_revoked(self, node, event):\n-        self.revoked_count += 1\n-        self.assignment[node] = []\n-        if node in self.joined:\n-            self.joined.remove(node)\n-\n-    def _handle_partitions_assigned(self, node, event):\n-        self.assigned_count += 1\n-        self.joined.add(node)\n-        assignment =[]\n-        for topic_partition in event[\"partitions\"]:\n-            topic = topic_partition[\"topic\"]\n-            partition = topic_partition[\"partition\"]\n-            assignment.append(TopicPartition(topic, partition))\n-        self.assignment[node] = assignment\n+            with self.lock:\n+                name = event[\"name\"]\n+                if name == \"shutdown_complete\":\n+                    handler.handle_shutdown_complete()\n+                if name == \"offsets_committed\":\n+                    handler.handle_offsets_committed(event)\n+                    self._update_global_committed(event)\n+                elif name == \"records_consumed\":\n+                    handler.handle_records_consumed(event)\n+                    self._update_global_position(event)\n+                elif name == \"partitions_revoked\":\n+                    handler.handle_partitions_revoked(event)\n+                elif name == \"partitions_assigned\":\n+                    handler.handle_partitions_assigned(event)\n+\n+    def _update_global_position(self, consumed_event):\n+        for consumed_partition in consumed_event[\"partitions\"]:\n+            tp = TopicPartition(consumed_partition[\"topic\"], consumed_partition[\"partition\"])\n+            if tp in self.global_committed:\n+                # verify that the position never gets behind the current commit.\n+                # it would be nice to also verify that the position increases monotonically","path":"tests/kafkatest/services/verifiable_consumer.py","position":214,"original_position":214,"commit_id":"695f67e9ba4bde52a1d28b02d104cf8097e9d4f3","original_commit_id":"695f67e9ba4bde52a1d28b02d104cf8097e9d4f3","user":{"login":"hachikuji","id":12502538,"avatar_url":"https://avatars.githubusercontent.com/u/12502538?v=3","gravatar_id":"","url":"https://api.github.com/users/hachikuji","html_url":"https://github.com/hachikuji","followers_url":"https://api.github.com/users/hachikuji/followers","following_url":"https://api.github.com/users/hachikuji/following{/other_user}","gists_url":"https://api.github.com/users/hachikuji/gists{/gist_id}","starred_url":"https://api.github.com/users/hachikuji/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hachikuji/subscriptions","organizations_url":"https://api.github.com/users/hachikuji/orgs","repos_url":"https://api.github.com/users/hachikuji/repos","events_url":"https://api.github.com/users/hachikuji/events{/privacy}","received_events_url":"https://api.github.com/users/hachikuji/received_events","type":"User","site_admin":false},"body":"Yeah, good point.","created_at":"2015-11-13T20:40:57Z","updated_at":"2015-11-13T20:40:57Z","html_url":"https://github.com/apache/kafka/pull/500#discussion_r44831451","pull_request_url":"https://api.github.com/repos/apache/kafka/pulls/500","_links":{"self":{"href":"https://api.github.com/repos/apache/kafka/pulls/comments/44831451"},"html":{"href":"https://github.com/apache/kafka/pull/500#discussion_r44831451"},"pull_request":{"href":"https://api.github.com/repos/apache/kafka/pulls/500"}}},"pull_request":{"url":"https://api.github.com/repos/apache/kafka/pulls/500","id":50452751,"html_url":"https://github.com/apache/kafka/pull/500","diff_url":"https://github.com/apache/kafka/pull/500.diff","patch_url":"https://github.com/apache/kafka/pull/500.patch","issue_url":"https://api.github.com/repos/apache/kafka/issues/500","number":500,"state":"open","locked":false,"title":"KAFKA-2812: improve consumer integration tests","user":{"login":"hachikuji","id":12502538,"avatar_url":"https://avatars.githubusercontent.com/u/12502538?v=3","gravatar_id":"","url":"https://api.github.com/users/hachikuji","html_url":"https://github.com/hachikuji","followers_url":"https://api.github.com/users/hachikuji/followers","following_url":"https://api.github.com/users/hachikuji/following{/other_user}","gists_url":"https://api.github.com/users/hachikuji/gists{/gist_id}","starred_url":"https://api.github.com/users/hachikuji/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hachikuji/subscriptions","organizations_url":"https://api.github.com/users/hachikuji/orgs","repos_url":"https://api.github.com/users/hachikuji/repos","events_url":"https://api.github.com/users/hachikuji/events{/privacy}","received_events_url":"https://api.github.com/users/hachikuji/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-11-11T23:38:36Z","updated_at":"2015-11-13T20:40:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"678da1019c2b6e6c98fda70ac35101946a8a3e9c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/kafka/pulls/500/commits","review_comments_url":"https://api.github.com/repos/apache/kafka/pulls/500/comments","review_comment_url":"https://api.github.com/repos/apache/kafka/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/kafka/issues/500/comments","statuses_url":"https://api.github.com/repos/apache/kafka/statuses/695f67e9ba4bde52a1d28b02d104cf8097e9d4f3","head":{"label":"hachikuji:KAFKA-2812","ref":"KAFKA-2812","sha":"695f67e9ba4bde52a1d28b02d104cf8097e9d4f3","user":{"login":"hachikuji","id":12502538,"avatar_url":"https://avatars.githubusercontent.com/u/12502538?v=3","gravatar_id":"","url":"https://api.github.com/users/hachikuji","html_url":"https://github.com/hachikuji","followers_url":"https://api.github.com/users/hachikuji/followers","following_url":"https://api.github.com/users/hachikuji/following{/other_user}","gists_url":"https://api.github.com/users/hachikuji/gists{/gist_id}","starred_url":"https://api.github.com/users/hachikuji/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hachikuji/subscriptions","organizations_url":"https://api.github.com/users/hachikuji/orgs","repos_url":"https://api.github.com/users/hachikuji/repos","events_url":"https://api.github.com/users/hachikuji/events{/privacy}","received_events_url":"https://api.github.com/users/hachikuji/received_events","type":"User","site_admin":false},"repo":{"id":35842084,"name":"kafka","full_name":"hachikuji/kafka","owner":{"login":"hachikuji","id":12502538,"avatar_url":"https://avatars.githubusercontent.com/u/12502538?v=3","gravatar_id":"","url":"https://api.github.com/users/hachikuji","html_url":"https://github.com/hachikuji","followers_url":"https://api.github.com/users/hachikuji/followers","following_url":"https://api.github.com/users/hachikuji/following{/other_user}","gists_url":"https://api.github.com/users/hachikuji/gists{/gist_id}","starred_url":"https://api.github.com/users/hachikuji/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hachikuji/subscriptions","organizations_url":"https://api.github.com/users/hachikuji/orgs","repos_url":"https://api.github.com/users/hachikuji/repos","events_url":"https://api.github.com/users/hachikuji/events{/privacy}","received_events_url":"https://api.github.com/users/hachikuji/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hachikuji/kafka","description":"Mirror of Apache Kafka","fork":true,"url":"https://api.github.com/repos/hachikuji/kafka","forks_url":"https://api.github.com/repos/hachikuji/kafka/forks","keys_url":"https://api.github.com/repos/hachikuji/kafka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hachikuji/kafka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hachikuji/kafka/teams","hooks_url":"https://api.github.com/repos/hachikuji/kafka/hooks","issue_events_url":"https://api.github.com/repos/hachikuji/kafka/issues/events{/number}","events_url":"https://api.github.com/repos/hachikuji/kafka/events","assignees_url":"https://api.github.com/repos/hachikuji/kafka/assignees{/user}","branches_url":"https://api.github.com/repos/hachikuji/kafka/branches{/branch}","tags_url":"https://api.github.com/repos/hachikuji/kafka/tags","blobs_url":"https://api.github.com/repos/hachikuji/kafka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hachikuji/kafka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hachikuji/kafka/git/refs{/sha}","trees_url":"https://api.github.com/repos/hachikuji/kafka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hachikuji/kafka/statuses/{sha}","languages_url":"https://api.github.com/repos/hachikuji/kafka/languages","stargazers_url":"https://api.github.com/repos/hachikuji/kafka/stargazers","contributors_url":"https://api.github.com/repos/hachikuji/kafka/contributors","subscribers_url":"https://api.github.com/repos/hachikuji/kafka/subscribers","subscription_url":"https://api.github.com/repos/hachikuji/kafka/subscription","commits_url":"https://api.github.com/repos/hachikuji/kafka/commits{/sha}","git_commits_url":"https://api.github.com/repos/hachikuji/kafka/git/commits{/sha}","comments_url":"https://api.github.com/repos/hachikuji/kafka/comments{/number}","issue_comment_url":"https://api.github.com/repos/hachikuji/kafka/issues/comments{/number}","contents_url":"https://api.github.com/repos/hachikuji/kafka/contents/{+path}","compare_url":"https://api.github.com/repos/hachikuji/kafka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hachikuji/kafka/merges","archive_url":"https://api.github.com/repos/hachikuji/kafka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hachikuji/kafka/downloads","issues_url":"https://api.github.com/repos/hachikuji/kafka/issues{/number}","pulls_url":"https://api.github.com/repos/hachikuji/kafka/pulls{/number}","milestones_url":"https://api.github.com/repos/hachikuji/kafka/milestones{/number}","notifications_url":"https://api.github.com/repos/hachikuji/kafka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hachikuji/kafka/labels{/name}","releases_url":"https://api.github.com/repos/hachikuji/kafka/releases{/id}","created_at":"2015-05-18T20:54:26Z","updated_at":"2015-05-18T20:54:28Z","pushed_at":"2015-11-13T18:54:00Z","git_url":"git://github.com/hachikuji/kafka.git","ssh_url":"git@github.com:hachikuji/kafka.git","clone_url":"https://github.com/hachikuji/kafka.git","svn_url":"https://github.com/hachikuji/kafka","homepage":null,"size":25348,"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.2"}},"base":{"label":"apache:trunk","ref":"trunk","sha":"a8ccdc6154a1e10982cb80df82e8661903eb9ae5","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-11-13T19:23:08Z","pushed_at":"2015-11-13T20:15:01Z","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":43404,"stargazers_count":2206,"watchers_count":2206,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1299,"mirror_url":"git://git.apache.org/kafka.git","open_issues_count":103,"forks":1299,"open_issues":103,"watchers":2206,"default_branch":"trunk"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/kafka/pulls/500"},"html":{"href":"https://github.com/apache/kafka/pull/500"},"issue":{"href":"https://api.github.com/repos/apache/kafka/issues/500"},"comments":{"href":"https://api.github.com/repos/apache/kafka/issues/500/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/kafka/pulls/500/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/kafka/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/kafka/pulls/500/commits"},"statuses":{"href":"https://api.github.com/repos/apache/kafka/statuses/695f67e9ba4bde52a1d28b02d104cf8097e9d4f3"}}}}