{"action":"opened","number":905,"pull_request":{"url":"https://api.github.com/repos/dpkp/kafka-python/pulls/905","id":96708392,"html_url":"https://github.com/dpkp/kafka-python/pull/905","diff_url":"https://github.com/dpkp/kafka-python/pull/905.diff","patch_url":"https://github.com/dpkp/kafka-python/pull/905.patch","issue_url":"https://api.github.com/repos/dpkp/kafka-python/issues/905","number":905,"state":"open","locked":false,"title":"Sort partitions before calling partitioner","user":{"login":"ms7s","id":7591391,"avatar_url":"https://avatars.githubusercontent.com/u/7591391?v=3","gravatar_id":"","url":"https://api.github.com/users/ms7s","html_url":"https://github.com/ms7s","followers_url":"https://api.github.com/users/ms7s/followers","following_url":"https://api.github.com/users/ms7s/following{/other_user}","gists_url":"https://api.github.com/users/ms7s/gists{/gist_id}","starred_url":"https://api.github.com/users/ms7s/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ms7s/subscriptions","organizations_url":"https://api.github.com/users/ms7s/orgs","repos_url":"https://api.github.com/users/ms7s/repos","events_url":"https://api.github.com/users/ms7s/events{/privacy}","received_events_url":"https://api.github.com/users/ms7s/received_events","type":"User","site_admin":false},"body":"Current partitioners assume that the partitions are sorted according\r\nto partition ID in all_partitions. However, this is not guaranteed\r\nin the KafkaProducer implementation as the values that are passed\r\ncome from a set. Sets are not guaranteed to iterate values in any\r\nparticular order, so we need to sort the values before passing\r\nthem further along.\r\n\r\nBefore this change, the code depended on internal implementation of\r\nPython interpreters. In CPython 3.5 and lower it seems that integers\r\nare returned in sorted order from sets so the code appears to work.\r\nIn PyPy and CPython 3.6, sets and dictionaries preserve the order\r\nof insertions [1] which means that the code may not work in these\r\nenvironments (I have not tested this). As far as I could find,\r\nthe order of partitions used in this case is the order that is\r\nreturned by the broker, but the documentation does not say anything\r\nabout partition order.\r\n\r\n[1] https://docs.python.org/3.6/whatsnew/3.6.html#whatsnew36-compactdict","created_at":"2016-12-06T11:40:45Z","updated_at":"2016-12-06T11:40:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bddfecc3956ae05a4c655ac23014fa68972c2279","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/dpkp/kafka-python/pulls/905/commits","review_comments_url":"https://api.github.com/repos/dpkp/kafka-python/pulls/905/comments","review_comment_url":"https://api.github.com/repos/dpkp/kafka-python/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dpkp/kafka-python/issues/905/comments","statuses_url":"https://api.github.com/repos/dpkp/kafka-python/statuses/37c766a663a95370a11964a0c81be7249a0ecf53","head":{"label":"exponea:sort-partitions","ref":"sort-partitions","sha":"37c766a663a95370a11964a0c81be7249a0ecf53","user":{"login":"exponea","id":17175175,"avatar_url":"https://avatars.githubusercontent.com/u/17175175?v=3","gravatar_id":"","url":"https://api.github.com/users/exponea","html_url":"https://github.com/exponea","followers_url":"https://api.github.com/users/exponea/followers","following_url":"https://api.github.com/users/exponea/following{/other_user}","gists_url":"https://api.github.com/users/exponea/gists{/gist_id}","starred_url":"https://api.github.com/users/exponea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/exponea/subscriptions","organizations_url":"https://api.github.com/users/exponea/orgs","repos_url":"https://api.github.com/users/exponea/repos","events_url":"https://api.github.com/users/exponea/events{/privacy}","received_events_url":"https://api.github.com/users/exponea/received_events","type":"Organization","site_admin":false},"repo":{"id":75723243,"name":"kafka-python","full_name":"exponea/kafka-python","owner":{"login":"exponea","id":17175175,"avatar_url":"https://avatars.githubusercontent.com/u/17175175?v=3","gravatar_id":"","url":"https://api.github.com/users/exponea","html_url":"https://github.com/exponea","followers_url":"https://api.github.com/users/exponea/followers","following_url":"https://api.github.com/users/exponea/following{/other_user}","gists_url":"https://api.github.com/users/exponea/gists{/gist_id}","starred_url":"https://api.github.com/users/exponea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/exponea/subscriptions","organizations_url":"https://api.github.com/users/exponea/orgs","repos_url":"https://api.github.com/users/exponea/repos","events_url":"https://api.github.com/users/exponea/events{/privacy}","received_events_url":"https://api.github.com/users/exponea/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/exponea/kafka-python","description":"Python client for Apache Kafka","fork":true,"url":"https://api.github.com/repos/exponea/kafka-python","forks_url":"https://api.github.com/repos/exponea/kafka-python/forks","keys_url":"https://api.github.com/repos/exponea/kafka-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/exponea/kafka-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/exponea/kafka-python/teams","hooks_url":"https://api.github.com/repos/exponea/kafka-python/hooks","issue_events_url":"https://api.github.com/repos/exponea/kafka-python/issues/events{/number}","events_url":"https://api.github.com/repos/exponea/kafka-python/events","assignees_url":"https://api.github.com/repos/exponea/kafka-python/assignees{/user}","branches_url":"https://api.github.com/repos/exponea/kafka-python/branches{/branch}","tags_url":"https://api.github.com/repos/exponea/kafka-python/tags","blobs_url":"https://api.github.com/repos/exponea/kafka-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/exponea/kafka-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/exponea/kafka-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/exponea/kafka-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/exponea/kafka-python/statuses/{sha}","languages_url":"https://api.github.com/repos/exponea/kafka-python/languages","stargazers_url":"https://api.github.com/repos/exponea/kafka-python/stargazers","contributors_url":"https://api.github.com/repos/exponea/kafka-python/contributors","subscribers_url":"https://api.github.com/repos/exponea/kafka-python/subscribers","subscription_url":"https://api.github.com/repos/exponea/kafka-python/subscription","commits_url":"https://api.github.com/repos/exponea/kafka-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/exponea/kafka-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/exponea/kafka-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/exponea/kafka-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/exponea/kafka-python/contents/{+path}","compare_url":"https://api.github.com/repos/exponea/kafka-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/exponea/kafka-python/merges","archive_url":"https://api.github.com/repos/exponea/kafka-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/exponea/kafka-python/downloads","issues_url":"https://api.github.com/repos/exponea/kafka-python/issues{/number}","pulls_url":"https://api.github.com/repos/exponea/kafka-python/pulls{/number}","milestones_url":"https://api.github.com/repos/exponea/kafka-python/milestones{/number}","notifications_url":"https://api.github.com/repos/exponea/kafka-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/exponea/kafka-python/labels{/name}","releases_url":"https://api.github.com/repos/exponea/kafka-python/releases{/id}","deployments_url":"https://api.github.com/repos/exponea/kafka-python/deployments","created_at":"2016-12-06T11:01:53Z","updated_at":"2016-12-06T11:01:55Z","pushed_at":"2016-12-06T11:35:43Z","git_url":"git://github.com/exponea/kafka-python.git","ssh_url":"git@github.com:exponea/kafka-python.git","clone_url":"https://github.com/exponea/kafka-python.git","svn_url":"https://github.com/exponea/kafka-python","homepage":"http://kafka-python.readthedocs.io/","size":3796,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"dpkp:master","ref":"master","sha":"010ebb53a9e3b1c4e8d69a623e4a082b5a2b9baa","user":{"login":"dpkp","id":843444,"avatar_url":"https://avatars.githubusercontent.com/u/843444?v=3","gravatar_id":"","url":"https://api.github.com/users/dpkp","html_url":"https://github.com/dpkp","followers_url":"https://api.github.com/users/dpkp/followers","following_url":"https://api.github.com/users/dpkp/following{/other_user}","gists_url":"https://api.github.com/users/dpkp/gists{/gist_id}","starred_url":"https://api.github.com/users/dpkp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpkp/subscriptions","organizations_url":"https://api.github.com/users/dpkp/orgs","repos_url":"https://api.github.com/users/dpkp/repos","events_url":"https://api.github.com/users/dpkp/events{/privacy}","received_events_url":"https://api.github.com/users/dpkp/received_events","type":"User","site_admin":false},"repo":{"id":5934517,"name":"kafka-python","full_name":"dpkp/kafka-python","owner":{"login":"dpkp","id":843444,"avatar_url":"https://avatars.githubusercontent.com/u/843444?v=3","gravatar_id":"","url":"https://api.github.com/users/dpkp","html_url":"https://github.com/dpkp","followers_url":"https://api.github.com/users/dpkp/followers","following_url":"https://api.github.com/users/dpkp/following{/other_user}","gists_url":"https://api.github.com/users/dpkp/gists{/gist_id}","starred_url":"https://api.github.com/users/dpkp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpkp/subscriptions","organizations_url":"https://api.github.com/users/dpkp/orgs","repos_url":"https://api.github.com/users/dpkp/repos","events_url":"https://api.github.com/users/dpkp/events{/privacy}","received_events_url":"https://api.github.com/users/dpkp/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dpkp/kafka-python","description":"Python client for Apache Kafka","fork":false,"url":"https://api.github.com/repos/dpkp/kafka-python","forks_url":"https://api.github.com/repos/dpkp/kafka-python/forks","keys_url":"https://api.github.com/repos/dpkp/kafka-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dpkp/kafka-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dpkp/kafka-python/teams","hooks_url":"https://api.github.com/repos/dpkp/kafka-python/hooks","issue_events_url":"https://api.github.com/repos/dpkp/kafka-python/issues/events{/number}","events_url":"https://api.github.com/repos/dpkp/kafka-python/events","assignees_url":"https://api.github.com/repos/dpkp/kafka-python/assignees{/user}","branches_url":"https://api.github.com/repos/dpkp/kafka-python/branches{/branch}","tags_url":"https://api.github.com/repos/dpkp/kafka-python/tags","blobs_url":"https://api.github.com/repos/dpkp/kafka-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dpkp/kafka-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dpkp/kafka-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/dpkp/kafka-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dpkp/kafka-python/statuses/{sha}","languages_url":"https://api.github.com/repos/dpkp/kafka-python/languages","stargazers_url":"https://api.github.com/repos/dpkp/kafka-python/stargazers","contributors_url":"https://api.github.com/repos/dpkp/kafka-python/contributors","subscribers_url":"https://api.github.com/repos/dpkp/kafka-python/subscribers","subscription_url":"https://api.github.com/repos/dpkp/kafka-python/subscription","commits_url":"https://api.github.com/repos/dpkp/kafka-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/dpkp/kafka-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/dpkp/kafka-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/dpkp/kafka-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/dpkp/kafka-python/contents/{+path}","compare_url":"https://api.github.com/repos/dpkp/kafka-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dpkp/kafka-python/merges","archive_url":"https://api.github.com/repos/dpkp/kafka-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dpkp/kafka-python/downloads","issues_url":"https://api.github.com/repos/dpkp/kafka-python/issues{/number}","pulls_url":"https://api.github.com/repos/dpkp/kafka-python/pulls{/number}","milestones_url":"https://api.github.com/repos/dpkp/kafka-python/milestones{/number}","notifications_url":"https://api.github.com/repos/dpkp/kafka-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dpkp/kafka-python/labels{/name}","releases_url":"https://api.github.com/repos/dpkp/kafka-python/releases{/id}","deployments_url":"https://api.github.com/repos/dpkp/kafka-python/deployments","created_at":"2012-09-24T13:00:26Z","updated_at":"2016-12-05T20:25:31Z","pushed_at":"2016-12-06T11:40:45Z","git_url":"git://github.com/dpkp/kafka-python.git","ssh_url":"git@github.com:dpkp/kafka-python.git","clone_url":"https://github.com/dpkp/kafka-python.git","svn_url":"https://github.com/dpkp/kafka-python","homepage":"http://kafka-python.readthedocs.io/","size":3796,"stargazers_count":1140,"watchers_count":1140,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":477,"mirror_url":null,"open_issues_count":75,"forks":477,"open_issues":75,"watchers":1140,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dpkp/kafka-python/pulls/905"},"html":{"href":"https://github.com/dpkp/kafka-python/pull/905"},"issue":{"href":"https://api.github.com/repos/dpkp/kafka-python/issues/905"},"comments":{"href":"https://api.github.com/repos/dpkp/kafka-python/issues/905/comments"},"review_comments":{"href":"https://api.github.com/repos/dpkp/kafka-python/pulls/905/comments"},"review_comment":{"href":"https://api.github.com/repos/dpkp/kafka-python/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dpkp/kafka-python/pulls/905/commits"},"statuses":{"href":"https://api.github.com/repos/dpkp/kafka-python/statuses/37c766a663a95370a11964a0c81be7249a0ecf53"}},"merged":false,"mergeable":true,"mergeable_state":"clean","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":8,"deletions":1,"changed_files":2}}
{"actor":{"display_login":"ms7s"}}