{"action":"created","comment":{"url":"https://api.github.com/repos/docker/swarmkit/pulls/comments/173030101","pull_request_review_id":102151109,"id":173030101,"diff_hunk":"@@ -875,8 +875,39 @@ func (m *Manager) rotateRootCAKEK(ctx context.Context, clusterID string) error {\n \t})\n }\n \n+// getLeaderNodeId is a small helper function returning a string with the\n+// leader's node ID. it is only used for logging, and should not be relied on\n+// to give a node ID for actual operational purposes (because it returns errors\n+// as nicely decorated strings)\n+func (m *Manager) getLeaderNodeId() string {\n+\t// get the current leader ID. this variable tracks the leader *only* for\n+\t// the purposes of logging leadership changes, and should not be relied on\n+\t// for other purposes\n+\tleader, leaderErr := m.raftNode.Leader()\n+\tswitch leaderErr {\n+\tcase raft.ErrNoRaftMember:\n+\t\t// this is an unlikely case, but we have to handle it. this means this\n+\t\t// node is not a member of the raft quorum. this won't look very pretty\n+\t\t// in logs (\"leadership changed from aslkdjfa to ErrNoRaftMember\") but\n+\t\t// it also won't be very common\n+\t\treturn \"ErrNoRaftMember\"\n+\tcase raft.ErrNoClusterLeader:\n+\t\treturn \"no cluster leader\"\n+\tdefault:\n+\t\tid, err := m.raftNode.GetNodeIDByRaftID(leader)\n+\t\t// the only possible error here is \"ErrMemberUnknown\"\n+\t\tif err != nil {\n+\t\t\treturn \"an unknown node\"","path":"manager/manager.go","position":26,"original_position":26,"commit_id":"abfd94a7c0561f22c68751b1925e077896d3cfbb","original_commit_id":"7931c61af539ef9ff3034e718215f1d586d3b551","user":{"login":"anshulpundir","id":13551457,"avatar_url":"https://avatars3.githubusercontent.com/u/13551457?v=4","gravatar_id":"","url":"https://api.github.com/users/anshulpundir","html_url":"https://github.com/anshulpundir","followers_url":"https://api.github.com/users/anshulpundir/followers","following_url":"https://api.github.com/users/anshulpundir/following{/other_user}","gists_url":"https://api.github.com/users/anshulpundir/gists{/gist_id}","starred_url":"https://api.github.com/users/anshulpundir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anshulpundir/subscriptions","organizations_url":"https://api.github.com/users/anshulpundir/orgs","repos_url":"https://api.github.com/users/anshulpundir/repos","events_url":"https://api.github.com/users/anshulpundir/events{/privacy}","received_events_url":"https://api.github.com/users/anshulpundir/received_events","type":"User","site_admin":false},"body":"Let me clarify: my suggestion is to find out what is the scenario when we can get a ErrMemberUnknown and try to return a string that explains that scenario.","created_at":"2018-03-08T00:32:02Z","updated_at":"2018-03-08T00:32:02Z","html_url":"https://github.com/docker/swarmkit/pull/2542#discussion_r173030101","pull_request_url":"https://api.github.com/repos/docker/swarmkit/pulls/2542","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/docker/swarmkit/pulls/comments/173030101"},"html":{"href":"https://github.com/docker/swarmkit/pull/2542#discussion_r173030101"},"pull_request":{"href":"https://api.github.com/repos/docker/swarmkit/pulls/2542"}},"in_reply_to_id":172982863},"pull_request":{"url":"https://api.github.com/repos/docker/swarmkit/pulls/2542","id":173558799,"html_url":"https://github.com/docker/swarmkit/pull/2542","diff_url":"https://github.com/docker/swarmkit/pull/2542.diff","patch_url":"https://github.com/docker/swarmkit/pull/2542.patch","issue_url":"https://api.github.com/repos/docker/swarmkit/issues/2542","number":2542,"state":"open","locked":false,"title":"Log leadership changes at manager level","user":{"login":"dperny","id":2367858,"avatar_url":"https://avatars3.githubusercontent.com/u/2367858?v=4","gravatar_id":"","url":"https://api.github.com/users/dperny","html_url":"https://github.com/dperny","followers_url":"https://api.github.com/users/dperny/followers","following_url":"https://api.github.com/users/dperny/following{/other_user}","gists_url":"https://api.github.com/users/dperny/gists{/gist_id}","starred_url":"https://api.github.com/users/dperny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dperny/subscriptions","organizations_url":"https://api.github.com/users/dperny/orgs","repos_url":"https://api.github.com/users/dperny/repos","events_url":"https://api.github.com/users/dperny/events{/privacy}","received_events_url":"https://api.github.com/users/dperny/received_events","type":"User","site_admin":false},"body":"Updates (*Manager).handleLeadershipEvent to include a log message explaining where the leadership changed, using swarmkit node IDs instead of the raft node ids, at the Info level.","created_at":"2018-03-07T20:02:39Z","updated_at":"2018-03-08T00:32:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"671fb21b5ba5623bdac0603c0f6aa0abe730790f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/docker/swarmkit/pulls/2542/commits","review_comments_url":"https://api.github.com/repos/docker/swarmkit/pulls/2542/comments","review_comment_url":"https://api.github.com/repos/docker/swarmkit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/docker/swarmkit/issues/2542/comments","statuses_url":"https://api.github.com/repos/docker/swarmkit/statuses/abfd94a7c0561f22c68751b1925e077896d3cfbb","head":{"label":"dperny:info-level-leader-elections","ref":"info-level-leader-elections","sha":"abfd94a7c0561f22c68751b1925e077896d3cfbb","user":{"login":"dperny","id":2367858,"avatar_url":"https://avatars3.githubusercontent.com/u/2367858?v=4","gravatar_id":"","url":"https://api.github.com/users/dperny","html_url":"https://github.com/dperny","followers_url":"https://api.github.com/users/dperny/followers","following_url":"https://api.github.com/users/dperny/following{/other_user}","gists_url":"https://api.github.com/users/dperny/gists{/gist_id}","starred_url":"https://api.github.com/users/dperny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dperny/subscriptions","organizations_url":"https://api.github.com/users/dperny/orgs","repos_url":"https://api.github.com/users/dperny/repos","events_url":"https://api.github.com/users/dperny/events{/privacy}","received_events_url":"https://api.github.com/users/dperny/received_events","type":"User","site_admin":false},"repo":{"id":60813040,"name":"swarmkit-1","full_name":"dperny/swarmkit-1","owner":{"login":"dperny","id":2367858,"avatar_url":"https://avatars3.githubusercontent.com/u/2367858?v=4","gravatar_id":"","url":"https://api.github.com/users/dperny","html_url":"https://github.com/dperny","followers_url":"https://api.github.com/users/dperny/followers","following_url":"https://api.github.com/users/dperny/following{/other_user}","gists_url":"https://api.github.com/users/dperny/gists{/gist_id}","starred_url":"https://api.github.com/users/dperny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dperny/subscriptions","organizations_url":"https://api.github.com/users/dperny/orgs","repos_url":"https://api.github.com/users/dperny/repos","events_url":"https://api.github.com/users/dperny/events{/privacy}","received_events_url":"https://api.github.com/users/dperny/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dperny/swarmkit-1","description":"A toolkit for orchestrating distributed systems at any scale. It includes primitives for node discovery, raft-based consensus, task scheduling and more.","fork":true,"url":"https://api.github.com/repos/dperny/swarmkit-1","forks_url":"https://api.github.com/repos/dperny/swarmkit-1/forks","keys_url":"https://api.github.com/repos/dperny/swarmkit-1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dperny/swarmkit-1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dperny/swarmkit-1/teams","hooks_url":"https://api.github.com/repos/dperny/swarmkit-1/hooks","issue_events_url":"https://api.github.com/repos/dperny/swarmkit-1/issues/events{/number}","events_url":"https://api.github.com/repos/dperny/swarmkit-1/events","assignees_url":"https://api.github.com/repos/dperny/swarmkit-1/assignees{/user}","branches_url":"https://api.github.com/repos/dperny/swarmkit-1/branches{/branch}","tags_url":"https://api.github.com/repos/dperny/swarmkit-1/tags","blobs_url":"https://api.github.com/repos/dperny/swarmkit-1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dperny/swarmkit-1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dperny/swarmkit-1/git/refs{/sha}","trees_url":"https://api.github.com/repos/dperny/swarmkit-1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dperny/swarmkit-1/statuses/{sha}","languages_url":"https://api.github.com/repos/dperny/swarmkit-1/languages","stargazers_url":"https://api.github.com/repos/dperny/swarmkit-1/stargazers","contributors_url":"https://api.github.com/repos/dperny/swarmkit-1/contributors","subscribers_url":"https://api.github.com/repos/dperny/swarmkit-1/subscribers","subscription_url":"https://api.github.com/repos/dperny/swarmkit-1/subscription","commits_url":"https://api.github.com/repos/dperny/swarmkit-1/commits{/sha}","git_commits_url":"https://api.github.com/repos/dperny/swarmkit-1/git/commits{/sha}","comments_url":"https://api.github.com/repos/dperny/swarmkit-1/comments{/number}","issue_comment_url":"https://api.github.com/repos/dperny/swarmkit-1/issues/comments{/number}","contents_url":"https://api.github.com/repos/dperny/swarmkit-1/contents/{+path}","compare_url":"https://api.github.com/repos/dperny/swarmkit-1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dperny/swarmkit-1/merges","archive_url":"https://api.github.com/repos/dperny/swarmkit-1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dperny/swarmkit-1/downloads","issues_url":"https://api.github.com/repos/dperny/swarmkit-1/issues{/number}","pulls_url":"https://api.github.com/repos/dperny/swarmkit-1/pulls{/number}","milestones_url":"https://api.github.com/repos/dperny/swarmkit-1/milestones{/number}","notifications_url":"https://api.github.com/repos/dperny/swarmkit-1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dperny/swarmkit-1/labels{/name}","releases_url":"https://api.github.com/repos/dperny/swarmkit-1/releases{/id}","deployments_url":"https://api.github.com/repos/dperny/swarmkit-1/deployments","created_at":"2016-06-09T23:18:00Z","updated_at":"2016-06-09T23:18:01Z","pushed_at":"2018-03-07T23:42:42Z","git_url":"git://github.com/dperny/swarmkit-1.git","ssh_url":"git@github.com:dperny/swarmkit-1.git","clone_url":"https://github.com/dperny/swarmkit-1.git","svn_url":"https://github.com/dperny/swarmkit-1","homepage":"","size":18272,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"docker:master","ref":"master","sha":"2e9835acf76659db3a37ef828ee37804647ba11e","user":{"login":"docker","id":5429470,"avatar_url":"https://avatars1.githubusercontent.com/u/5429470?v=4","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"repo":{"id":51556828,"name":"swarmkit","full_name":"docker/swarmkit","owner":{"login":"docker","id":5429470,"avatar_url":"https://avatars1.githubusercontent.com/u/5429470?v=4","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/docker/swarmkit","description":"A toolkit for orchestrating distributed systems at any scale. It includes primitives for node discovery, raft-based consensus, task scheduling and more.","fork":false,"url":"https://api.github.com/repos/docker/swarmkit","forks_url":"https://api.github.com/repos/docker/swarmkit/forks","keys_url":"https://api.github.com/repos/docker/swarmkit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/docker/swarmkit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/docker/swarmkit/teams","hooks_url":"https://api.github.com/repos/docker/swarmkit/hooks","issue_events_url":"https://api.github.com/repos/docker/swarmkit/issues/events{/number}","events_url":"https://api.github.com/repos/docker/swarmkit/events","assignees_url":"https://api.github.com/repos/docker/swarmkit/assignees{/user}","branches_url":"https://api.github.com/repos/docker/swarmkit/branches{/branch}","tags_url":"https://api.github.com/repos/docker/swarmkit/tags","blobs_url":"https://api.github.com/repos/docker/swarmkit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/docker/swarmkit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/docker/swarmkit/git/refs{/sha}","trees_url":"https://api.github.com/repos/docker/swarmkit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/docker/swarmkit/statuses/{sha}","languages_url":"https://api.github.com/repos/docker/swarmkit/languages","stargazers_url":"https://api.github.com/repos/docker/swarmkit/stargazers","contributors_url":"https://api.github.com/repos/docker/swarmkit/contributors","subscribers_url":"https://api.github.com/repos/docker/swarmkit/subscribers","subscription_url":"https://api.github.com/repos/docker/swarmkit/subscription","commits_url":"https://api.github.com/repos/docker/swarmkit/commits{/sha}","git_commits_url":"https://api.github.com/repos/docker/swarmkit/git/commits{/sha}","comments_url":"https://api.github.com/repos/docker/swarmkit/comments{/number}","issue_comment_url":"https://api.github.com/repos/docker/swarmkit/issues/comments{/number}","contents_url":"https://api.github.com/repos/docker/swarmkit/contents/{+path}","compare_url":"https://api.github.com/repos/docker/swarmkit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/docker/swarmkit/merges","archive_url":"https://api.github.com/repos/docker/swarmkit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/docker/swarmkit/downloads","issues_url":"https://api.github.com/repos/docker/swarmkit/issues{/number}","pulls_url":"https://api.github.com/repos/docker/swarmkit/pulls{/number}","milestones_url":"https://api.github.com/repos/docker/swarmkit/milestones{/number}","notifications_url":"https://api.github.com/repos/docker/swarmkit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/docker/swarmkit/labels{/name}","releases_url":"https://api.github.com/repos/docker/swarmkit/releases{/id}","deployments_url":"https://api.github.com/repos/docker/swarmkit/deployments","created_at":"2016-02-12T00:02:15Z","updated_at":"2018-03-05T09:40:27Z","pushed_at":"2018-03-07T23:52:28Z","git_url":"git://github.com/docker/swarmkit.git","ssh_url":"git@github.com:docker/swarmkit.git","clone_url":"https://github.com/docker/swarmkit.git","svn_url":"https://github.com/docker/swarmkit","homepage":"","size":18189,"stargazers_count":1582,"watchers_count":1582,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":357,"mirror_url":null,"archived":false,"open_issues_count":194,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":357,"open_issues":194,"watchers":1582,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/docker/swarmkit/pulls/2542"},"html":{"href":"https://github.com/docker/swarmkit/pull/2542"},"issue":{"href":"https://api.github.com/repos/docker/swarmkit/issues/2542"},"comments":{"href":"https://api.github.com/repos/docker/swarmkit/issues/2542/comments"},"review_comments":{"href":"https://api.github.com/repos/docker/swarmkit/pulls/2542/comments"},"review_comment":{"href":"https://api.github.com/repos/docker/swarmkit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/docker/swarmkit/pulls/2542/commits"},"statuses":{"href":"https://api.github.com/repos/docker/swarmkit/statuses/abfd94a7c0561f22c68751b1925e077896d3cfbb"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"anshulpundir"}}