{"action":"created","comment":{"url":"https://api.github.com/repos/projectcalico/libcalico-go/pulls/comments/168277723","pull_request_review_id":96619229,"id":168277723,"diff_hunk":"@@ -204,24 +229,43 @@ func (rw blockReaderWriter) claimBlockAffinity(ctx context.Context, subnet cnet.\n \t\t\tif b.Affinity != nil && *b.Affinity == affinityKeyStr {\n \t\t\t\t// Block has affinity to this host, meaning another\n \t\t\t\t// process on this host claimed it.\n-\t\t\t\tlog.Debugf(\"Block %s already claimed by us.  Success\", subnet)\n-\t\t\t\treturn nil\n+\t\t\t\tlog.Debugf(\"Block %s already claimed by us.\", subnet)\n+\t\t\t\treturn rw.confirmAffinity(ctx, host, subnet)\n \t\t\t}\n \n-\t\t\t// Some other host beat us to this block.  Cleanup and return error.\n-\t\t\t_, err = rw.client.Delete(ctx, model.BlockAffinityKey{Host: host, CIDR: b.CIDR}, \"\")\n+\t\t\t// Some other host beat us to this block.  Cleanup and return an error.\n+\t\t\t_, err = rw.client.Delete(ctx, model.BlockAffinityKey{Host: host, CIDR: b.CIDR}, aff.Revision)\n \t\t\tif err != nil {\n-\t\t\t\tlog.Errorf(\"Error cleaning up block affinity: %v\", err)\n-\t\t\t\treturn err\n+\t\t\t\t// Failed to clean up our claim to this block.\n+\t\t\t\tlog.WithError(err).Errorf(\"Error cleaning up block affinity after failed claim\")\n+\t\t\t\treturn affinityClaimedError{Block: b}\n \t\t\t}\n \t\t\treturn affinityClaimedError{Block: b}","path":"lib/ipam/ipam_block_reader_writer.go","position":103,"original_position":103,"commit_id":"f3ed708ddd4b61b22c7f4fcfc7bcf0a4929555cf","original_commit_id":"f3ed708ddd4b61b22c7f4fcfc7bcf0a4929555cf","user":{"login":"caseydavenport","id":1944093,"avatar_url":"https://avatars3.githubusercontent.com/u/1944093?v=4","gravatar_id":"","url":"https://api.github.com/users/caseydavenport","html_url":"https://github.com/caseydavenport","followers_url":"https://api.github.com/users/caseydavenport/followers","following_url":"https://api.github.com/users/caseydavenport/following{/other_user}","gists_url":"https://api.github.com/users/caseydavenport/gists{/gist_id}","starred_url":"https://api.github.com/users/caseydavenport/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caseydavenport/subscriptions","organizations_url":"https://api.github.com/users/caseydavenport/orgs","repos_url":"https://api.github.com/users/caseydavenport/repos","events_url":"https://api.github.com/users/caseydavenport/events{/privacy}","received_events_url":"https://api.github.com/users/caseydavenport/received_events","type":"User","site_admin":false},"body":"hehe, yeah. ","created_at":"2018-02-14T19:05:36Z","updated_at":"2018-02-14T19:05:36Z","html_url":"https://github.com/projectcalico/libcalico-go/pull/785#discussion_r168277723","pull_request_url":"https://api.github.com/repos/projectcalico/libcalico-go/pulls/785","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/projectcalico/libcalico-go/pulls/comments/168277723"},"html":{"href":"https://github.com/projectcalico/libcalico-go/pull/785#discussion_r168277723"},"pull_request":{"href":"https://api.github.com/repos/projectcalico/libcalico-go/pulls/785"}},"in_reply_to_id":168129594},"pull_request":{"url":"https://api.github.com/repos/projectcalico/libcalico-go/pulls/785","id":169005176,"html_url":"https://github.com/projectcalico/libcalico-go/pull/785","diff_url":"https://github.com/projectcalico/libcalico-go/pull/785.diff","patch_url":"https://github.com/projectcalico/libcalico-go/pull/785.patch","issue_url":"https://api.github.com/repos/projectcalico/libcalico-go/issues/785","number":785,"state":"open","locked":false,"title":"[WIP] Fix affinity claim race","user":{"login":"caseydavenport","id":1944093,"avatar_url":"https://avatars3.githubusercontent.com/u/1944093?v=4","gravatar_id":"","url":"https://api.github.com/users/caseydavenport","html_url":"https://github.com/caseydavenport","followers_url":"https://api.github.com/users/caseydavenport/followers","following_url":"https://api.github.com/users/caseydavenport/following{/other_user}","gists_url":"https://api.github.com/users/caseydavenport/gists{/gist_id}","starred_url":"https://api.github.com/users/caseydavenport/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caseydavenport/subscriptions","organizations_url":"https://api.github.com/users/caseydavenport/orgs","repos_url":"https://api.github.com/users/caseydavenport/repos","events_url":"https://api.github.com/users/caseydavenport/events{/privacy}","received_events_url":"https://api.github.com/users/caseydavenport/received_events","type":"User","site_admin":false},"body":"## Description\r\n<!-- A few sentences describing the overall goals of the pull request's commits.\r\nPlease include\r\n- the type of fix - (e.g. bug fix, new feature, documentation)\r\n- some details on _why_ this PR should be merged\r\n- the details of the testing you've done on it (both manual and automated)\r\n- which components are affected by this PR\r\n- links to issues that this PR addresses\r\n-->\r\n\r\nFixes #778 \r\n\r\n## Todos\r\n- [ ] Tests\r\n- [ ] Documentation\r\n- [ ] Release note\r\n\r\n## Release Note\r\n<!-- Writing a release note:\r\n- By default, no release note action is required.\r\n- If you're unsure whether or not your PR needs a note, ask your reviewer for guidance.\r\n- If this PR requires a release note, update the block below to include a concise note describing\r\n  the change and any important impacts this PR may have.\r\n-->\r\n\r\n```release-note\r\nNone required\r\n```\r\n","created_at":"2018-02-14T02:00:45Z","updated_at":"2018-02-14T19:05:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"14871f93ad1333c3d0503e0f068bd90610cdb321","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/projectcalico/libcalico-go/pulls/785/commits","review_comments_url":"https://api.github.com/repos/projectcalico/libcalico-go/pulls/785/comments","review_comment_url":"https://api.github.com/repos/projectcalico/libcalico-go/pulls/comments{/number}","comments_url":"https://api.github.com/repos/projectcalico/libcalico-go/issues/785/comments","statuses_url":"https://api.github.com/repos/projectcalico/libcalico-go/statuses/f3ed708ddd4b61b22c7f4fcfc7bcf0a4929555cf","head":{"label":"caseydavenport:fix-ipam-race","ref":"fix-ipam-race","sha":"f3ed708ddd4b61b22c7f4fcfc7bcf0a4929555cf","user":{"login":"caseydavenport","id":1944093,"avatar_url":"https://avatars3.githubusercontent.com/u/1944093?v=4","gravatar_id":"","url":"https://api.github.com/users/caseydavenport","html_url":"https://github.com/caseydavenport","followers_url":"https://api.github.com/users/caseydavenport/followers","following_url":"https://api.github.com/users/caseydavenport/following{/other_user}","gists_url":"https://api.github.com/users/caseydavenport/gists{/gist_id}","starred_url":"https://api.github.com/users/caseydavenport/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caseydavenport/subscriptions","organizations_url":"https://api.github.com/users/caseydavenport/orgs","repos_url":"https://api.github.com/users/caseydavenport/repos","events_url":"https://api.github.com/users/caseydavenport/events{/privacy}","received_events_url":"https://api.github.com/users/caseydavenport/received_events","type":"User","site_admin":false},"repo":{"id":63621502,"name":"libcalico-go","full_name":"caseydavenport/libcalico-go","owner":{"login":"caseydavenport","id":1944093,"avatar_url":"https://avatars3.githubusercontent.com/u/1944093?v=4","gravatar_id":"","url":"https://api.github.com/users/caseydavenport","html_url":"https://github.com/caseydavenport","followers_url":"https://api.github.com/users/caseydavenport/followers","following_url":"https://api.github.com/users/caseydavenport/following{/other_user}","gists_url":"https://api.github.com/users/caseydavenport/gists{/gist_id}","starred_url":"https://api.github.com/users/caseydavenport/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caseydavenport/subscriptions","organizations_url":"https://api.github.com/users/caseydavenport/orgs","repos_url":"https://api.github.com/users/caseydavenport/repos","events_url":"https://api.github.com/users/caseydavenport/events{/privacy}","received_events_url":"https://api.github.com/users/caseydavenport/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/caseydavenport/libcalico-go","description":"Golang Calico library functions:  https://www.projectcalico.org","fork":true,"url":"https://api.github.com/repos/caseydavenport/libcalico-go","forks_url":"https://api.github.com/repos/caseydavenport/libcalico-go/forks","keys_url":"https://api.github.com/repos/caseydavenport/libcalico-go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/caseydavenport/libcalico-go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/caseydavenport/libcalico-go/teams","hooks_url":"https://api.github.com/repos/caseydavenport/libcalico-go/hooks","issue_events_url":"https://api.github.com/repos/caseydavenport/libcalico-go/issues/events{/number}","events_url":"https://api.github.com/repos/caseydavenport/libcalico-go/events","assignees_url":"https://api.github.com/repos/caseydavenport/libcalico-go/assignees{/user}","branches_url":"https://api.github.com/repos/caseydavenport/libcalico-go/branches{/branch}","tags_url":"https://api.github.com/repos/caseydavenport/libcalico-go/tags","blobs_url":"https://api.github.com/repos/caseydavenport/libcalico-go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/caseydavenport/libcalico-go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/caseydavenport/libcalico-go/git/refs{/sha}","trees_url":"https://api.github.com/repos/caseydavenport/libcalico-go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/caseydavenport/libcalico-go/statuses/{sha}","languages_url":"https://api.github.com/repos/caseydavenport/libcalico-go/languages","stargazers_url":"https://api.github.com/repos/caseydavenport/libcalico-go/stargazers","contributors_url":"https://api.github.com/repos/caseydavenport/libcalico-go/contributors","subscribers_url":"https://api.github.com/repos/caseydavenport/libcalico-go/subscribers","subscription_url":"https://api.github.com/repos/caseydavenport/libcalico-go/subscription","commits_url":"https://api.github.com/repos/caseydavenport/libcalico-go/commits{/sha}","git_commits_url":"https://api.github.com/repos/caseydavenport/libcalico-go/git/commits{/sha}","comments_url":"https://api.github.com/repos/caseydavenport/libcalico-go/comments{/number}","issue_comment_url":"https://api.github.com/repos/caseydavenport/libcalico-go/issues/comments{/number}","contents_url":"https://api.github.com/repos/caseydavenport/libcalico-go/contents/{+path}","compare_url":"https://api.github.com/repos/caseydavenport/libcalico-go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/caseydavenport/libcalico-go/merges","archive_url":"https://api.github.com/repos/caseydavenport/libcalico-go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/caseydavenport/libcalico-go/downloads","issues_url":"https://api.github.com/repos/caseydavenport/libcalico-go/issues{/number}","pulls_url":"https://api.github.com/repos/caseydavenport/libcalico-go/pulls{/number}","milestones_url":"https://api.github.com/repos/caseydavenport/libcalico-go/milestones{/number}","notifications_url":"https://api.github.com/repos/caseydavenport/libcalico-go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/caseydavenport/libcalico-go/labels{/name}","releases_url":"https://api.github.com/repos/caseydavenport/libcalico-go/releases{/id}","deployments_url":"https://api.github.com/repos/caseydavenport/libcalico-go/deployments","created_at":"2016-07-18T17:02:22Z","updated_at":"2016-07-18T17:02:23Z","pushed_at":"2018-02-14T02:52:03Z","git_url":"git://github.com/caseydavenport/libcalico-go.git","ssh_url":"git@github.com:caseydavenport/libcalico-go.git","clone_url":"https://github.com/caseydavenport/libcalico-go.git","svn_url":"https://github.com/caseydavenport/libcalico-go","homepage":null,"size":2667,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"projectcalico:master","ref":"master","sha":"13d015d6433fd53fb260dc2b3ab50340c34f5749","user":{"login":"projectcalico","id":12304728,"avatar_url":"https://avatars3.githubusercontent.com/u/12304728?v=4","gravatar_id":"","url":"https://api.github.com/users/projectcalico","html_url":"https://github.com/projectcalico","followers_url":"https://api.github.com/users/projectcalico/followers","following_url":"https://api.github.com/users/projectcalico/following{/other_user}","gists_url":"https://api.github.com/users/projectcalico/gists{/gist_id}","starred_url":"https://api.github.com/users/projectcalico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projectcalico/subscriptions","organizations_url":"https://api.github.com/users/projectcalico/orgs","repos_url":"https://api.github.com/users/projectcalico/repos","events_url":"https://api.github.com/users/projectcalico/events{/privacy}","received_events_url":"https://api.github.com/users/projectcalico/received_events","type":"Organization","site_admin":false},"repo":{"id":63438319,"name":"libcalico-go","full_name":"projectcalico/libcalico-go","owner":{"login":"projectcalico","id":12304728,"avatar_url":"https://avatars3.githubusercontent.com/u/12304728?v=4","gravatar_id":"","url":"https://api.github.com/users/projectcalico","html_url":"https://github.com/projectcalico","followers_url":"https://api.github.com/users/projectcalico/followers","following_url":"https://api.github.com/users/projectcalico/following{/other_user}","gists_url":"https://api.github.com/users/projectcalico/gists{/gist_id}","starred_url":"https://api.github.com/users/projectcalico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projectcalico/subscriptions","organizations_url":"https://api.github.com/users/projectcalico/orgs","repos_url":"https://api.github.com/users/projectcalico/repos","events_url":"https://api.github.com/users/projectcalico/events{/privacy}","received_events_url":"https://api.github.com/users/projectcalico/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/projectcalico/libcalico-go","description":"Golang Calico library functions:  https://www.projectcalico.org","fork":false,"url":"https://api.github.com/repos/projectcalico/libcalico-go","forks_url":"https://api.github.com/repos/projectcalico/libcalico-go/forks","keys_url":"https://api.github.com/repos/projectcalico/libcalico-go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/projectcalico/libcalico-go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/projectcalico/libcalico-go/teams","hooks_url":"https://api.github.com/repos/projectcalico/libcalico-go/hooks","issue_events_url":"https://api.github.com/repos/projectcalico/libcalico-go/issues/events{/number}","events_url":"https://api.github.com/repos/projectcalico/libcalico-go/events","assignees_url":"https://api.github.com/repos/projectcalico/libcalico-go/assignees{/user}","branches_url":"https://api.github.com/repos/projectcalico/libcalico-go/branches{/branch}","tags_url":"https://api.github.com/repos/projectcalico/libcalico-go/tags","blobs_url":"https://api.github.com/repos/projectcalico/libcalico-go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/projectcalico/libcalico-go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/projectcalico/libcalico-go/git/refs{/sha}","trees_url":"https://api.github.com/repos/projectcalico/libcalico-go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/projectcalico/libcalico-go/statuses/{sha}","languages_url":"https://api.github.com/repos/projectcalico/libcalico-go/languages","stargazers_url":"https://api.github.com/repos/projectcalico/libcalico-go/stargazers","contributors_url":"https://api.github.com/repos/projectcalico/libcalico-go/contributors","subscribers_url":"https://api.github.com/repos/projectcalico/libcalico-go/subscribers","subscription_url":"https://api.github.com/repos/projectcalico/libcalico-go/subscription","commits_url":"https://api.github.com/repos/projectcalico/libcalico-go/commits{/sha}","git_commits_url":"https://api.github.com/repos/projectcalico/libcalico-go/git/commits{/sha}","comments_url":"https://api.github.com/repos/projectcalico/libcalico-go/comments{/number}","issue_comment_url":"https://api.github.com/repos/projectcalico/libcalico-go/issues/comments{/number}","contents_url":"https://api.github.com/repos/projectcalico/libcalico-go/contents/{+path}","compare_url":"https://api.github.com/repos/projectcalico/libcalico-go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/projectcalico/libcalico-go/merges","archive_url":"https://api.github.com/repos/projectcalico/libcalico-go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/projectcalico/libcalico-go/downloads","issues_url":"https://api.github.com/repos/projectcalico/libcalico-go/issues{/number}","pulls_url":"https://api.github.com/repos/projectcalico/libcalico-go/pulls{/number}","milestones_url":"https://api.github.com/repos/projectcalico/libcalico-go/milestones{/number}","notifications_url":"https://api.github.com/repos/projectcalico/libcalico-go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/projectcalico/libcalico-go/labels{/name}","releases_url":"https://api.github.com/repos/projectcalico/libcalico-go/releases{/id}","deployments_url":"https://api.github.com/repos/projectcalico/libcalico-go/deployments","created_at":"2016-07-15T17:09:40Z","updated_at":"2017-12-21T03:13:50Z","pushed_at":"2018-02-14T02:52:05Z","git_url":"git://github.com/projectcalico/libcalico-go.git","ssh_url":"git@github.com:projectcalico/libcalico-go.git","clone_url":"https://github.com/projectcalico/libcalico-go.git","svn_url":"https://github.com/projectcalico/libcalico-go","homepage":null,"size":2912,"stargazers_count":43,"watchers_count":43,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":54,"mirror_url":null,"archived":false,"open_issues_count":30,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":54,"open_issues":30,"watchers":43,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/projectcalico/libcalico-go/pulls/785"},"html":{"href":"https://github.com/projectcalico/libcalico-go/pull/785"},"issue":{"href":"https://api.github.com/repos/projectcalico/libcalico-go/issues/785"},"comments":{"href":"https://api.github.com/repos/projectcalico/libcalico-go/issues/785/comments"},"review_comments":{"href":"https://api.github.com/repos/projectcalico/libcalico-go/pulls/785/comments"},"review_comment":{"href":"https://api.github.com/repos/projectcalico/libcalico-go/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/projectcalico/libcalico-go/pulls/785/commits"},"statuses":{"href":"https://api.github.com/repos/projectcalico/libcalico-go/statuses/f3ed708ddd4b61b22c7f4fcfc7bcf0a4929555cf"}},"author_association":"OWNER"}}
{"actor":{"display_login":"caseydavenport"}}