{"action":"created","comment":{"url":"https://api.github.com/repos/baidu/tera/pulls/comments/39008583","id":39008583,"diff_hunk":"@@ -1715,6 +1725,28 @@ void TabletIO::ListSnapshot(std::vector<uint64_t>* snapshot_id) {\n     }\n }\n \n+uint64_t TabletIO::Rollback(uint64_t snapshot_id, StatusCode* status) {\n+    std::map<uint64_t, uint64_t>::iterator it;\n+    {\n+        MutexLock lock(&m_mutex);\n+        if (m_status != kReady) {\n+            SetStatusCode(m_status, status);\n+            return false;\n+        }\n+        it = id_to_snapshot_num_.find(snapshot_id);\n+        if (it == id_to_snapshot_num_.end()) {\n+            SetStatusCode(kSnapshotNotExist, status);\n+            return false;\n+        }\n+        m_db_ref_count++;\n+    }\n+    uint64_t rollback_point = m_db->Rollback(it->second);","path":"src/io/tablet_io.cc","position":83,"original_position":83,"commit_id":"47a6dba1809ed7b4cab420416f8839ad2ee8ff2c","original_commit_id":"47a6dba1809ed7b4cab420416f8839ad2ee8ff2c","user":{"login":"bluebore","id":6851389,"avatar_url":"https://avatars.githubusercontent.com/u/6851389?v=3","gravatar_id":"","url":"https://api.github.com/users/bluebore","html_url":"https://github.com/bluebore","followers_url":"https://api.github.com/users/bluebore/followers","following_url":"https://api.github.com/users/bluebore/following{/other_user}","gists_url":"https://api.github.com/users/bluebore/gists{/gist_id}","starred_url":"https://api.github.com/users/bluebore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bluebore/subscriptions","organizations_url":"https://api.github.com/users/bluebore/orgs","repos_url":"https://api.github.com/users/bluebore/repos","events_url":"https://api.github.com/users/bluebore/events{/privacy}","received_events_url":"https://api.github.com/users/bluebore/received_events","type":"User","site_admin":false},"body":"it会失效","created_at":"2015-09-09T05:33:26Z","updated_at":"2015-09-09T05:33:26Z","html_url":"https://github.com/baidu/tera/pull/299#discussion_r39008583","pull_request_url":"https://api.github.com/repos/baidu/tera/pulls/299","_links":{"self":{"href":"https://api.github.com/repos/baidu/tera/pulls/comments/39008583"},"html":{"href":"https://github.com/baidu/tera/pull/299#discussion_r39008583"},"pull_request":{"href":"https://api.github.com/repos/baidu/tera/pulls/299"}}},"pull_request":{"url":"https://api.github.com/repos/baidu/tera/pulls/299","id":44300828,"html_url":"https://github.com/baidu/tera/pull/299","diff_url":"https://github.com/baidu/tera/pull/299.diff","patch_url":"https://github.com/baidu/tera/pull/299.patch","issue_url":"https://api.github.com/repos/baidu/tera/issues/299","number":299,"state":"open","locked":false,"title":"Snapshot rollback #266","user":{"login":"lylei","id":2767333,"avatar_url":"https://avatars.githubusercontent.com/u/2767333?v=3","gravatar_id":"","url":"https://api.github.com/users/lylei","html_url":"https://github.com/lylei","followers_url":"https://api.github.com/users/lylei/followers","following_url":"https://api.github.com/users/lylei/following{/other_user}","gists_url":"https://api.github.com/users/lylei/gists{/gist_id}","starred_url":"https://api.github.com/users/lylei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lylei/subscriptions","organizations_url":"https://api.github.com/users/lylei/orgs","repos_url":"https://api.github.com/users/lylei/repos","events_url":"https://api.github.com/users/lylei/events{/privacy}","received_events_url":"https://api.github.com/users/lylei/received_events","type":"User","site_admin":false},"body":"1. teracli发起回滚\r\n2. get和scan时对回滚的数据屏蔽\r\n3. compact时丢弃已经回滚的数据","created_at":"2015-09-06T11:16:31Z","updated_at":"2015-09-09T05:33:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dd33f7698fabdb92b755f3c745e4f8159297c8d6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/baidu/tera/pulls/299/commits","review_comments_url":"https://api.github.com/repos/baidu/tera/pulls/299/comments","review_comment_url":"https://api.github.com/repos/baidu/tera/pulls/comments{/number}","comments_url":"https://api.github.com/repos/baidu/tera/issues/299/comments","statuses_url":"https://api.github.com/repos/baidu/tera/statuses/47a6dba1809ed7b4cab420416f8839ad2ee8ff2c","head":{"label":"lylei:ss","ref":"ss","sha":"47a6dba1809ed7b4cab420416f8839ad2ee8ff2c","user":{"login":"lylei","id":2767333,"avatar_url":"https://avatars.githubusercontent.com/u/2767333?v=3","gravatar_id":"","url":"https://api.github.com/users/lylei","html_url":"https://github.com/lylei","followers_url":"https://api.github.com/users/lylei/followers","following_url":"https://api.github.com/users/lylei/following{/other_user}","gists_url":"https://api.github.com/users/lylei/gists{/gist_id}","starred_url":"https://api.github.com/users/lylei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lylei/subscriptions","organizations_url":"https://api.github.com/users/lylei/orgs","repos_url":"https://api.github.com/users/lylei/repos","events_url":"https://api.github.com/users/lylei/events{/privacy}","received_events_url":"https://api.github.com/users/lylei/received_events","type":"User","site_admin":false},"repo":{"id":38722702,"name":"tera","full_name":"lylei/tera","owner":{"login":"lylei","id":2767333,"avatar_url":"https://avatars.githubusercontent.com/u/2767333?v=3","gravatar_id":"","url":"https://api.github.com/users/lylei","html_url":"https://github.com/lylei","followers_url":"https://api.github.com/users/lylei/followers","following_url":"https://api.github.com/users/lylei/following{/other_user}","gists_url":"https://api.github.com/users/lylei/gists{/gist_id}","starred_url":"https://api.github.com/users/lylei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lylei/subscriptions","organizations_url":"https://api.github.com/users/lylei/orgs","repos_url":"https://api.github.com/users/lylei/repos","events_url":"https://api.github.com/users/lylei/events{/privacy}","received_events_url":"https://api.github.com/users/lylei/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lylei/tera","description":"A distributed table storage system.","fork":true,"url":"https://api.github.com/repos/lylei/tera","forks_url":"https://api.github.com/repos/lylei/tera/forks","keys_url":"https://api.github.com/repos/lylei/tera/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lylei/tera/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lylei/tera/teams","hooks_url":"https://api.github.com/repos/lylei/tera/hooks","issue_events_url":"https://api.github.com/repos/lylei/tera/issues/events{/number}","events_url":"https://api.github.com/repos/lylei/tera/events","assignees_url":"https://api.github.com/repos/lylei/tera/assignees{/user}","branches_url":"https://api.github.com/repos/lylei/tera/branches{/branch}","tags_url":"https://api.github.com/repos/lylei/tera/tags","blobs_url":"https://api.github.com/repos/lylei/tera/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lylei/tera/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lylei/tera/git/refs{/sha}","trees_url":"https://api.github.com/repos/lylei/tera/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lylei/tera/statuses/{sha}","languages_url":"https://api.github.com/repos/lylei/tera/languages","stargazers_url":"https://api.github.com/repos/lylei/tera/stargazers","contributors_url":"https://api.github.com/repos/lylei/tera/contributors","subscribers_url":"https://api.github.com/repos/lylei/tera/subscribers","subscription_url":"https://api.github.com/repos/lylei/tera/subscription","commits_url":"https://api.github.com/repos/lylei/tera/commits{/sha}","git_commits_url":"https://api.github.com/repos/lylei/tera/git/commits{/sha}","comments_url":"https://api.github.com/repos/lylei/tera/comments{/number}","issue_comment_url":"https://api.github.com/repos/lylei/tera/issues/comments{/number}","contents_url":"https://api.github.com/repos/lylei/tera/contents/{+path}","compare_url":"https://api.github.com/repos/lylei/tera/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lylei/tera/merges","archive_url":"https://api.github.com/repos/lylei/tera/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lylei/tera/downloads","issues_url":"https://api.github.com/repos/lylei/tera/issues{/number}","pulls_url":"https://api.github.com/repos/lylei/tera/pulls{/number}","milestones_url":"https://api.github.com/repos/lylei/tera/milestones{/number}","notifications_url":"https://api.github.com/repos/lylei/tera/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lylei/tera/labels{/name}","releases_url":"https://api.github.com/repos/lylei/tera/releases{/id}","created_at":"2015-07-08T00:38:56Z","updated_at":"2015-07-08T00:38:58Z","pushed_at":"2015-09-09T02:52:21Z","git_url":"git://github.com/lylei/tera.git","ssh_url":"git@github.com:lylei/tera.git","clone_url":"https://github.com/lylei/tera.git","svn_url":"https://github.com/lylei/tera","homepage":"","size":11787,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"baidu:master","ref":"master","sha":"cd05dfcc073513a2cbf95a6ad14dc134b22002be","user":{"login":"baidu","id":13245940,"avatar_url":"https://avatars.githubusercontent.com/u/13245940?v=3","gravatar_id":"","url":"https://api.github.com/users/baidu","html_url":"https://github.com/baidu","followers_url":"https://api.github.com/users/baidu/followers","following_url":"https://api.github.com/users/baidu/following{/other_user}","gists_url":"https://api.github.com/users/baidu/gists{/gist_id}","starred_url":"https://api.github.com/users/baidu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baidu/subscriptions","organizations_url":"https://api.github.com/users/baidu/orgs","repos_url":"https://api.github.com/users/baidu/repos","events_url":"https://api.github.com/users/baidu/events{/privacy}","received_events_url":"https://api.github.com/users/baidu/received_events","type":"Organization","site_admin":false},"repo":{"id":18129915,"name":"tera","full_name":"baidu/tera","owner":{"login":"baidu","id":13245940,"avatar_url":"https://avatars.githubusercontent.com/u/13245940?v=3","gravatar_id":"","url":"https://api.github.com/users/baidu","html_url":"https://github.com/baidu","followers_url":"https://api.github.com/users/baidu/followers","following_url":"https://api.github.com/users/baidu/following{/other_user}","gists_url":"https://api.github.com/users/baidu/gists{/gist_id}","starred_url":"https://api.github.com/users/baidu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baidu/subscriptions","organizations_url":"https://api.github.com/users/baidu/orgs","repos_url":"https://api.github.com/users/baidu/repos","events_url":"https://api.github.com/users/baidu/events{/privacy}","received_events_url":"https://api.github.com/users/baidu/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/baidu/tera","description":"A distributed, elastic, structured database.","fork":false,"url":"https://api.github.com/repos/baidu/tera","forks_url":"https://api.github.com/repos/baidu/tera/forks","keys_url":"https://api.github.com/repos/baidu/tera/keys{/key_id}","collaborators_url":"https://api.github.com/repos/baidu/tera/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/baidu/tera/teams","hooks_url":"https://api.github.com/repos/baidu/tera/hooks","issue_events_url":"https://api.github.com/repos/baidu/tera/issues/events{/number}","events_url":"https://api.github.com/repos/baidu/tera/events","assignees_url":"https://api.github.com/repos/baidu/tera/assignees{/user}","branches_url":"https://api.github.com/repos/baidu/tera/branches{/branch}","tags_url":"https://api.github.com/repos/baidu/tera/tags","blobs_url":"https://api.github.com/repos/baidu/tera/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/baidu/tera/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/baidu/tera/git/refs{/sha}","trees_url":"https://api.github.com/repos/baidu/tera/git/trees{/sha}","statuses_url":"https://api.github.com/repos/baidu/tera/statuses/{sha}","languages_url":"https://api.github.com/repos/baidu/tera/languages","stargazers_url":"https://api.github.com/repos/baidu/tera/stargazers","contributors_url":"https://api.github.com/repos/baidu/tera/contributors","subscribers_url":"https://api.github.com/repos/baidu/tera/subscribers","subscription_url":"https://api.github.com/repos/baidu/tera/subscription","commits_url":"https://api.github.com/repos/baidu/tera/commits{/sha}","git_commits_url":"https://api.github.com/repos/baidu/tera/git/commits{/sha}","comments_url":"https://api.github.com/repos/baidu/tera/comments{/number}","issue_comment_url":"https://api.github.com/repos/baidu/tera/issues/comments{/number}","contents_url":"https://api.github.com/repos/baidu/tera/contents/{+path}","compare_url":"https://api.github.com/repos/baidu/tera/compare/{base}...{head}","merges_url":"https://api.github.com/repos/baidu/tera/merges","archive_url":"https://api.github.com/repos/baidu/tera/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/baidu/tera/downloads","issues_url":"https://api.github.com/repos/baidu/tera/issues{/number}","pulls_url":"https://api.github.com/repos/baidu/tera/pulls{/number}","milestones_url":"https://api.github.com/repos/baidu/tera/milestones{/number}","notifications_url":"https://api.github.com/repos/baidu/tera/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/baidu/tera/labels{/name}","releases_url":"https://api.github.com/repos/baidu/tera/releases{/id}","created_at":"2014-03-26T07:22:05Z","updated_at":"2015-09-08T14:08:51Z","pushed_at":"2015-09-09T04:53:04Z","git_url":"git://github.com/baidu/tera.git","ssh_url":"git@github.com:baidu/tera.git","clone_url":"https://github.com/baidu/tera.git","svn_url":"https://github.com/baidu/tera","homepage":"","size":15464,"stargazers_count":282,"watchers_count":282,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":87,"mirror_url":null,"open_issues_count":38,"forks":87,"open_issues":38,"watchers":282,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/baidu/tera/pulls/299"},"html":{"href":"https://github.com/baidu/tera/pull/299"},"issue":{"href":"https://api.github.com/repos/baidu/tera/issues/299"},"comments":{"href":"https://api.github.com/repos/baidu/tera/issues/299/comments"},"review_comments":{"href":"https://api.github.com/repos/baidu/tera/pulls/299/comments"},"review_comment":{"href":"https://api.github.com/repos/baidu/tera/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/baidu/tera/pulls/299/commits"},"statuses":{"href":"https://api.github.com/repos/baidu/tera/statuses/47a6dba1809ed7b4cab420416f8839ad2ee8ff2c"}}}}