{"action":"created","comment":{"url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/comments/34722327","id":34722327,"diff_hunk":"@@ -355,3 +355,14 @@ func MetaScanBounds(key proto.Key) (proto.Key, proto.Key) {\n \t// Otherwise find the first entry greater than the given key in the same meta prefix.\n \treturn key.Next(), proto.Key(key[:len(Meta1Prefix)]).PrefixEnd()\n }\n+\n+// MetaReverseScanBounds returns the start and end keys of the range within which the\n+// desired meta record can be found by means of an engine reverse scan. The given key\n+// must be a valid RangeMetaKey as defined by ValidateRangeMetaKey.\n+func MetaReverseScanBounds(key proto.Key) (proto.Key, proto.Key, error) {\n+\tif key.Equal(proto.KeyMin) || key.Equal(Meta1Prefix) {\n+\t\treturn nil, nil, NewInvalidRangeMetaKeyError(\"KeyMin or Meta1Prefix can't be used as the key of reverse scan\", key)\n+\t}\n+\t// Otherwise find the first entry less than or equal to the given key in the same meta prefix.\n+\treturn proto.Key(key[:len(Meta1Prefix)]), key, nil","path":"keys/keys.go","position":13,"original_position":13,"commit_id":"9a39f6300f538dfca8d8c1a0580d7d5ef507851e","original_commit_id":"9a39f6300f538dfca8d8c1a0580d7d5ef507851e","user":{"login":"petermattis","id":6201335,"avatar_url":"https://avatars.githubusercontent.com/u/6201335?v=3","gravatar_id":"","url":"https://api.github.com/users/petermattis","html_url":"https://github.com/petermattis","followers_url":"https://api.github.com/users/petermattis/followers","following_url":"https://api.github.com/users/petermattis/following{/other_user}","gists_url":"https://api.github.com/users/petermattis/gists{/gist_id}","starred_url":"https://api.github.com/users/petermattis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petermattis/subscriptions","organizations_url":"https://api.github.com/users/petermattis/orgs","repos_url":"https://api.github.com/users/petermattis/repos","events_url":"https://api.github.com/users/petermattis/events{/privacy}","received_events_url":"https://api.github.com/users/petermattis/received_events","type":"User","site_admin":false},"body":"I don't think the cast to `proto.Key` is necessary here (try removing it). Likely this was copy&pasted from elsewhere in this file which contains other unnecessary casts to `proto.Key` (unnecessary because they are redundant, the type being casted is already a `proto.Key`).","created_at":"2015-07-15T20:04:07Z","updated_at":"2015-07-15T20:04:07Z","html_url":"https://github.com/cockroachdb/cockroach/pull/1686#discussion_r34722327","pull_request_url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/1686","_links":{"self":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/comments/34722327"},"html":{"href":"https://github.com/cockroachdb/cockroach/pull/1686#discussion_r34722327"},"pull_request":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/1686"}}},"pull_request":{"url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/1686","id":40035121,"html_url":"https://github.com/cockroachdb/cockroach/pull/1686","diff_url":"https://github.com/cockroachdb/cockroach/pull/1686.diff","patch_url":"https://github.com/cockroachdb/cockroach/pull/1686.patch","issue_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/1686","number":1686,"state":"open","locked":false,"title":"Add reverse scan  support (WIP)","user":{"login":"thundercw","id":11734583,"avatar_url":"https://avatars.githubusercontent.com/u/11734583?v=3","gravatar_id":"","url":"https://api.github.com/users/thundercw","html_url":"https://github.com/thundercw","followers_url":"https://api.github.com/users/thundercw/followers","following_url":"https://api.github.com/users/thundercw/following{/other_user}","gists_url":"https://api.github.com/users/thundercw/gists{/gist_id}","starred_url":"https://api.github.com/users/thundercw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thundercw/subscriptions","organizations_url":"https://api.github.com/users/thundercw/orgs","repos_url":"https://api.github.com/users/thundercw/repos","events_url":"https://api.github.com/users/thundercw/events{/privacy}","received_events_url":"https://api.github.com/users/thundercw/received_events","type":"User","site_admin":false},"body":"The work is still in process.The main logic has been added.There are some tests and comments to be added.\r\nThe major changes are as follows:\r\n1.The `key.Prev()` has been restored which has been deleted by @petermattis in 5ebdffa . But it still have a problem. In some cases `key.Next().Prev() != key`, for example key is end by `0xff`. So the `key.Prev()` I only used in internal look up ranges to find previous ranges.\r\n2. Support prefetch ranges reverse by adding a reverse field to the existing `InternalRangeLookupRequest`. (#1585)\r\n3. Add two fields `inclusiveKey` and `inclusiveEndKey` in the `ReverseScanRequest` to support cross range scan.\r\n\r\nPlease provide your suggestions. Thanks.","created_at":"2015-07-15T15:25:21Z","updated_at":"2015-07-15T20:04:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8f8f4aa686238e5770a651c3e96cb1dc980ef7b1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/1686/commits","review_comments_url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/1686/comments","review_comment_url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/1686/comments","statuses_url":"https://api.github.com/repos/cockroachdb/cockroach/statuses/9a39f6300f538dfca8d8c1a0580d7d5ef507851e","head":{"label":"thundercw:reverse_scan","ref":"reverse_scan","sha":"9a39f6300f538dfca8d8c1a0580d7d5ef507851e","user":{"login":"thundercw","id":11734583,"avatar_url":"https://avatars.githubusercontent.com/u/11734583?v=3","gravatar_id":"","url":"https://api.github.com/users/thundercw","html_url":"https://github.com/thundercw","followers_url":"https://api.github.com/users/thundercw/followers","following_url":"https://api.github.com/users/thundercw/following{/other_user}","gists_url":"https://api.github.com/users/thundercw/gists{/gist_id}","starred_url":"https://api.github.com/users/thundercw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thundercw/subscriptions","organizations_url":"https://api.github.com/users/thundercw/orgs","repos_url":"https://api.github.com/users/thundercw/repos","events_url":"https://api.github.com/users/thundercw/events{/privacy}","received_events_url":"https://api.github.com/users/thundercw/received_events","type":"User","site_admin":false},"repo":{"id":38563436,"name":"cockroach","full_name":"thundercw/cockroach","owner":{"login":"thundercw","id":11734583,"avatar_url":"https://avatars.githubusercontent.com/u/11734583?v=3","gravatar_id":"","url":"https://api.github.com/users/thundercw","html_url":"https://github.com/thundercw","followers_url":"https://api.github.com/users/thundercw/followers","following_url":"https://api.github.com/users/thundercw/following{/other_user}","gists_url":"https://api.github.com/users/thundercw/gists{/gist_id}","starred_url":"https://api.github.com/users/thundercw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thundercw/subscriptions","organizations_url":"https://api.github.com/users/thundercw/orgs","repos_url":"https://api.github.com/users/thundercw/repos","events_url":"https://api.github.com/users/thundercw/events{/privacy}","received_events_url":"https://api.github.com/users/thundercw/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/thundercw/cockroach","description":"A Scalable, Geo-Replicated, Transactional Datastore","fork":true,"url":"https://api.github.com/repos/thundercw/cockroach","forks_url":"https://api.github.com/repos/thundercw/cockroach/forks","keys_url":"https://api.github.com/repos/thundercw/cockroach/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thundercw/cockroach/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thundercw/cockroach/teams","hooks_url":"https://api.github.com/repos/thundercw/cockroach/hooks","issue_events_url":"https://api.github.com/repos/thundercw/cockroach/issues/events{/number}","events_url":"https://api.github.com/repos/thundercw/cockroach/events","assignees_url":"https://api.github.com/repos/thundercw/cockroach/assignees{/user}","branches_url":"https://api.github.com/repos/thundercw/cockroach/branches{/branch}","tags_url":"https://api.github.com/repos/thundercw/cockroach/tags","blobs_url":"https://api.github.com/repos/thundercw/cockroach/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thundercw/cockroach/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thundercw/cockroach/git/refs{/sha}","trees_url":"https://api.github.com/repos/thundercw/cockroach/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thundercw/cockroach/statuses/{sha}","languages_url":"https://api.github.com/repos/thundercw/cockroach/languages","stargazers_url":"https://api.github.com/repos/thundercw/cockroach/stargazers","contributors_url":"https://api.github.com/repos/thundercw/cockroach/contributors","subscribers_url":"https://api.github.com/repos/thundercw/cockroach/subscribers","subscription_url":"https://api.github.com/repos/thundercw/cockroach/subscription","commits_url":"https://api.github.com/repos/thundercw/cockroach/commits{/sha}","git_commits_url":"https://api.github.com/repos/thundercw/cockroach/git/commits{/sha}","comments_url":"https://api.github.com/repos/thundercw/cockroach/comments{/number}","issue_comment_url":"https://api.github.com/repos/thundercw/cockroach/issues/comments{/number}","contents_url":"https://api.github.com/repos/thundercw/cockroach/contents/{+path}","compare_url":"https://api.github.com/repos/thundercw/cockroach/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thundercw/cockroach/merges","archive_url":"https://api.github.com/repos/thundercw/cockroach/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thundercw/cockroach/downloads","issues_url":"https://api.github.com/repos/thundercw/cockroach/issues{/number}","pulls_url":"https://api.github.com/repos/thundercw/cockroach/pulls{/number}","milestones_url":"https://api.github.com/repos/thundercw/cockroach/milestones{/number}","notifications_url":"https://api.github.com/repos/thundercw/cockroach/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thundercw/cockroach/labels{/name}","releases_url":"https://api.github.com/repos/thundercw/cockroach/releases{/id}","created_at":"2015-07-05T09:19:14Z","updated_at":"2015-07-05T09:19:16Z","pushed_at":"2015-07-15T14:34:42Z","git_url":"git://github.com/thundercw/cockroach.git","ssh_url":"git@github.com:thundercw/cockroach.git","clone_url":"https://github.com/thundercw/cockroach.git","svn_url":"https://github.com/thundercw/cockroach","homepage":null,"size":23410,"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":"cockroachdb:master","ref":"master","sha":"f01e41c0d5674e22a67a1c37c49f6348626578d9","user":{"login":"cockroachdb","id":6748139,"avatar_url":"https://avatars.githubusercontent.com/u/6748139?v=3","gravatar_id":"","url":"https://api.github.com/users/cockroachdb","html_url":"https://github.com/cockroachdb","followers_url":"https://api.github.com/users/cockroachdb/followers","following_url":"https://api.github.com/users/cockroachdb/following{/other_user}","gists_url":"https://api.github.com/users/cockroachdb/gists{/gist_id}","starred_url":"https://api.github.com/users/cockroachdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cockroachdb/subscriptions","organizations_url":"https://api.github.com/users/cockroachdb/orgs","repos_url":"https://api.github.com/users/cockroachdb/repos","events_url":"https://api.github.com/users/cockroachdb/events{/privacy}","received_events_url":"https://api.github.com/users/cockroachdb/received_events","type":"Organization","site_admin":false},"repo":{"id":16563587,"name":"cockroach","full_name":"cockroachdb/cockroach","owner":{"login":"cockroachdb","id":6748139,"avatar_url":"https://avatars.githubusercontent.com/u/6748139?v=3","gravatar_id":"","url":"https://api.github.com/users/cockroachdb","html_url":"https://github.com/cockroachdb","followers_url":"https://api.github.com/users/cockroachdb/followers","following_url":"https://api.github.com/users/cockroachdb/following{/other_user}","gists_url":"https://api.github.com/users/cockroachdb/gists{/gist_id}","starred_url":"https://api.github.com/users/cockroachdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cockroachdb/subscriptions","organizations_url":"https://api.github.com/users/cockroachdb/orgs","repos_url":"https://api.github.com/users/cockroachdb/repos","events_url":"https://api.github.com/users/cockroachdb/events{/privacy}","received_events_url":"https://api.github.com/users/cockroachdb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cockroachdb/cockroach","description":"A Scalable, Geo-Replicated, Transactional Datastore","fork":false,"url":"https://api.github.com/repos/cockroachdb/cockroach","forks_url":"https://api.github.com/repos/cockroachdb/cockroach/forks","keys_url":"https://api.github.com/repos/cockroachdb/cockroach/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cockroachdb/cockroach/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cockroachdb/cockroach/teams","hooks_url":"https://api.github.com/repos/cockroachdb/cockroach/hooks","issue_events_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/events{/number}","events_url":"https://api.github.com/repos/cockroachdb/cockroach/events","assignees_url":"https://api.github.com/repos/cockroachdb/cockroach/assignees{/user}","branches_url":"https://api.github.com/repos/cockroachdb/cockroach/branches{/branch}","tags_url":"https://api.github.com/repos/cockroachdb/cockroach/tags","blobs_url":"https://api.github.com/repos/cockroachdb/cockroach/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cockroachdb/cockroach/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cockroachdb/cockroach/git/refs{/sha}","trees_url":"https://api.github.com/repos/cockroachdb/cockroach/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cockroachdb/cockroach/statuses/{sha}","languages_url":"https://api.github.com/repos/cockroachdb/cockroach/languages","stargazers_url":"https://api.github.com/repos/cockroachdb/cockroach/stargazers","contributors_url":"https://api.github.com/repos/cockroachdb/cockroach/contributors","subscribers_url":"https://api.github.com/repos/cockroachdb/cockroach/subscribers","subscription_url":"https://api.github.com/repos/cockroachdb/cockroach/subscription","commits_url":"https://api.github.com/repos/cockroachdb/cockroach/commits{/sha}","git_commits_url":"https://api.github.com/repos/cockroachdb/cockroach/git/commits{/sha}","comments_url":"https://api.github.com/repos/cockroachdb/cockroach/comments{/number}","issue_comment_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/comments{/number}","contents_url":"https://api.github.com/repos/cockroachdb/cockroach/contents/{+path}","compare_url":"https://api.github.com/repos/cockroachdb/cockroach/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cockroachdb/cockroach/merges","archive_url":"https://api.github.com/repos/cockroachdb/cockroach/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cockroachdb/cockroach/downloads","issues_url":"https://api.github.com/repos/cockroachdb/cockroach/issues{/number}","pulls_url":"https://api.github.com/repos/cockroachdb/cockroach/pulls{/number}","milestones_url":"https://api.github.com/repos/cockroachdb/cockroach/milestones{/number}","notifications_url":"https://api.github.com/repos/cockroachdb/cockroach/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cockroachdb/cockroach/labels{/name}","releases_url":"https://api.github.com/repos/cockroachdb/cockroach/releases{/id}","created_at":"2014-02-06T00:18:47Z","updated_at":"2015-07-15T17:10:43Z","pushed_at":"2015-07-15T19:34:26Z","git_url":"git://github.com/cockroachdb/cockroach.git","ssh_url":"git@github.com:cockroachdb/cockroach.git","clone_url":"https://github.com/cockroachdb/cockroach.git","svn_url":"https://github.com/cockroachdb/cockroach","homepage":null,"size":40567,"stargazers_count":4882,"watchers_count":4882,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":373,"mirror_url":null,"open_issues_count":123,"forks":373,"open_issues":123,"watchers":4882,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/1686"},"html":{"href":"https://github.com/cockroachdb/cockroach/pull/1686"},"issue":{"href":"https://api.github.com/repos/cockroachdb/cockroach/issues/1686"},"comments":{"href":"https://api.github.com/repos/cockroachdb/cockroach/issues/1686/comments"},"review_comments":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/1686/comments"},"review_comment":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/1686/commits"},"statuses":{"href":"https://api.github.com/repos/cockroachdb/cockroach/statuses/9a39f6300f538dfca8d8c1a0580d7d5ef507851e"}}}}