{"action":"created","comment":{"url":"https://api.github.com/repos/coreos/etcd/pulls/comments/83728466","pull_request_review_id":4553464,"id":83728466,"diff_hunk":"@@ -0,0 +1,116 @@\n+// Copyright 2016 The etcd Authors\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+//     http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+package clientv3\n+\n+import (\n+\t\"errors\"\n+\t\"testing\"\n+\t\"time\"\n+\n+\t\"golang.org/x/net/context\"\n+\t\"google.golang.org/grpc\"\n+)\n+\n+var (\n+\tendpoints = []string{\"localhost:2379\", \"localhost:22379\", \"localhost:32379\"}\n+)\n+\n+func TestBalancerGetUnblocking(t *testing.T) {\n+\tsb := newSimpleBalancer(endpoints)\n+\tunblockingOpts := grpc.BalancerGetOptions{BlockingWait: false}\n+\n+\t_, _, err := sb.Get(context.Background(), unblockingOpts)\n+\tif err != ErrNoAddrAvilable {\n+\t\tt.Errorf(\n+\t\t\t\"Get() with no up endpoints should return ErrNoAddrAvailable, got: %v\",\n+\t\t\terr,\n+\t\t)\n+\t}\n+\n+\tdownFun1 := sb.Up(grpc.Address{Addr: endpoints[1]})\n+\tdownFun2 := sb.Up(grpc.Address{Addr: endpoints[2]})\n+\taddrFirst, putFun, err := sb.Get(context.Background(), unblockingOpts)\n+\tif err != nil {\n+\t\tt.Errorf(\"Get() with up endpoints should sucess, got %v\", err)\n+\t}\n+\tif addrFirst.Addr != endpoints[1] && addrFirst.Addr != endpoints[2] {\n+\t\tt.Errorf(\"Get() didn't return expected address, got %v\", addrFirst)\n+\t}\n+\tif putFun == nil {\n+\t\tt.Errorf(\"Get() returned unexpected nil put function\")\n+\t}\n+\taddrSecond, _, _ := sb.Get(context.Background(), unblockingOpts)\n+\tif addrSecond.Addr != addrSecond.Addr {\n+\t\tt.Errorf(\n+\t\t\t\"Get() didn't return the same address as previous call, got %v and %v\",\n+\t\t\taddrFirst, addrSecond,\n+\t\t)\n+\t}\n+\n+\tdownFun1(errors.New(\"error\"))\n+\tdownFun2(errors.New(\"error\"))\n+\t_, _, err = sb.Get(context.Background(), unblockingOpts)\n+\tif err != ErrNoAddrAvilable {\n+\t\tt.Errorf(\n+\t\t\t\"Get() with no up endpoints should return ErrNoAddrAvailable, got: %v\",\n+\t\t\terr,\n+\t\t)\n+\t}\n+}\n+\n+func TestBalancerGetBlocking(t *testing.T) {\n+\tsb := newSimpleBalancer(endpoints)\n+\tblockingOpts := grpc.BalancerGetOptions{BlockingWait: true}\n+\n+\tctx, _ := context.WithTimeout(context.Background(), time.Second)","path":"clientv3/balancer_test.go","position":77,"original_position":77,"commit_id":"032b55686f5b5afaa7adb773181abab3b3f35871","original_commit_id":"032b55686f5b5afaa7adb773181abab3b3f35871","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},"body":"shorten the deadline? probably 100ms?","created_at":"2016-10-17T20:37:45Z","updated_at":"2016-10-17T20:37:45Z","html_url":"https://github.com/coreos/etcd/pull/6656#discussion_r83728466","pull_request_url":"https://api.github.com/repos/coreos/etcd/pulls/6656","_links":{"self":{"href":"https://api.github.com/repos/coreos/etcd/pulls/comments/83728466"},"html":{"href":"https://github.com/coreos/etcd/pull/6656#discussion_r83728466"},"pull_request":{"href":"https://api.github.com/repos/coreos/etcd/pulls/6656"}}},"pull_request":{"url":"https://api.github.com/repos/coreos/etcd/pulls/6656","id":89456052,"html_url":"https://github.com/coreos/etcd/pull/6656","diff_url":"https://github.com/coreos/etcd/pull/6656.diff","patch_url":"https://github.com/coreos/etcd/pull/6656.patch","issue_url":"https://api.github.com/repos/coreos/etcd/issues/6656","number":6656,"state":"open","locked":false,"title":"clientv3: make balancer respect FastFail","user":{"login":"yudai","id":33192,"avatar_url":"https://avatars.githubusercontent.com/u/33192?v=3","gravatar_id":"","url":"https://api.github.com/users/yudai","html_url":"https://github.com/yudai","followers_url":"https://api.github.com/users/yudai/followers","following_url":"https://api.github.com/users/yudai/following{/other_user}","gists_url":"https://api.github.com/users/yudai/gists{/gist_id}","starred_url":"https://api.github.com/users/yudai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yudai/subscriptions","organizations_url":"https://api.github.com/users/yudai/orgs","repos_url":"https://api.github.com/users/yudai/repos","events_url":"https://api.github.com/users/yudai/events{/privacy}","received_events_url":"https://api.github.com/users/yudai/received_events","type":"User","site_admin":false},"body":"The simpleBalancer.Get() blocks grpc.Invoke() even when the Invoke() is called\r\nwith the FastFail option. Therefore currently any requests with the\r\nFailFast option actually doesn't fail fast. They get blocked when there is\r\nno endpoints available.\r\nGet() method need to respect the BlockingWait option when\r\npicks up an endpoint address from the list and fail immediately when the option is\r\nenabled.\r\n\r\n---\r\n\r\nI feel like that there could be some code that depends on the current behavior which doesn't return an error even when there is no endpoint available, so we might need to add the `FastFail(false)` option to each RPC calls to keep backward compatibility.\r\n\r\nOn top of this change, I'm wondering if we can add a new option like `clientv3.WithFastFail()` not to wait for endpoints to be recovered. I sometimes want to get an error immediately from the client rather than waiting for recovery.","created_at":"2016-10-14T21:14:49Z","updated_at":"2016-10-17T20:37:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"699186b55df24fd3788dfd8d22a0bf1c91de54e7","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/coreos/etcd/pulls/6656/commits","review_comments_url":"https://api.github.com/repos/coreos/etcd/pulls/6656/comments","review_comment_url":"https://api.github.com/repos/coreos/etcd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/coreos/etcd/issues/6656/comments","statuses_url":"https://api.github.com/repos/coreos/etcd/statuses/032b55686f5b5afaa7adb773181abab3b3f35871","head":{"label":"yudai:balancer_fast_fail","ref":"balancer_fast_fail","sha":"032b55686f5b5afaa7adb773181abab3b3f35871","user":{"login":"yudai","id":33192,"avatar_url":"https://avatars.githubusercontent.com/u/33192?v=3","gravatar_id":"","url":"https://api.github.com/users/yudai","html_url":"https://github.com/yudai","followers_url":"https://api.github.com/users/yudai/followers","following_url":"https://api.github.com/users/yudai/following{/other_user}","gists_url":"https://api.github.com/users/yudai/gists{/gist_id}","starred_url":"https://api.github.com/users/yudai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yudai/subscriptions","organizations_url":"https://api.github.com/users/yudai/orgs","repos_url":"https://api.github.com/users/yudai/repos","events_url":"https://api.github.com/users/yudai/events{/privacy}","received_events_url":"https://api.github.com/users/yudai/received_events","type":"User","site_admin":false},"repo":{"id":70885308,"name":"etcd","full_name":"yudai/etcd","owner":{"login":"yudai","id":33192,"avatar_url":"https://avatars.githubusercontent.com/u/33192?v=3","gravatar_id":"","url":"https://api.github.com/users/yudai","html_url":"https://github.com/yudai","followers_url":"https://api.github.com/users/yudai/followers","following_url":"https://api.github.com/users/yudai/following{/other_user}","gists_url":"https://api.github.com/users/yudai/gists{/gist_id}","starred_url":"https://api.github.com/users/yudai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yudai/subscriptions","organizations_url":"https://api.github.com/users/yudai/orgs","repos_url":"https://api.github.com/users/yudai/repos","events_url":"https://api.github.com/users/yudai/events{/privacy}","received_events_url":"https://api.github.com/users/yudai/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yudai/etcd","description":"Distributed reliable key-value store for the most critical data of a distributed system","fork":true,"url":"https://api.github.com/repos/yudai/etcd","forks_url":"https://api.github.com/repos/yudai/etcd/forks","keys_url":"https://api.github.com/repos/yudai/etcd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yudai/etcd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yudai/etcd/teams","hooks_url":"https://api.github.com/repos/yudai/etcd/hooks","issue_events_url":"https://api.github.com/repos/yudai/etcd/issues/events{/number}","events_url":"https://api.github.com/repos/yudai/etcd/events","assignees_url":"https://api.github.com/repos/yudai/etcd/assignees{/user}","branches_url":"https://api.github.com/repos/yudai/etcd/branches{/branch}","tags_url":"https://api.github.com/repos/yudai/etcd/tags","blobs_url":"https://api.github.com/repos/yudai/etcd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yudai/etcd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yudai/etcd/git/refs{/sha}","trees_url":"https://api.github.com/repos/yudai/etcd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yudai/etcd/statuses/{sha}","languages_url":"https://api.github.com/repos/yudai/etcd/languages","stargazers_url":"https://api.github.com/repos/yudai/etcd/stargazers","contributors_url":"https://api.github.com/repos/yudai/etcd/contributors","subscribers_url":"https://api.github.com/repos/yudai/etcd/subscribers","subscription_url":"https://api.github.com/repos/yudai/etcd/subscription","commits_url":"https://api.github.com/repos/yudai/etcd/commits{/sha}","git_commits_url":"https://api.github.com/repos/yudai/etcd/git/commits{/sha}","comments_url":"https://api.github.com/repos/yudai/etcd/comments{/number}","issue_comment_url":"https://api.github.com/repos/yudai/etcd/issues/comments{/number}","contents_url":"https://api.github.com/repos/yudai/etcd/contents/{+path}","compare_url":"https://api.github.com/repos/yudai/etcd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yudai/etcd/merges","archive_url":"https://api.github.com/repos/yudai/etcd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yudai/etcd/downloads","issues_url":"https://api.github.com/repos/yudai/etcd/issues{/number}","pulls_url":"https://api.github.com/repos/yudai/etcd/pulls{/number}","milestones_url":"https://api.github.com/repos/yudai/etcd/milestones{/number}","notifications_url":"https://api.github.com/repos/yudai/etcd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yudai/etcd/labels{/name}","releases_url":"https://api.github.com/repos/yudai/etcd/releases{/id}","deployments_url":"https://api.github.com/repos/yudai/etcd/deployments","created_at":"2016-10-14T07:29:32Z","updated_at":"2016-10-14T07:29:35Z","pushed_at":"2016-10-17T20:33:40Z","git_url":"git://github.com/yudai/etcd.git","ssh_url":"git@github.com:yudai/etcd.git","clone_url":"https://github.com/yudai/etcd.git","svn_url":"https://github.com/yudai/etcd","homepage":"https://coreos.com/etcd/docs/latest/","size":25348,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"coreos:master","ref":"master","sha":"24c284160bc5f12a30fce25148ca40ce26c98280","user":{"login":"coreos","id":3730757,"avatar_url":"https://avatars.githubusercontent.com/u/3730757?v=3","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"repo":{"id":11225014,"name":"etcd","full_name":"coreos/etcd","owner":{"login":"coreos","id":3730757,"avatar_url":"https://avatars.githubusercontent.com/u/3730757?v=3","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coreos/etcd","description":"Distributed reliable key-value store for the most critical data of a distributed system","fork":false,"url":"https://api.github.com/repos/coreos/etcd","forks_url":"https://api.github.com/repos/coreos/etcd/forks","keys_url":"https://api.github.com/repos/coreos/etcd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coreos/etcd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coreos/etcd/teams","hooks_url":"https://api.github.com/repos/coreos/etcd/hooks","issue_events_url":"https://api.github.com/repos/coreos/etcd/issues/events{/number}","events_url":"https://api.github.com/repos/coreos/etcd/events","assignees_url":"https://api.github.com/repos/coreos/etcd/assignees{/user}","branches_url":"https://api.github.com/repos/coreos/etcd/branches{/branch}","tags_url":"https://api.github.com/repos/coreos/etcd/tags","blobs_url":"https://api.github.com/repos/coreos/etcd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coreos/etcd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coreos/etcd/git/refs{/sha}","trees_url":"https://api.github.com/repos/coreos/etcd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coreos/etcd/statuses/{sha}","languages_url":"https://api.github.com/repos/coreos/etcd/languages","stargazers_url":"https://api.github.com/repos/coreos/etcd/stargazers","contributors_url":"https://api.github.com/repos/coreos/etcd/contributors","subscribers_url":"https://api.github.com/repos/coreos/etcd/subscribers","subscription_url":"https://api.github.com/repos/coreos/etcd/subscription","commits_url":"https://api.github.com/repos/coreos/etcd/commits{/sha}","git_commits_url":"https://api.github.com/repos/coreos/etcd/git/commits{/sha}","comments_url":"https://api.github.com/repos/coreos/etcd/comments{/number}","issue_comment_url":"https://api.github.com/repos/coreos/etcd/issues/comments{/number}","contents_url":"https://api.github.com/repos/coreos/etcd/contents/{+path}","compare_url":"https://api.github.com/repos/coreos/etcd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coreos/etcd/merges","archive_url":"https://api.github.com/repos/coreos/etcd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coreos/etcd/downloads","issues_url":"https://api.github.com/repos/coreos/etcd/issues{/number}","pulls_url":"https://api.github.com/repos/coreos/etcd/pulls{/number}","milestones_url":"https://api.github.com/repos/coreos/etcd/milestones{/number}","notifications_url":"https://api.github.com/repos/coreos/etcd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coreos/etcd/labels{/name}","releases_url":"https://api.github.com/repos/coreos/etcd/releases{/id}","deployments_url":"https://api.github.com/repos/coreos/etcd/deployments","created_at":"2013-07-06T21:57:21Z","updated_at":"2016-10-17T19:56:27Z","pushed_at":"2016-10-17T20:33:41Z","git_url":"git://github.com/coreos/etcd.git","ssh_url":"git@github.com:coreos/etcd.git","clone_url":"https://github.com/coreos/etcd.git","svn_url":"https://github.com/coreos/etcd","homepage":"https://coreos.com/etcd/docs/latest/","size":32882,"stargazers_count":11142,"watchers_count":11142,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1973,"mirror_url":null,"open_issues_count":127,"forks":1973,"open_issues":127,"watchers":11142,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/coreos/etcd/pulls/6656"},"html":{"href":"https://github.com/coreos/etcd/pull/6656"},"issue":{"href":"https://api.github.com/repos/coreos/etcd/issues/6656"},"comments":{"href":"https://api.github.com/repos/coreos/etcd/issues/6656/comments"},"review_comments":{"href":"https://api.github.com/repos/coreos/etcd/pulls/6656/comments"},"review_comment":{"href":"https://api.github.com/repos/coreos/etcd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/coreos/etcd/pulls/6656/commits"},"statuses":{"href":"https://api.github.com/repos/coreos/etcd/statuses/032b55686f5b5afaa7adb773181abab3b3f35871"}}}}
{"actor":{"display_login":"xiang90"}}