{"action":"created","issue":{"url":"https://api.github.com/repos/coreos/etcd/issues/3970","labels_url":"https://api.github.com/repos/coreos/etcd/issues/3970/labels{/name}","comments_url":"https://api.github.com/repos/coreos/etcd/issues/3970/comments","events_url":"https://api.github.com/repos/coreos/etcd/issues/3970/events","html_url":"https://github.com/coreos/etcd/pull/3970","id":121059134,"number":3970,"title":"*: rewrite snapshot merging and sending for v3","user":{"login":"xiang90","id":4479947,"avatar_url":"https://avatars.githubusercontent.com/u/4479947?v=3","gravatar_id":"","url":"https://api.github.com/users/xiang90","html_url":"https://github.com/xiang90","followers_url":"https://api.github.com/users/xiang90/followers","following_url":"https://api.github.com/users/xiang90/following{/other_user}","gists_url":"https://api.github.com/users/xiang90/gists{/gist_id}","starred_url":"https://api.github.com/users/xiang90/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xiang90/subscriptions","organizations_url":"https://api.github.com/users/xiang90/orgs","repos_url":"https://api.github.com/users/xiang90/repos","events_url":"https://api.github.com/users/xiang90/events{/privacy}","received_events_url":"https://api.github.com/users/xiang90/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-12-08T17:37:17Z","updated_at":"2015-12-09T17:31:27Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/coreos/etcd/pulls/3970","html_url":"https://github.com/coreos/etcd/pull/3970","diff_url":"https://github.com/coreos/etcd/pull/3970.diff","patch_url":"https://github.com/coreos/etcd/pull/3970.patch"},"body":"I am rewriting the snapshot merging and sending logic for v3 (https://github.com/coreos/etcd/pull/3666).\r\n\r\nThe previous approach is complicated and introduced a few unnecessary components (snapshot_store in both etcdserver and transport). And the coordination between components are error-prone. We have fixed a few bugs but there are still deadlocks around. Moreover the current snapshot creating logic is wrong. It does not stop the apply loop while getting the v3 snapshot.\r\n\r\nThe previous complexity comes from the delay of the snapshot merging at the final transportation phase. I try to move the merging to the very beginning at etcdserver and it makes thing a lot simper. It is mainly because etcdserver has the full control of the workflow and does not require any coordination.\r\n\r\nThis pull requests try to simplify the logic. Currently it is work in progress. But the approach works and is significantly simpler.\r\n\r\nThe snapshot sending logic should be as simple as:\r\n\r\n1. raft requires snapshot and sends out a MsgSnap.\r\n2. etcdserver receives the MsgSnap.\r\n3. etcdserver gets current snapshot of v2 and v3 and merges them into MsgSnap.\r\n4. etcdserver asks transportation layer to send merged MsgSnap out.\r\n"},"comment":{"url":"https://api.github.com/repos/coreos/etcd/issues/comments/163333310","html_url":"https://github.com/coreos/etcd/pull/3970#issuecomment-163333310","issue_url":"https://api.github.com/repos/coreos/etcd/issues/3970","id":163333310,"user":{"login":"xiang90","id":4479947,"avatar_url":"https://avatars.githubusercontent.com/u/4479947?v=3","gravatar_id":"","url":"https://api.github.com/users/xiang90","html_url":"https://github.com/xiang90","followers_url":"https://api.github.com/users/xiang90/followers","following_url":"https://api.github.com/users/xiang90/following{/other_user}","gists_url":"https://api.github.com/users/xiang90/gists{/gist_id}","starred_url":"https://api.github.com/users/xiang90/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xiang90/subscriptions","organizations_url":"https://api.github.com/users/xiang90/orgs","repos_url":"https://api.github.com/users/xiang90/repos","events_url":"https://api.github.com/users/xiang90/events{/privacy}","received_events_url":"https://api.github.com/users/xiang90/received_events","type":"User","site_admin":false},"created_at":"2015-12-09T17:31:27Z","updated_at":"2015-12-09T17:31:27Z","body":"Other than that feel free to test it out. \r\n\r\nWhat I have done is to set a 3 nodes cluster with v3 enabled. Then I use benchmark tool to generate enough puts to trigger snapshot while killing nodes to force snapshot sending."}}