{"action":"created","comment":{"url":"https://api.github.com/repos/influxdb/influxdb/pulls/comments/32187749","id":32187749,"diff_hunk":"@@ -141,50 +130,41 @@ func (cmd *BackupCommand) download(u url.URL, ss *influxdb.Snapshot, path string\n \t}\n \tdefer f.Close()\n \n-\t// Encode snapshot.\n-\tvar buf bytes.Buffer\n-\tif ss != nil {\n-\t\tif err := json.NewEncoder(&buf).Encode(ss); err != nil {\n-\t\t\treturn fmt.Errorf(\"encode snapshot: %s\", err)\n-\t\t}\n-\t}\n-\n-\t// Create request with existing snapshot as the body.\n-\tu.Path = \"/data/snapshot\"\n-\treq, err := http.NewRequest(\"GET\", u.String(), &buf)\n+\t// Connect to snapshotter service.\n+\tconn, err := net.Dial(\"tcp\", host)\n \tif err != nil {\n-\t\treturn fmt.Errorf(\"new request: %s\", err)\n+\t\treturn err\n \t}\n+\tdefer conn.Close()\n \n-\t// Fetch the archive from the server.\n-\tresp, err := http.DefaultClient.Do(req)\n-\tif err != nil {\n-\t\treturn fmt.Errorf(\"get: %s\", err)\n+\t// Send snapshotter marker byte.\n+\tif _, err := conn.Write([]byte{snapshotter.MuxHeader}); err != nil {\n+\t\treturn fmt.Errorf(\"write header byte: %s\", err)\n \t}\n-\tdefer func() { _ = resp.Body.Close() }()\n \n-\t// Check the status code.\n-\tif resp.StatusCode != http.StatusOK {\n-\t\treturn fmt.Errorf(\"snapshot error: status=%d\", resp.StatusCode)\n+\t// Write the manifest we currently have.\n+\tif err := json.NewEncoder(conn).Encode(m); err != nil {\n+\t\treturn fmt.Errorf(\"encode manifest: %s\", err)","path":"cmd/influxd/backup/backup.go","position":null,"original_position":182,"commit_id":"782231bc826c74b60138695b506d5fba7f4973c3","original_commit_id":"77f64a55443362ea6b6012f3d72f5d9b53caac4b","user":{"login":"benbjohnson","id":118015,"avatar_url":"https://avatars.githubusercontent.com/u/118015?v=3","gravatar_id":"","url":"https://api.github.com/users/benbjohnson","html_url":"https://github.com/benbjohnson","followers_url":"https://api.github.com/users/benbjohnson/followers","following_url":"https://api.github.com/users/benbjohnson/following{/other_user}","gists_url":"https://api.github.com/users/benbjohnson/gists{/gist_id}","starred_url":"https://api.github.com/users/benbjohnson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benbjohnson/subscriptions","organizations_url":"https://api.github.com/users/benbjohnson/orgs","repos_url":"https://api.github.com/users/benbjohnson/repos","events_url":"https://api.github.com/users/benbjohnson/events{/privacy}","received_events_url":"https://api.github.com/users/benbjohnson/received_events","type":"User","site_admin":false},"body":"Fixed: 782231b","created_at":"2015-06-11T03:38:29Z","updated_at":"2015-06-11T03:38:29Z","html_url":"https://github.com/influxdb/influxdb/pull/2886#discussion_r32187749","pull_request_url":"https://api.github.com/repos/influxdb/influxdb/pulls/2886","_links":{"self":{"href":"https://api.github.com/repos/influxdb/influxdb/pulls/comments/32187749"},"html":{"href":"https://github.com/influxdb/influxdb/pull/2886#discussion_r32187749"},"pull_request":{"href":"https://api.github.com/repos/influxdb/influxdb/pulls/2886"}}},"pull_request":{"url":"https://api.github.com/repos/influxdb/influxdb/pulls/2886","id":37400049,"html_url":"https://github.com/influxdb/influxdb/pull/2886","diff_url":"https://github.com/influxdb/influxdb/pull/2886.diff","patch_url":"https://github.com/influxdb/influxdb/pull/2886.patch","issue_url":"https://api.github.com/repos/influxdb/influxdb/issues/2886","number":2886,"state":"open","locked":false,"title":"Refactor backup & restore","user":{"login":"benbjohnson","id":118015,"avatar_url":"https://avatars.githubusercontent.com/u/118015?v=3","gravatar_id":"","url":"https://api.github.com/users/benbjohnson","html_url":"https://github.com/benbjohnson","followers_url":"https://api.github.com/users/benbjohnson/followers","following_url":"https://api.github.com/users/benbjohnson/following{/other_user}","gists_url":"https://api.github.com/users/benbjohnson/gists{/gist_id}","starred_url":"https://api.github.com/users/benbjohnson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benbjohnson/subscriptions","organizations_url":"https://api.github.com/users/benbjohnson/orgs","repos_url":"https://api.github.com/users/benbjohnson/repos","events_url":"https://api.github.com/users/benbjohnson/events{/privacy}","received_events_url":"https://api.github.com/users/benbjohnson/received_events","type":"User","site_admin":false},"body":"## Overview\r\n\r\nThis pull request refactors the `influxd backup` and `influxd restore` commands to work with the new architecture. This involved adding additional protobuf support to the `meta` package to serialize the `meta.Data` tree and refactoring snapshots into the `snapshots` package and making them work with the new file layout.","created_at":"2015-06-10T20:20:54Z","updated_at":"2015-06-11T03:38:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d9b7822b1fa90181fe267a1e8cfd908bfb4910fa","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/influxdb/influxdb/pulls/2886/commits","review_comments_url":"https://api.github.com/repos/influxdb/influxdb/pulls/2886/comments","review_comment_url":"https://api.github.com/repos/influxdb/influxdb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/influxdb/influxdb/issues/2886/comments","statuses_url":"https://api.github.com/repos/influxdb/influxdb/statuses/782231bc826c74b60138695b506d5fba7f4973c3","head":{"label":"benbjohnson:backup-restore","ref":"backup-restore","sha":"782231bc826c74b60138695b506d5fba7f4973c3","user":{"login":"benbjohnson","id":118015,"avatar_url":"https://avatars.githubusercontent.com/u/118015?v=3","gravatar_id":"","url":"https://api.github.com/users/benbjohnson","html_url":"https://github.com/benbjohnson","followers_url":"https://api.github.com/users/benbjohnson/followers","following_url":"https://api.github.com/users/benbjohnson/following{/other_user}","gists_url":"https://api.github.com/users/benbjohnson/gists{/gist_id}","starred_url":"https://api.github.com/users/benbjohnson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benbjohnson/subscriptions","organizations_url":"https://api.github.com/users/benbjohnson/orgs","repos_url":"https://api.github.com/users/benbjohnson/repos","events_url":"https://api.github.com/users/benbjohnson/events{/privacy}","received_events_url":"https://api.github.com/users/benbjohnson/received_events","type":"User","site_admin":false},"repo":{"id":36954584,"name":"influxdb","full_name":"benbjohnson/influxdb","owner":{"login":"benbjohnson","id":118015,"avatar_url":"https://avatars.githubusercontent.com/u/118015?v=3","gravatar_id":"","url":"https://api.github.com/users/benbjohnson","html_url":"https://github.com/benbjohnson","followers_url":"https://api.github.com/users/benbjohnson/followers","following_url":"https://api.github.com/users/benbjohnson/following{/other_user}","gists_url":"https://api.github.com/users/benbjohnson/gists{/gist_id}","starred_url":"https://api.github.com/users/benbjohnson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benbjohnson/subscriptions","organizations_url":"https://api.github.com/users/benbjohnson/orgs","repos_url":"https://api.github.com/users/benbjohnson/repos","events_url":"https://api.github.com/users/benbjohnson/events{/privacy}","received_events_url":"https://api.github.com/users/benbjohnson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/benbjohnson/influxdb","description":"Scalable datastore for metrics, events, and real-time analytics","fork":true,"url":"https://api.github.com/repos/benbjohnson/influxdb","forks_url":"https://api.github.com/repos/benbjohnson/influxdb/forks","keys_url":"https://api.github.com/repos/benbjohnson/influxdb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/benbjohnson/influxdb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/benbjohnson/influxdb/teams","hooks_url":"https://api.github.com/repos/benbjohnson/influxdb/hooks","issue_events_url":"https://api.github.com/repos/benbjohnson/influxdb/issues/events{/number}","events_url":"https://api.github.com/repos/benbjohnson/influxdb/events","assignees_url":"https://api.github.com/repos/benbjohnson/influxdb/assignees{/user}","branches_url":"https://api.github.com/repos/benbjohnson/influxdb/branches{/branch}","tags_url":"https://api.github.com/repos/benbjohnson/influxdb/tags","blobs_url":"https://api.github.com/repos/benbjohnson/influxdb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/benbjohnson/influxdb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/benbjohnson/influxdb/git/refs{/sha}","trees_url":"https://api.github.com/repos/benbjohnson/influxdb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/benbjohnson/influxdb/statuses/{sha}","languages_url":"https://api.github.com/repos/benbjohnson/influxdb/languages","stargazers_url":"https://api.github.com/repos/benbjohnson/influxdb/stargazers","contributors_url":"https://api.github.com/repos/benbjohnson/influxdb/contributors","subscribers_url":"https://api.github.com/repos/benbjohnson/influxdb/subscribers","subscription_url":"https://api.github.com/repos/benbjohnson/influxdb/subscription","commits_url":"https://api.github.com/repos/benbjohnson/influxdb/commits{/sha}","git_commits_url":"https://api.github.com/repos/benbjohnson/influxdb/git/commits{/sha}","comments_url":"https://api.github.com/repos/benbjohnson/influxdb/comments{/number}","issue_comment_url":"https://api.github.com/repos/benbjohnson/influxdb/issues/comments{/number}","contents_url":"https://api.github.com/repos/benbjohnson/influxdb/contents/{+path}","compare_url":"https://api.github.com/repos/benbjohnson/influxdb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/benbjohnson/influxdb/merges","archive_url":"https://api.github.com/repos/benbjohnson/influxdb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/benbjohnson/influxdb/downloads","issues_url":"https://api.github.com/repos/benbjohnson/influxdb/issues{/number}","pulls_url":"https://api.github.com/repos/benbjohnson/influxdb/pulls{/number}","milestones_url":"https://api.github.com/repos/benbjohnson/influxdb/milestones{/number}","notifications_url":"https://api.github.com/repos/benbjohnson/influxdb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/benbjohnson/influxdb/labels{/name}","releases_url":"https://api.github.com/repos/benbjohnson/influxdb/releases{/id}","created_at":"2015-06-05T20:45:47Z","updated_at":"2015-06-05T20:45:48Z","pushed_at":"2015-06-11T03:38:07Z","git_url":"git://github.com/benbjohnson/influxdb.git","ssh_url":"git@github.com:benbjohnson/influxdb.git","clone_url":"https://github.com/benbjohnson/influxdb.git","svn_url":"https://github.com/benbjohnson/influxdb","homepage":"http://influxdb.com","size":21490,"stargazers_count":0,"watchers_count":0,"language":"Go","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":"influxdb:master","ref":"master","sha":"3e794fc0f6d075007fea5f66e4ed59b6cfd28b3c","user":{"login":"influxdb","id":5713248,"avatar_url":"https://avatars.githubusercontent.com/u/5713248?v=3","gravatar_id":"","url":"https://api.github.com/users/influxdb","html_url":"https://github.com/influxdb","followers_url":"https://api.github.com/users/influxdb/followers","following_url":"https://api.github.com/users/influxdb/following{/other_user}","gists_url":"https://api.github.com/users/influxdb/gists{/gist_id}","starred_url":"https://api.github.com/users/influxdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/influxdb/subscriptions","organizations_url":"https://api.github.com/users/influxdb/orgs","repos_url":"https://api.github.com/users/influxdb/repos","events_url":"https://api.github.com/users/influxdb/events{/privacy}","received_events_url":"https://api.github.com/users/influxdb/received_events","type":"Organization","site_admin":false},"repo":{"id":13124802,"name":"influxdb","full_name":"influxdb/influxdb","owner":{"login":"influxdb","id":5713248,"avatar_url":"https://avatars.githubusercontent.com/u/5713248?v=3","gravatar_id":"","url":"https://api.github.com/users/influxdb","html_url":"https://github.com/influxdb","followers_url":"https://api.github.com/users/influxdb/followers","following_url":"https://api.github.com/users/influxdb/following{/other_user}","gists_url":"https://api.github.com/users/influxdb/gists{/gist_id}","starred_url":"https://api.github.com/users/influxdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/influxdb/subscriptions","organizations_url":"https://api.github.com/users/influxdb/orgs","repos_url":"https://api.github.com/users/influxdb/repos","events_url":"https://api.github.com/users/influxdb/events{/privacy}","received_events_url":"https://api.github.com/users/influxdb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/influxdb/influxdb","description":"Scalable datastore for metrics, events, and real-time analytics","fork":false,"url":"https://api.github.com/repos/influxdb/influxdb","forks_url":"https://api.github.com/repos/influxdb/influxdb/forks","keys_url":"https://api.github.com/repos/influxdb/influxdb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/influxdb/influxdb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/influxdb/influxdb/teams","hooks_url":"https://api.github.com/repos/influxdb/influxdb/hooks","issue_events_url":"https://api.github.com/repos/influxdb/influxdb/issues/events{/number}","events_url":"https://api.github.com/repos/influxdb/influxdb/events","assignees_url":"https://api.github.com/repos/influxdb/influxdb/assignees{/user}","branches_url":"https://api.github.com/repos/influxdb/influxdb/branches{/branch}","tags_url":"https://api.github.com/repos/influxdb/influxdb/tags","blobs_url":"https://api.github.com/repos/influxdb/influxdb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/influxdb/influxdb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/influxdb/influxdb/git/refs{/sha}","trees_url":"https://api.github.com/repos/influxdb/influxdb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/influxdb/influxdb/statuses/{sha}","languages_url":"https://api.github.com/repos/influxdb/influxdb/languages","stargazers_url":"https://api.github.com/repos/influxdb/influxdb/stargazers","contributors_url":"https://api.github.com/repos/influxdb/influxdb/contributors","subscribers_url":"https://api.github.com/repos/influxdb/influxdb/subscribers","subscription_url":"https://api.github.com/repos/influxdb/influxdb/subscription","commits_url":"https://api.github.com/repos/influxdb/influxdb/commits{/sha}","git_commits_url":"https://api.github.com/repos/influxdb/influxdb/git/commits{/sha}","comments_url":"https://api.github.com/repos/influxdb/influxdb/comments{/number}","issue_comment_url":"https://api.github.com/repos/influxdb/influxdb/issues/comments{/number}","contents_url":"https://api.github.com/repos/influxdb/influxdb/contents/{+path}","compare_url":"https://api.github.com/repos/influxdb/influxdb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/influxdb/influxdb/merges","archive_url":"https://api.github.com/repos/influxdb/influxdb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/influxdb/influxdb/downloads","issues_url":"https://api.github.com/repos/influxdb/influxdb/issues{/number}","pulls_url":"https://api.github.com/repos/influxdb/influxdb/pulls{/number}","milestones_url":"https://api.github.com/repos/influxdb/influxdb/milestones{/number}","notifications_url":"https://api.github.com/repos/influxdb/influxdb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/influxdb/influxdb/labels{/name}","releases_url":"https://api.github.com/repos/influxdb/influxdb/releases{/id}","created_at":"2013-09-26T14:31:10Z","updated_at":"2015-06-11T01:19:52Z","pushed_at":"2015-06-11T03:38:07Z","git_url":"git://github.com/influxdb/influxdb.git","ssh_url":"git@github.com:influxdb/influxdb.git","clone_url":"https://github.com/influxdb/influxdb.git","svn_url":"https://github.com/influxdb/influxdb","homepage":"http://influxdb.com","size":45857,"stargazers_count":5552,"watchers_count":5552,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":529,"mirror_url":null,"open_issues_count":276,"forks":529,"open_issues":276,"watchers":5552,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/influxdb/influxdb/pulls/2886"},"html":{"href":"https://github.com/influxdb/influxdb/pull/2886"},"issue":{"href":"https://api.github.com/repos/influxdb/influxdb/issues/2886"},"comments":{"href":"https://api.github.com/repos/influxdb/influxdb/issues/2886/comments"},"review_comments":{"href":"https://api.github.com/repos/influxdb/influxdb/pulls/2886/comments"},"review_comment":{"href":"https://api.github.com/repos/influxdb/influxdb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/influxdb/influxdb/pulls/2886/commits"},"statuses":{"href":"https://api.github.com/repos/influxdb/influxdb/statuses/782231bc826c74b60138695b506d5fba7f4973c3"}}}}