{"action":"created","comment":{"url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/comments/33071983","id":33071983,"diff_hunk":"@@ -350,6 +350,54 @@ func TestRetryOnNotLeaderError(t *testing.T) {\n \t}\n }\n \n+// TestRetryOnDescriptorLookupError verifies that the DistSender retries a descriptor\n+// lookup on retryable errors.\n+func TestRetryOnDescriptorLookupError(t *testing.T) {\n+\tdefer leaktest.AfterTest(t)\n+\tg, s := makeTestGossip(t)\n+\tdefer s()\n+\n+\tvar testFn rpcSendFn = func(_ rpc.Options, _ string, _ []net.Addr, _ func(addr net.Addr) interface{}, getReply func() interface{}, _ *rpc.Context) ([]interface{}, error) {\n+\t\treturn []interface{}{getReply()}, nil\n+\t}\n+\n+\terrors := []error{\n+\t\t&proto.Error{\n+\t\t\tMessage:   \"fatal boom\",\n+\t\t\tRetryable: false,\n+\t\t},\n+\t\t&proto.Error{\n+\t\t\tMessage:   \"temporary boom\",\n+\t\t\tRetryable: true,\n+\t\t},\n+\t\tnil,\n+\t}\n+\n+\tctx := &DistSenderContext{\n+\t\trpcSend: testFn,\n+\t\trangeDescriptorDB: mockRangeDescriptorDB(func(_ proto.Key, _ lookupOptions) (_ []proto.RangeDescriptor, err error) {\n+\t\t\terr, errors = errors[0], errors[1:]\n+\t\t\treturn []proto.RangeDescriptor{testRangeDescriptor}, err\n+\t\t}),\n+\t}\n+\tds := NewDistSender(ctx, g)\n+\tcall := proto.PutCall(proto.Key(\"a\"), proto.Value{Bytes: []byte(\"value\")})\n+\treply := call.Reply.(*proto.PutResponse)\n+\t// Fatal error on descriptor lookup, propagated to reply.\n+\tds.Send(context.Background(), call)\n+\tif err := reply.Header().Error; err.GetMessage() != \"fatal boom\" {\n+\t\tt.Errorf(\"unexpected error: %s\", err)\n+\t}\n+\t// Retryable error on descriptor lookup, second attempt successful.\n+\tds.Send(context.Background(), call)\n+\tif err := reply.GoError(); err != nil {\n+\t\tt.Errorf(\"unexpected error: %s\", err)\n+\t}\n+\tif len(errors) != 0 {\n+\t\tt.Fatalf(\"expected more descriptor lookups, leftover errors: %+v\", errors)","path":"kv/dist_sender_test.go","position":48,"original_position":48,"commit_id":"6c5a3a084dcd16df75f4183b47291adaf0f714f7","original_commit_id":"41f3729faf2ab12edcf4c4e26786f90011d7ef21","user":{"login":"tschottdorf","id":5076964,"avatar_url":"https://avatars.githubusercontent.com/u/5076964?v=3","gravatar_id":"","url":"https://api.github.com/users/tschottdorf","html_url":"https://github.com/tschottdorf","followers_url":"https://api.github.com/users/tschottdorf/followers","following_url":"https://api.github.com/users/tschottdorf/following{/other_user}","gists_url":"https://api.github.com/users/tschottdorf/gists{/gist_id}","starred_url":"https://api.github.com/users/tschottdorf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tschottdorf/subscriptions","organizations_url":"https://api.github.com/users/tschottdorf/orgs","repos_url":"https://api.github.com/users/tschottdorf/repos","events_url":"https://api.github.com/users/tschottdorf/events{/privacy}","received_events_url":"https://api.github.com/users/tschottdorf/received_events","type":"User","site_admin":false},"body":"it's a tiny test, so when it fails it's easy to see what it does from the above comments.","created_at":"2015-06-23T18:06:01Z","updated_at":"2015-06-23T18:06:01Z","html_url":"https://github.com/cockroachdb/cockroach/pull/1445#discussion_r33071983","pull_request_url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/1445","_links":{"self":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/comments/33071983"},"html":{"href":"https://github.com/cockroachdb/cockroach/pull/1445#discussion_r33071983"},"pull_request":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/1445"}}},"pull_request":{"url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/1445","id":38331312,"html_url":"https://github.com/cockroachdb/cockroach/pull/1445","diff_url":"https://github.com/cockroachdb/cockroach/pull/1445.diff","patch_url":"https://github.com/cockroachdb/cockroach/pull/1445.patch","issue_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/1445","number":1445,"state":"open","locked":false,"title":"DistSender: handle descriptor lookup errors","user":{"login":"tschottdorf","id":5076964,"avatar_url":"https://avatars.githubusercontent.com/u/5076964?v=3","gravatar_id":"","url":"https://api.github.com/users/tschottdorf","html_url":"https://github.com/tschottdorf","followers_url":"https://api.github.com/users/tschottdorf/followers","following_url":"https://api.github.com/users/tschottdorf/following{/other_user}","gists_url":"https://api.github.com/users/tschottdorf/gists{/gist_id}","starred_url":"https://api.github.com/users/tschottdorf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tschottdorf/subscriptions","organizations_url":"https://api.github.com/users/tschottdorf/orgs","repos_url":"https://api.github.com/users/tschottdorf/repos","events_url":"https://api.github.com/users/tschottdorf/events{/privacy}","received_events_url":"https://api.github.com/users/tschottdorf/received_events","type":"User","site_admin":false},"body":"and revert a commit which handled them higher up (#1323).","created_at":"2015-06-23T12:36:33Z","updated_at":"2015-06-23T18:06:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f5b396f2e5161864bcda4b355c17620eae1bdb21","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/1445/commits","review_comments_url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/1445/comments","review_comment_url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/1445/comments","statuses_url":"https://api.github.com/repos/cockroachdb/cockroach/statuses/6c5a3a084dcd16df75f4183b47291adaf0f714f7","head":{"label":"tschottdorf:ds_retry","ref":"ds_retry","sha":"6c5a3a084dcd16df75f4183b47291adaf0f714f7","user":{"login":"tschottdorf","id":5076964,"avatar_url":"https://avatars.githubusercontent.com/u/5076964?v=3","gravatar_id":"","url":"https://api.github.com/users/tschottdorf","html_url":"https://github.com/tschottdorf","followers_url":"https://api.github.com/users/tschottdorf/followers","following_url":"https://api.github.com/users/tschottdorf/following{/other_user}","gists_url":"https://api.github.com/users/tschottdorf/gists{/gist_id}","starred_url":"https://api.github.com/users/tschottdorf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tschottdorf/subscriptions","organizations_url":"https://api.github.com/users/tschottdorf/orgs","repos_url":"https://api.github.com/users/tschottdorf/repos","events_url":"https://api.github.com/users/tschottdorf/events{/privacy}","received_events_url":"https://api.github.com/users/tschottdorf/received_events","type":"User","site_admin":false},"repo":{"id":23832429,"name":"cockroach","full_name":"tschottdorf/cockroach","owner":{"login":"tschottdorf","id":5076964,"avatar_url":"https://avatars.githubusercontent.com/u/5076964?v=3","gravatar_id":"","url":"https://api.github.com/users/tschottdorf","html_url":"https://github.com/tschottdorf","followers_url":"https://api.github.com/users/tschottdorf/followers","following_url":"https://api.github.com/users/tschottdorf/following{/other_user}","gists_url":"https://api.github.com/users/tschottdorf/gists{/gist_id}","starred_url":"https://api.github.com/users/tschottdorf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tschottdorf/subscriptions","organizations_url":"https://api.github.com/users/tschottdorf/orgs","repos_url":"https://api.github.com/users/tschottdorf/repos","events_url":"https://api.github.com/users/tschottdorf/events{/privacy}","received_events_url":"https://api.github.com/users/tschottdorf/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tschottdorf/cockroach","description":"A Scalable, Geo-Replicated, Transactional Datastore","fork":true,"url":"https://api.github.com/repos/tschottdorf/cockroach","forks_url":"https://api.github.com/repos/tschottdorf/cockroach/forks","keys_url":"https://api.github.com/repos/tschottdorf/cockroach/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tschottdorf/cockroach/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tschottdorf/cockroach/teams","hooks_url":"https://api.github.com/repos/tschottdorf/cockroach/hooks","issue_events_url":"https://api.github.com/repos/tschottdorf/cockroach/issues/events{/number}","events_url":"https://api.github.com/repos/tschottdorf/cockroach/events","assignees_url":"https://api.github.com/repos/tschottdorf/cockroach/assignees{/user}","branches_url":"https://api.github.com/repos/tschottdorf/cockroach/branches{/branch}","tags_url":"https://api.github.com/repos/tschottdorf/cockroach/tags","blobs_url":"https://api.github.com/repos/tschottdorf/cockroach/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tschottdorf/cockroach/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tschottdorf/cockroach/git/refs{/sha}","trees_url":"https://api.github.com/repos/tschottdorf/cockroach/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tschottdorf/cockroach/statuses/{sha}","languages_url":"https://api.github.com/repos/tschottdorf/cockroach/languages","stargazers_url":"https://api.github.com/repos/tschottdorf/cockroach/stargazers","contributors_url":"https://api.github.com/repos/tschottdorf/cockroach/contributors","subscribers_url":"https://api.github.com/repos/tschottdorf/cockroach/subscribers","subscription_url":"https://api.github.com/repos/tschottdorf/cockroach/subscription","commits_url":"https://api.github.com/repos/tschottdorf/cockroach/commits{/sha}","git_commits_url":"https://api.github.com/repos/tschottdorf/cockroach/git/commits{/sha}","comments_url":"https://api.github.com/repos/tschottdorf/cockroach/comments{/number}","issue_comment_url":"https://api.github.com/repos/tschottdorf/cockroach/issues/comments{/number}","contents_url":"https://api.github.com/repos/tschottdorf/cockroach/contents/{+path}","compare_url":"https://api.github.com/repos/tschottdorf/cockroach/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tschottdorf/cockroach/merges","archive_url":"https://api.github.com/repos/tschottdorf/cockroach/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tschottdorf/cockroach/downloads","issues_url":"https://api.github.com/repos/tschottdorf/cockroach/issues{/number}","pulls_url":"https://api.github.com/repos/tschottdorf/cockroach/pulls{/number}","milestones_url":"https://api.github.com/repos/tschottdorf/cockroach/milestones{/number}","notifications_url":"https://api.github.com/repos/tschottdorf/cockroach/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tschottdorf/cockroach/labels{/name}","releases_url":"https://api.github.com/repos/tschottdorf/cockroach/releases{/id}","created_at":"2014-09-09T12:26:29Z","updated_at":"2015-04-30T01:27:18Z","pushed_at":"2015-06-23T18:04:56Z","git_url":"git://github.com/tschottdorf/cockroach.git","ssh_url":"git@github.com:tschottdorf/cockroach.git","clone_url":"https://github.com/tschottdorf/cockroach.git","svn_url":"https://github.com/tschottdorf/cockroach","homepage":null,"size":24067,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":16,"forks":0,"open_issues":16,"watchers":0,"default_branch":"master"}},"base":{"label":"cockroachdb:master","ref":"master","sha":"f52192569c8f76688d19f265a87bb6e94189bab7","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-06-23T17:42:58Z","pushed_at":"2015-06-23T18:05:19Z","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":39506,"stargazers_count":4753,"watchers_count":4753,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":345,"mirror_url":null,"open_issues_count":95,"forks":345,"open_issues":95,"watchers":4753,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/1445"},"html":{"href":"https://github.com/cockroachdb/cockroach/pull/1445"},"issue":{"href":"https://api.github.com/repos/cockroachdb/cockroach/issues/1445"},"comments":{"href":"https://api.github.com/repos/cockroachdb/cockroach/issues/1445/comments"},"review_comments":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/1445/comments"},"review_comment":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/1445/commits"},"statuses":{"href":"https://api.github.com/repos/cockroachdb/cockroach/statuses/6c5a3a084dcd16df75f4183b47291adaf0f714f7"}}}}