{"action":"created","comment":{"url":"https://api.github.com/repos/pingcap/pd/pulls/comments/68522054","id":68522054,"diff_hunk":"@@ -241,45 +273,68 @@ func (tlo *transferLeaderOperator) check(region *metapb.Region, leader *metapb.P\n \t}\n \n \t// If the leader has already been changed to new leader, we finish it.\n-\tif leader.GetId() == tlo.newLeader.GetId() {\n-\t\treturn true, nil\n-\t}\n-\n-\t// If the old leader has been changed but not be new leader, we also finish it.\n-\tif leader.GetId() != tlo.oldLeader.GetId() {\n-\t\tlog.Warnf(\"old leader %v has changed to %v, but not %v\", tlo.oldLeader, leader, tlo.newLeader)\n+\tif leader.GetId() == tlo.NewLeader.GetId() {\n \t\treturn true, nil\n \t}\n \n-\tlog.Infof(\"balance [%s], try to transfer leader from %s to %s\", region, tlo.oldLeader, tlo.newLeader)\n+\tlog.Infof(\"balance [%d][%s], try to transfer leader from %s to %s\", tlo.Count, region, tlo.OldLeader, tlo.NewLeader)\n \treturn false, nil\n }\n \n // Do implements Operator.Do interface.\n-func (tlo *transferLeaderOperator) Do(region *metapb.Region, leader *metapb.Peer) (bool, *pdpb.RegionHeartbeatResponse, error) {\n+func (tlo *transferLeaderOperator) Do(region *metapb.Region, leader *metapb.Peer, scb callback, ecb callback) (bool, *pdpb.RegionHeartbeatResponse, error) {","path":"server/operator.go","position":320,"original_position":320,"commit_id":"0c64f6d8a0d3f951312703e8a76b22686aa6854d","original_commit_id":"0c64f6d8a0d3f951312703e8a76b22686aa6854d","user":{"login":"siddontang","id":1080370,"avatar_url":"https://avatars.githubusercontent.com/u/1080370?v=3","gravatar_id":"","url":"https://api.github.com/users/siddontang","html_url":"https://github.com/siddontang","followers_url":"https://api.github.com/users/siddontang/followers","following_url":"https://api.github.com/users/siddontang/following{/other_user}","gists_url":"https://api.github.com/users/siddontang/gists{/gist_id}","starred_url":"https://api.github.com/users/siddontang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/siddontang/subscriptions","organizations_url":"https://api.github.com/users/siddontang/orgs","repos_url":"https://api.github.com/users/siddontang/repos","events_url":"https://api.github.com/users/siddontang/events{/privacy}","received_events_url":"https://api.github.com/users/siddontang/received_events","type":"User","site_admin":false},"body":"what scb and ecb mean?","created_at":"2016-06-27T04:44:02Z","updated_at":"2016-06-27T04:44:02Z","html_url":"https://github.com/pingcap/pd/pull/165#discussion_r68522054","pull_request_url":"https://api.github.com/repos/pingcap/pd/pulls/165","_links":{"self":{"href":"https://api.github.com/repos/pingcap/pd/pulls/comments/68522054"},"html":{"href":"https://github.com/pingcap/pd/pull/165#discussion_r68522054"},"pull_request":{"href":"https://api.github.com/repos/pingcap/pd/pulls/165"}}},"pull_request":{"url":"https://api.github.com/repos/pingcap/pd/pulls/165","id":75055745,"html_url":"https://github.com/pingcap/pd/pull/165","diff_url":"https://github.com/pingcap/pd/pull/165.diff","patch_url":"https://github.com/pingcap/pd/pull/165.patch","issue_url":"https://api.github.com/repos/pingcap/pd/issues/165","number":165,"state":"open","locked":false,"title":"Add restful api support.","user":{"login":"qiuyesuifeng","id":1953644,"avatar_url":"https://avatars.githubusercontent.com/u/1953644?v=3","gravatar_id":"","url":"https://api.github.com/users/qiuyesuifeng","html_url":"https://github.com/qiuyesuifeng","followers_url":"https://api.github.com/users/qiuyesuifeng/followers","following_url":"https://api.github.com/users/qiuyesuifeng/following{/other_user}","gists_url":"https://api.github.com/users/qiuyesuifeng/gists{/gist_id}","starred_url":"https://api.github.com/users/qiuyesuifeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qiuyesuifeng/subscriptions","organizations_url":"https://api.github.com/users/qiuyesuifeng/orgs","repos_url":"https://api.github.com/users/qiuyesuifeng/repos","events_url":"https://api.github.com/users/qiuyesuifeng/events{/privacy}","received_events_url":"https://api.github.com/users/qiuyesuifeng/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-06-24T02:21:38Z","updated_at":"2016-06-27T04:44:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f28b49e3abf525f2775c8c64d9364a76ada66c55","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/pingcap/pd/pulls/165/commits","review_comments_url":"https://api.github.com/repos/pingcap/pd/pulls/165/comments","review_comment_url":"https://api.github.com/repos/pingcap/pd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pingcap/pd/issues/165/comments","statuses_url":"https://api.github.com/repos/pingcap/pd/statuses/0c64f6d8a0d3f951312703e8a76b22686aa6854d","head":{"label":"pingcap:qiuyesuifeng/api","ref":"qiuyesuifeng/api","sha":"0c64f6d8a0d3f951312703e8a76b22686aa6854d","user":{"login":"pingcap","id":11855343,"avatar_url":"https://avatars.githubusercontent.com/u/11855343?v=3","gravatar_id":"","url":"https://api.github.com/users/pingcap","html_url":"https://github.com/pingcap","followers_url":"https://api.github.com/users/pingcap/followers","following_url":"https://api.github.com/users/pingcap/following{/other_user}","gists_url":"https://api.github.com/users/pingcap/gists{/gist_id}","starred_url":"https://api.github.com/users/pingcap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pingcap/subscriptions","organizations_url":"https://api.github.com/users/pingcap/orgs","repos_url":"https://api.github.com/users/pingcap/repos","events_url":"https://api.github.com/users/pingcap/events{/privacy}","received_events_url":"https://api.github.com/users/pingcap/received_events","type":"Organization","site_admin":false},"repo":{"id":53311716,"name":"pd","full_name":"pingcap/pd","owner":{"login":"pingcap","id":11855343,"avatar_url":"https://avatars.githubusercontent.com/u/11855343?v=3","gravatar_id":"","url":"https://api.github.com/users/pingcap","html_url":"https://github.com/pingcap","followers_url":"https://api.github.com/users/pingcap/followers","following_url":"https://api.github.com/users/pingcap/following{/other_user}","gists_url":"https://api.github.com/users/pingcap/gists{/gist_id}","starred_url":"https://api.github.com/users/pingcap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pingcap/subscriptions","organizations_url":"https://api.github.com/users/pingcap/orgs","repos_url":"https://api.github.com/users/pingcap/repos","events_url":"https://api.github.com/users/pingcap/events{/privacy}","received_events_url":"https://api.github.com/users/pingcap/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pingcap/pd","description":"Placement driver for TiKV","fork":false,"url":"https://api.github.com/repos/pingcap/pd","forks_url":"https://api.github.com/repos/pingcap/pd/forks","keys_url":"https://api.github.com/repos/pingcap/pd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pingcap/pd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pingcap/pd/teams","hooks_url":"https://api.github.com/repos/pingcap/pd/hooks","issue_events_url":"https://api.github.com/repos/pingcap/pd/issues/events{/number}","events_url":"https://api.github.com/repos/pingcap/pd/events","assignees_url":"https://api.github.com/repos/pingcap/pd/assignees{/user}","branches_url":"https://api.github.com/repos/pingcap/pd/branches{/branch}","tags_url":"https://api.github.com/repos/pingcap/pd/tags","blobs_url":"https://api.github.com/repos/pingcap/pd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pingcap/pd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pingcap/pd/git/refs{/sha}","trees_url":"https://api.github.com/repos/pingcap/pd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pingcap/pd/statuses/{sha}","languages_url":"https://api.github.com/repos/pingcap/pd/languages","stargazers_url":"https://api.github.com/repos/pingcap/pd/stargazers","contributors_url":"https://api.github.com/repos/pingcap/pd/contributors","subscribers_url":"https://api.github.com/repos/pingcap/pd/subscribers","subscription_url":"https://api.github.com/repos/pingcap/pd/subscription","commits_url":"https://api.github.com/repos/pingcap/pd/commits{/sha}","git_commits_url":"https://api.github.com/repos/pingcap/pd/git/commits{/sha}","comments_url":"https://api.github.com/repos/pingcap/pd/comments{/number}","issue_comment_url":"https://api.github.com/repos/pingcap/pd/issues/comments{/number}","contents_url":"https://api.github.com/repos/pingcap/pd/contents/{+path}","compare_url":"https://api.github.com/repos/pingcap/pd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pingcap/pd/merges","archive_url":"https://api.github.com/repos/pingcap/pd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pingcap/pd/downloads","issues_url":"https://api.github.com/repos/pingcap/pd/issues{/number}","pulls_url":"https://api.github.com/repos/pingcap/pd/pulls{/number}","milestones_url":"https://api.github.com/repos/pingcap/pd/milestones{/number}","notifications_url":"https://api.github.com/repos/pingcap/pd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pingcap/pd/labels{/name}","releases_url":"https://api.github.com/repos/pingcap/pd/releases{/id}","deployments_url":"https://api.github.com/repos/pingcap/pd/deployments","created_at":"2016-03-07T09:13:06Z","updated_at":"2016-06-22T02:34:01Z","pushed_at":"2016-06-26T11:19:26Z","git_url":"git://github.com/pingcap/pd.git","ssh_url":"git@github.com:pingcap/pd.git","clone_url":"https://github.com/pingcap/pd.git","svn_url":"https://github.com/pingcap/pd","homepage":"","size":1208,"stargazers_count":11,"watchers_count":11,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":9,"forks":2,"open_issues":9,"watchers":11,"default_branch":"master"}},"base":{"label":"pingcap:master","ref":"master","sha":"2fcf2a7b91c9da7de51163d90d9016c2b053f524","user":{"login":"pingcap","id":11855343,"avatar_url":"https://avatars.githubusercontent.com/u/11855343?v=3","gravatar_id":"","url":"https://api.github.com/users/pingcap","html_url":"https://github.com/pingcap","followers_url":"https://api.github.com/users/pingcap/followers","following_url":"https://api.github.com/users/pingcap/following{/other_user}","gists_url":"https://api.github.com/users/pingcap/gists{/gist_id}","starred_url":"https://api.github.com/users/pingcap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pingcap/subscriptions","organizations_url":"https://api.github.com/users/pingcap/orgs","repos_url":"https://api.github.com/users/pingcap/repos","events_url":"https://api.github.com/users/pingcap/events{/privacy}","received_events_url":"https://api.github.com/users/pingcap/received_events","type":"Organization","site_admin":false},"repo":{"id":53311716,"name":"pd","full_name":"pingcap/pd","owner":{"login":"pingcap","id":11855343,"avatar_url":"https://avatars.githubusercontent.com/u/11855343?v=3","gravatar_id":"","url":"https://api.github.com/users/pingcap","html_url":"https://github.com/pingcap","followers_url":"https://api.github.com/users/pingcap/followers","following_url":"https://api.github.com/users/pingcap/following{/other_user}","gists_url":"https://api.github.com/users/pingcap/gists{/gist_id}","starred_url":"https://api.github.com/users/pingcap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pingcap/subscriptions","organizations_url":"https://api.github.com/users/pingcap/orgs","repos_url":"https://api.github.com/users/pingcap/repos","events_url":"https://api.github.com/users/pingcap/events{/privacy}","received_events_url":"https://api.github.com/users/pingcap/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pingcap/pd","description":"Placement driver for TiKV","fork":false,"url":"https://api.github.com/repos/pingcap/pd","forks_url":"https://api.github.com/repos/pingcap/pd/forks","keys_url":"https://api.github.com/repos/pingcap/pd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pingcap/pd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pingcap/pd/teams","hooks_url":"https://api.github.com/repos/pingcap/pd/hooks","issue_events_url":"https://api.github.com/repos/pingcap/pd/issues/events{/number}","events_url":"https://api.github.com/repos/pingcap/pd/events","assignees_url":"https://api.github.com/repos/pingcap/pd/assignees{/user}","branches_url":"https://api.github.com/repos/pingcap/pd/branches{/branch}","tags_url":"https://api.github.com/repos/pingcap/pd/tags","blobs_url":"https://api.github.com/repos/pingcap/pd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pingcap/pd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pingcap/pd/git/refs{/sha}","trees_url":"https://api.github.com/repos/pingcap/pd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pingcap/pd/statuses/{sha}","languages_url":"https://api.github.com/repos/pingcap/pd/languages","stargazers_url":"https://api.github.com/repos/pingcap/pd/stargazers","contributors_url":"https://api.github.com/repos/pingcap/pd/contributors","subscribers_url":"https://api.github.com/repos/pingcap/pd/subscribers","subscription_url":"https://api.github.com/repos/pingcap/pd/subscription","commits_url":"https://api.github.com/repos/pingcap/pd/commits{/sha}","git_commits_url":"https://api.github.com/repos/pingcap/pd/git/commits{/sha}","comments_url":"https://api.github.com/repos/pingcap/pd/comments{/number}","issue_comment_url":"https://api.github.com/repos/pingcap/pd/issues/comments{/number}","contents_url":"https://api.github.com/repos/pingcap/pd/contents/{+path}","compare_url":"https://api.github.com/repos/pingcap/pd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pingcap/pd/merges","archive_url":"https://api.github.com/repos/pingcap/pd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pingcap/pd/downloads","issues_url":"https://api.github.com/repos/pingcap/pd/issues{/number}","pulls_url":"https://api.github.com/repos/pingcap/pd/pulls{/number}","milestones_url":"https://api.github.com/repos/pingcap/pd/milestones{/number}","notifications_url":"https://api.github.com/repos/pingcap/pd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pingcap/pd/labels{/name}","releases_url":"https://api.github.com/repos/pingcap/pd/releases{/id}","deployments_url":"https://api.github.com/repos/pingcap/pd/deployments","created_at":"2016-03-07T09:13:06Z","updated_at":"2016-06-22T02:34:01Z","pushed_at":"2016-06-26T11:19:26Z","git_url":"git://github.com/pingcap/pd.git","ssh_url":"git@github.com:pingcap/pd.git","clone_url":"https://github.com/pingcap/pd.git","svn_url":"https://github.com/pingcap/pd","homepage":"","size":1208,"stargazers_count":11,"watchers_count":11,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":9,"forks":2,"open_issues":9,"watchers":11,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pingcap/pd/pulls/165"},"html":{"href":"https://github.com/pingcap/pd/pull/165"},"issue":{"href":"https://api.github.com/repos/pingcap/pd/issues/165"},"comments":{"href":"https://api.github.com/repos/pingcap/pd/issues/165/comments"},"review_comments":{"href":"https://api.github.com/repos/pingcap/pd/pulls/165/comments"},"review_comment":{"href":"https://api.github.com/repos/pingcap/pd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pingcap/pd/pulls/165/commits"},"statuses":{"href":"https://api.github.com/repos/pingcap/pd/statuses/0c64f6d8a0d3f951312703e8a76b22686aa6854d"}}}}
{"actor":{"display_login":"siddontang"}}