{"action":"created","issue":{"url":"https://api.github.com/repos/docker/swarmkit/issues/1179","repository_url":"https://api.github.com/repos/docker/swarmkit","labels_url":"https://api.github.com/repos/docker/swarmkit/issues/1179/labels{/name}","comments_url":"https://api.github.com/repos/docker/swarmkit/issues/1179/comments","events_url":"https://api.github.com/repos/docker/swarmkit/issues/1179/events","html_url":"https://github.com/docker/swarmkit/pull/1179","id":165840535,"number":1179,"title":"Raft: send commit ack back to follower before closing connection","user":{"login":"runshenzhu","id":7114218,"avatar_url":"https://avatars.githubusercontent.com/u/7114218?v=3","gravatar_id":"","url":"https://api.github.com/users/runshenzhu","html_url":"https://github.com/runshenzhu","followers_url":"https://api.github.com/users/runshenzhu/followers","following_url":"https://api.github.com/users/runshenzhu/following{/other_user}","gists_url":"https://api.github.com/users/runshenzhu/gists{/gist_id}","starred_url":"https://api.github.com/users/runshenzhu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/runshenzhu/subscriptions","organizations_url":"https://api.github.com/users/runshenzhu/orgs","repos_url":"https://api.github.com/users/runshenzhu/repos","events_url":"https://api.github.com/users/runshenzhu/events{/privacy}","received_events_url":"https://api.github.com/users/runshenzhu/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/docker/swarmkit/labels/area/raft","name":"area/raft","color":"fef2c0"},{"url":"https://api.github.com/repos/docker/swarmkit/labels/status/2-code-review","name":"status/2-code-review","color":"fad8c7"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":25,"created_at":"2016-07-15T17:40:48Z","updated_at":"2016-07-18T19:18:21Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/docker/swarmkit/pulls/1179","html_url":"https://github.com/docker/swarmkit/pull/1179","diff_url":"https://github.com/docker/swarmkit/pull/1179.diff","patch_url":"https://github.com/docker/swarmkit/pull/1179.patch"},"body":"if there are only 2 nodes in the cluster, and leader is leaving before closing the connection, leader has to ensure that follower gets noticed about this raft conf change commit. \r\n\r\nOtherwise, follower would assume there are still 2 nodes in the cluster and won't get elected into the leader by acquiring the majority (2 nodes). Check out [my repo](https://github.com/runshenzhu/swarmkit/commits/raft-leave-join) to reproduce this bug.\r\n\r\nThis PR fix the problem by sending commit ack back to follower manually, before leader closing connection.\r\n\r\nAn alternative approach is to keep leader from leaving when there are only 2 nodes in the cluster.\r\n\r\nSigned-off-by: Runshen Zhu <runshen.zhu@gmail.com>\r\n\r\nping: @dperny @aaronlehmann @abronan \r\nfix #1178 "},"comment":{"url":"https://api.github.com/repos/docker/swarmkit/issues/comments/233429867","html_url":"https://github.com/docker/swarmkit/pull/1179#issuecomment-233429867","issue_url":"https://api.github.com/repos/docker/swarmkit/issues/1179","id":233429867,"user":{"login":"runshenzhu","id":7114218,"avatar_url":"https://avatars.githubusercontent.com/u/7114218?v=3","gravatar_id":"","url":"https://api.github.com/users/runshenzhu","html_url":"https://github.com/runshenzhu","followers_url":"https://api.github.com/users/runshenzhu/followers","following_url":"https://api.github.com/users/runshenzhu/following{/other_user}","gists_url":"https://api.github.com/users/runshenzhu/gists{/gist_id}","starred_url":"https://api.github.com/users/runshenzhu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/runshenzhu/subscriptions","organizations_url":"https://api.github.com/users/runshenzhu/orgs","repos_url":"https://api.github.com/users/runshenzhu/repos","events_url":"https://api.github.com/users/runshenzhu/events{/privacy}","received_events_url":"https://api.github.com/users/runshenzhu/received_events","type":"User","site_admin":false},"created_at":"2016-07-18T19:18:21Z","updated_at":"2016-07-18T19:18:21Z","body":"@aaronlehmann That's my mistake. I just found that removing the time limit from context won't do any changes, because in the test `raftClient` also has a grpc time out limit. So, eventually, if fake clock didn't sync with real clock, `Leave` will time out, either from `context`, or from `grpc.invoke` inside the `raftClient.Leave`. When running the test this morning, I got the time out from grpc.\r\n\r\nSo there is still a time out problem. Test was passed just because it didn't hit the time out race. \r\n\r\nI fixed issues clock sync in test, and updated it to [my repo](https://github.com/runshenzhu/swarmkit/commits/raft-leave-join). \r\n\r\nwhile my test is crappy and throws meaningless errors, I think `n.asyncTasks.Wait()` approach is correct."}}
{"actor":{"display_login":"runshenzhu"}}