{"action":"created","comment":{"url":"https://api.github.com/repos/coreos/etcd/pulls/comments/82912148","pull_request_review_id":3779765,"id":82912148,"diff_hunk":"@@ -0,0 +1,300 @@\n+// Copyright 2015 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 main\n+\n+import (\n+\t\"fmt\"\n+\t\"math/rand\"\n+\t\"sync\"\n+\t\"time\"\n+\n+\t\"github.com/coreos/etcd/clientv3\"\n+\t\"github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes\"\n+\tpb \"github.com/coreos/etcd/etcdserver/etcdserverpb\"\n+\t\"golang.org/x/net/context\"\n+\t\"google.golang.org/grpc\"\n+)\n+\n+// time to live for lease\n+const TTL = 15\n+\n+type leaseStressConfig struct {\n+\tnumOfLeases  int\n+\tkeysPerLease int\n+}\n+\n+type leaseStresser struct {\n+\tendpoint string\n+\tcancel   func()\n+\tconn     *grpc.ClientConn\n+\tkvc      pb.KVClient\n+\tlc       pb.LeaseClient\n+\n+\tsuccess      int\n+\tfailure      int\n+\tnumOfLeases  int\n+\tkeysPerLease int\n+\n+\t// mu Mutex is used to protect the shared maps aliveLeases and revokedLeases\n+\t// which are accessed and modified by different go routines.\n+\tmu            sync.Mutex\n+\taliveLeases   map[int64]struct{}\n+\trevokedLeases map[int64]struct{}\n+\n+\trunWg   sync.WaitGroup\n+\taliveWg sync.WaitGroup\n+\n+\thasSetup bool\n+}\n+\n+type leaseStresserBuilder func(m *member) Stresser\n+\n+func newLeaseStresserBuilder(lsConfig *leaseStressConfig, lsTracker func(*leaseStresser)) leaseStresserBuilder {\n+\treturn func(mem *member) Stresser {\n+\t\tls := &leaseStresser{\n+\t\t\tendpoint:     mem.grpcAddr(),\n+\t\t\tnumOfLeases:  lsConfig.numOfLeases,\n+\t\t\tkeysPerLease: lsConfig.keysPerLease,\n+\t\t}\n+\t\tlsTracker(ls)\n+\t\treturn ls\n+\t}\n+}\n+\n+// setupOnce initialize the fields once beucase the leaseStresser is longliving and doesn't need to be re-initialize on each stress() call.\n+func (ls *leaseStresser) setupOnce() error {\n+\tif ls.hasSetup {","path":"tools/functional-tester/etcd-tester/lease_stresser.go","position":78,"original_position":78,"commit_id":"acb5011f63e40cf2d6dad9a3a48a9bfd5b007911","original_commit_id":"acb5011f63e40cf2d6dad9a3a48a9bfd5b007911","user":{"login":"heyitsanthony","id":16294350,"avatar_url":"https://avatars.githubusercontent.com/u/16294350?v=3","gravatar_id":"","url":"https://api.github.com/users/heyitsanthony","html_url":"https://github.com/heyitsanthony","followers_url":"https://api.github.com/users/heyitsanthony/followers","following_url":"https://api.github.com/users/heyitsanthony/following{/other_user}","gists_url":"https://api.github.com/users/heyitsanthony/gists{/gist_id}","starred_url":"https://api.github.com/users/heyitsanthony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heyitsanthony/subscriptions","organizations_url":"https://api.github.com/users/heyitsanthony/orgs","repos_url":"https://api.github.com/users/heyitsanthony/repos","events_url":"https://api.github.com/users/heyitsanthony/events{/privacy}","received_events_url":"https://api.github.com/users/heyitsanthony/received_events","type":"User","site_admin":false},"body":"`if ls.conn != nil { return nil }`; `hasSetup` is redundant","created_at":"2016-10-11T23:43:10Z","updated_at":"2016-10-11T23:49:15Z","html_url":"https://github.com/coreos/etcd/pull/6588#discussion_r82912148","pull_request_url":"https://api.github.com/repos/coreos/etcd/pulls/6588","_links":{"self":{"href":"https://api.github.com/repos/coreos/etcd/pulls/comments/82912148"},"html":{"href":"https://github.com/coreos/etcd/pull/6588#discussion_r82912148"},"pull_request":{"href":"https://api.github.com/repos/coreos/etcd/pulls/6588"}}},"pull_request":{"url":"https://api.github.com/repos/coreos/etcd/pulls/6588","id":88121277,"html_url":"https://github.com/coreos/etcd/pull/6588","diff_url":"https://github.com/coreos/etcd/pull/6588.diff","patch_url":"https://github.com/coreos/etcd/pull/6588.patch","issue_url":"https://api.github.com/repos/coreos/etcd/issues/6588","number":6588,"state":"open","locked":false,"title":"functional-tester: add lease stresser","user":{"login":"fanminshi","id":4983345,"avatar_url":"https://avatars.githubusercontent.com/u/4983345?v=3","gravatar_id":"","url":"https://api.github.com/users/fanminshi","html_url":"https://github.com/fanminshi","followers_url":"https://api.github.com/users/fanminshi/followers","following_url":"https://api.github.com/users/fanminshi/following{/other_user}","gists_url":"https://api.github.com/users/fanminshi/gists{/gist_id}","starred_url":"https://api.github.com/users/fanminshi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fanminshi/subscriptions","organizations_url":"https://api.github.com/users/fanminshi/orgs","repos_url":"https://api.github.com/users/fanminshi/repos","events_url":"https://api.github.com/users/fanminshi/events{/privacy}","received_events_url":"https://api.github.com/users/fanminshi/received_events","type":"User","site_admin":false},"body":"Add lease stresser to test lease code under stress and etcd failtures\r\n\r\nresolve #6380\r\n","created_at":"2016-10-05T17:26:52Z","updated_at":"2016-10-11T23:49:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6695a7eb4cd521747b19ea6084eeeae03e6a3df0","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/coreos/etcd/pulls/6588/commits","review_comments_url":"https://api.github.com/repos/coreos/etcd/pulls/6588/comments","review_comment_url":"https://api.github.com/repos/coreos/etcd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/coreos/etcd/issues/6588/comments","statuses_url":"https://api.github.com/repos/coreos/etcd/statuses/acb5011f63e40cf2d6dad9a3a48a9bfd5b007911","head":{"label":"fanminshi:lease_stressor","ref":"lease_stressor","sha":"acb5011f63e40cf2d6dad9a3a48a9bfd5b007911","user":{"login":"fanminshi","id":4983345,"avatar_url":"https://avatars.githubusercontent.com/u/4983345?v=3","gravatar_id":"","url":"https://api.github.com/users/fanminshi","html_url":"https://github.com/fanminshi","followers_url":"https://api.github.com/users/fanminshi/followers","following_url":"https://api.github.com/users/fanminshi/following{/other_user}","gists_url":"https://api.github.com/users/fanminshi/gists{/gist_id}","starred_url":"https://api.github.com/users/fanminshi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fanminshi/subscriptions","organizations_url":"https://api.github.com/users/fanminshi/orgs","repos_url":"https://api.github.com/users/fanminshi/repos","events_url":"https://api.github.com/users/fanminshi/events{/privacy}","received_events_url":"https://api.github.com/users/fanminshi/received_events","type":"User","site_admin":false},"repo":{"id":67535590,"name":"etcd","full_name":"fanminshi/etcd","owner":{"login":"fanminshi","id":4983345,"avatar_url":"https://avatars.githubusercontent.com/u/4983345?v=3","gravatar_id":"","url":"https://api.github.com/users/fanminshi","html_url":"https://github.com/fanminshi","followers_url":"https://api.github.com/users/fanminshi/followers","following_url":"https://api.github.com/users/fanminshi/following{/other_user}","gists_url":"https://api.github.com/users/fanminshi/gists{/gist_id}","starred_url":"https://api.github.com/users/fanminshi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fanminshi/subscriptions","organizations_url":"https://api.github.com/users/fanminshi/orgs","repos_url":"https://api.github.com/users/fanminshi/repos","events_url":"https://api.github.com/users/fanminshi/events{/privacy}","received_events_url":"https://api.github.com/users/fanminshi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fanminshi/etcd","description":"Distributed reliable key-value store for the most critical data of a distributed system","fork":true,"url":"https://api.github.com/repos/fanminshi/etcd","forks_url":"https://api.github.com/repos/fanminshi/etcd/forks","keys_url":"https://api.github.com/repos/fanminshi/etcd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fanminshi/etcd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fanminshi/etcd/teams","hooks_url":"https://api.github.com/repos/fanminshi/etcd/hooks","issue_events_url":"https://api.github.com/repos/fanminshi/etcd/issues/events{/number}","events_url":"https://api.github.com/repos/fanminshi/etcd/events","assignees_url":"https://api.github.com/repos/fanminshi/etcd/assignees{/user}","branches_url":"https://api.github.com/repos/fanminshi/etcd/branches{/branch}","tags_url":"https://api.github.com/repos/fanminshi/etcd/tags","blobs_url":"https://api.github.com/repos/fanminshi/etcd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fanminshi/etcd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fanminshi/etcd/git/refs{/sha}","trees_url":"https://api.github.com/repos/fanminshi/etcd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fanminshi/etcd/statuses/{sha}","languages_url":"https://api.github.com/repos/fanminshi/etcd/languages","stargazers_url":"https://api.github.com/repos/fanminshi/etcd/stargazers","contributors_url":"https://api.github.com/repos/fanminshi/etcd/contributors","subscribers_url":"https://api.github.com/repos/fanminshi/etcd/subscribers","subscription_url":"https://api.github.com/repos/fanminshi/etcd/subscription","commits_url":"https://api.github.com/repos/fanminshi/etcd/commits{/sha}","git_commits_url":"https://api.github.com/repos/fanminshi/etcd/git/commits{/sha}","comments_url":"https://api.github.com/repos/fanminshi/etcd/comments{/number}","issue_comment_url":"https://api.github.com/repos/fanminshi/etcd/issues/comments{/number}","contents_url":"https://api.github.com/repos/fanminshi/etcd/contents/{+path}","compare_url":"https://api.github.com/repos/fanminshi/etcd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fanminshi/etcd/merges","archive_url":"https://api.github.com/repos/fanminshi/etcd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fanminshi/etcd/downloads","issues_url":"https://api.github.com/repos/fanminshi/etcd/issues{/number}","pulls_url":"https://api.github.com/repos/fanminshi/etcd/pulls{/number}","milestones_url":"https://api.github.com/repos/fanminshi/etcd/milestones{/number}","notifications_url":"https://api.github.com/repos/fanminshi/etcd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fanminshi/etcd/labels{/name}","releases_url":"https://api.github.com/repos/fanminshi/etcd/releases{/id}","deployments_url":"https://api.github.com/repos/fanminshi/etcd/deployments","created_at":"2016-09-06T18:28:06Z","updated_at":"2016-09-06T18:28:10Z","pushed_at":"2016-10-11T21:21:35Z","git_url":"git://github.com/fanminshi/etcd.git","ssh_url":"git@github.com:fanminshi/etcd.git","clone_url":"https://github.com/fanminshi/etcd.git","svn_url":"https://github.com/fanminshi/etcd","homepage":"https://coreos.com/etcd/docs/latest/","size":25201,"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":"c10dad41a3a1dbac734e096ad99a7dff830f0d22","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-11T17:45:45Z","pushed_at":"2016-10-11T23:38:43Z","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":32831,"stargazers_count":11064,"watchers_count":11064,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1959,"mirror_url":null,"open_issues_count":133,"forks":1959,"open_issues":133,"watchers":11064,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/coreos/etcd/pulls/6588"},"html":{"href":"https://github.com/coreos/etcd/pull/6588"},"issue":{"href":"https://api.github.com/repos/coreos/etcd/issues/6588"},"comments":{"href":"https://api.github.com/repos/coreos/etcd/issues/6588/comments"},"review_comments":{"href":"https://api.github.com/repos/coreos/etcd/pulls/6588/comments"},"review_comment":{"href":"https://api.github.com/repos/coreos/etcd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/coreos/etcd/pulls/6588/commits"},"statuses":{"href":"https://api.github.com/repos/coreos/etcd/statuses/acb5011f63e40cf2d6dad9a3a48a9bfd5b007911"}}}}
{"actor":{"display_login":"heyitsanthony"}}