{"action":"created","comment":{"url":"https://api.github.com/repos/minio/minio/pulls/comments/171595961","pull_request_review_id":100476161,"id":171595961,"diff_hunk":"@@ -44,117 +108,122 @@ func (s ErasureStorage) ReadFile(writer io.Writer, volume, path string, offset,\n \t\t}\n \t\tverifiers[i] = NewBitrotVerifier(algorithm, checksums[i])\n \t}\n-\terrChans := make([]chan error, len(s.disks))\n-\tfor i := range errChans {\n-\t\terrChans[i] = make(chan error, 1)\n+\n+\tchunksize := ceilFrac(blocksize, int64(s.dataBlocks))\n+\n+\t// We read all whole-blocks of erasure coded data containing\n+\t// the requested data range.\n+\t//\n+\t// The start index of the erasure coded block containing the\n+\t// `offset` byte of data is:\n+\tpartDataStartIndex := (offset / blocksize) * chunksize","path":"cmd/erasure-readfile.go","position":94,"original_position":94,"commit_id":"735d36e3d726a5a471c1f0d14b70be588292ce1b","original_commit_id":"735d36e3d726a5a471c1f0d14b70be588292ce1b","user":{"login":"vadmeste","id":283197,"avatar_url":"https://avatars1.githubusercontent.com/u/283197?v=4","gravatar_id":"","url":"https://api.github.com/users/vadmeste","html_url":"https://github.com/vadmeste","followers_url":"https://api.github.com/users/vadmeste/followers","following_url":"https://api.github.com/users/vadmeste/following{/other_user}","gists_url":"https://api.github.com/users/vadmeste/gists{/gist_id}","starred_url":"https://api.github.com/users/vadmeste/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vadmeste/subscriptions","organizations_url":"https://api.github.com/users/vadmeste/orgs","repos_url":"https://api.github.com/users/vadmeste/repos","events_url":"https://api.github.com/users/vadmeste/events{/privacy}","received_events_url":"https://api.github.com/users/vadmeste/received_events","type":"User","site_admin":false},"body":"@donatello can you move this block to a new function? There is really many declared variables here and it seems we need only to calculate partDataStartIndex & partDataLength, right ?","created_at":"2018-03-01T15:34:30Z","updated_at":"2018-03-01T15:34:30Z","html_url":"https://github.com/minio/minio/pull/5568#discussion_r171595961","pull_request_url":"https://api.github.com/repos/minio/minio/pulls/5568","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/minio/minio/pulls/comments/171595961"},"html":{"href":"https://github.com/minio/minio/pull/5568#discussion_r171595961"},"pull_request":{"href":"https://api.github.com/repos/minio/minio/pulls/5568"}}},"pull_request":{"url":"https://api.github.com/repos/minio/minio/pulls/5568","id":170602747,"html_url":"https://github.com/minio/minio/pull/5568","diff_url":"https://github.com/minio/minio/pull/5568.diff","patch_url":"https://github.com/minio/minio/pull/5568.patch","issue_url":"https://api.github.com/repos/minio/minio/issues/5568","number":5568,"state":"open","locked":false,"title":"Return bit-rot verified data instead of re-reading from disk","user":{"login":"donatello","id":200059,"avatar_url":"https://avatars0.githubusercontent.com/u/200059?v=4","gravatar_id":"","url":"https://api.github.com/users/donatello","html_url":"https://github.com/donatello","followers_url":"https://api.github.com/users/donatello/followers","following_url":"https://api.github.com/users/donatello/following{/other_user}","gists_url":"https://api.github.com/users/donatello/gists{/gist_id}","starred_url":"https://api.github.com/users/donatello/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/donatello/subscriptions","organizations_url":"https://api.github.com/users/donatello/orgs","repos_url":"https://api.github.com/users/donatello/repos","events_url":"https://api.github.com/users/donatello/events{/privacy}","received_events_url":"https://api.github.com/users/donatello/received_events","type":"User","site_admin":false},"body":"<!--- Provide a general summary of your changes in the Title above -->\r\n\r\n## Description\r\n<!--- Describe your changes in detail -->\r\n- Data from disk was being read after bitrot verification to return\r\n      data for GetObject. Strictly speaking this does not guarantee bitrot\r\n      protection, as disks may return bad data even temporarily.\r\n    \r\n- This fix reads data from disk, verifies data for bitrot and then\r\n      returns data to the client directly.\r\n\r\n\r\n## Motivation and Context\r\n<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\r\nTo return only bitrot verified data this PR reads full part-file shards into memory on the client, then reconstructs the data from erasure coding and returns data for GetObject.\r\n\r\n\r\n## How Has This Been Tested?\r\n<!--- Please describe in detail how you tested your changes. -->\r\n<!--- Include details of your testing environment, and the tests you ran to -->\r\n<!--- see how your change affects other areas of the code, etc. -->\r\n\r\n## Types of changes\r\n<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->\r\n- [x] Bug fix (non-breaking change which fixes an issue)\r\n- [ ] New feature (non-breaking change which adds functionality)\r\n- [ ] Breaking change (fix or feature that would cause existing functionality to change)\r\n\r\n## Checklist:\r\n<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->\r\n<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->\r\n- [x] My code follows the code style of this project.\r\n- [ ] My change requires a change to the documentation.\r\n- [ ] I have updated the documentation accordingly.\r\n- [ ] I have added unit tests to cover my changes.\r\n- [ ] I have added/updated functional tests in [mint](https://github.com/minio/mint). (If yes, add `mint` PR # here: )\r\n- [x] All new and existing tests passed.","created_at":"2018-02-21T22:10:31Z","updated_at":"2018-03-01T15:34:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bfdfebf435786cc22be2408e8dff6f3d5a3620ec","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/minio/minio/pulls/5568/commits","review_comments_url":"https://api.github.com/repos/minio/minio/pulls/5568/comments","review_comment_url":"https://api.github.com/repos/minio/minio/pulls/comments{/number}","comments_url":"https://api.github.com/repos/minio/minio/issues/5568/comments","statuses_url":"https://api.github.com/repos/minio/minio/statuses/735d36e3d726a5a471c1f0d14b70be588292ce1b","head":{"label":"donatello:bitrot-verify-fix","ref":"bitrot-verify-fix","sha":"735d36e3d726a5a471c1f0d14b70be588292ce1b","user":{"login":"donatello","id":200059,"avatar_url":"https://avatars0.githubusercontent.com/u/200059?v=4","gravatar_id":"","url":"https://api.github.com/users/donatello","html_url":"https://github.com/donatello","followers_url":"https://api.github.com/users/donatello/followers","following_url":"https://api.github.com/users/donatello/following{/other_user}","gists_url":"https://api.github.com/users/donatello/gists{/gist_id}","starred_url":"https://api.github.com/users/donatello/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/donatello/subscriptions","organizations_url":"https://api.github.com/users/donatello/orgs","repos_url":"https://api.github.com/users/donatello/repos","events_url":"https://api.github.com/users/donatello/events{/privacy}","received_events_url":"https://api.github.com/users/donatello/received_events","type":"User","site_admin":false},"repo":{"id":67159791,"name":"minio","full_name":"donatello/minio","owner":{"login":"donatello","id":200059,"avatar_url":"https://avatars0.githubusercontent.com/u/200059?v=4","gravatar_id":"","url":"https://api.github.com/users/donatello","html_url":"https://github.com/donatello","followers_url":"https://api.github.com/users/donatello/followers","following_url":"https://api.github.com/users/donatello/following{/other_user}","gists_url":"https://api.github.com/users/donatello/gists{/gist_id}","starred_url":"https://api.github.com/users/donatello/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/donatello/subscriptions","organizations_url":"https://api.github.com/users/donatello/orgs","repos_url":"https://api.github.com/users/donatello/repos","events_url":"https://api.github.com/users/donatello/events{/privacy}","received_events_url":"https://api.github.com/users/donatello/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/donatello/minio","description":"Minio is an object storage server compatible with Amazon S3 and licensed under Apache 2.0 License","fork":true,"url":"https://api.github.com/repos/donatello/minio","forks_url":"https://api.github.com/repos/donatello/minio/forks","keys_url":"https://api.github.com/repos/donatello/minio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/donatello/minio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/donatello/minio/teams","hooks_url":"https://api.github.com/repos/donatello/minio/hooks","issue_events_url":"https://api.github.com/repos/donatello/minio/issues/events{/number}","events_url":"https://api.github.com/repos/donatello/minio/events","assignees_url":"https://api.github.com/repos/donatello/minio/assignees{/user}","branches_url":"https://api.github.com/repos/donatello/minio/branches{/branch}","tags_url":"https://api.github.com/repos/donatello/minio/tags","blobs_url":"https://api.github.com/repos/donatello/minio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/donatello/minio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/donatello/minio/git/refs{/sha}","trees_url":"https://api.github.com/repos/donatello/minio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/donatello/minio/statuses/{sha}","languages_url":"https://api.github.com/repos/donatello/minio/languages","stargazers_url":"https://api.github.com/repos/donatello/minio/stargazers","contributors_url":"https://api.github.com/repos/donatello/minio/contributors","subscribers_url":"https://api.github.com/repos/donatello/minio/subscribers","subscription_url":"https://api.github.com/repos/donatello/minio/subscription","commits_url":"https://api.github.com/repos/donatello/minio/commits{/sha}","git_commits_url":"https://api.github.com/repos/donatello/minio/git/commits{/sha}","comments_url":"https://api.github.com/repos/donatello/minio/comments{/number}","issue_comment_url":"https://api.github.com/repos/donatello/minio/issues/comments{/number}","contents_url":"https://api.github.com/repos/donatello/minio/contents/{+path}","compare_url":"https://api.github.com/repos/donatello/minio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/donatello/minio/merges","archive_url":"https://api.github.com/repos/donatello/minio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/donatello/minio/downloads","issues_url":"https://api.github.com/repos/donatello/minio/issues{/number}","pulls_url":"https://api.github.com/repos/donatello/minio/pulls{/number}","milestones_url":"https://api.github.com/repos/donatello/minio/milestones{/number}","notifications_url":"https://api.github.com/repos/donatello/minio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/donatello/minio/labels{/name}","releases_url":"https://api.github.com/repos/donatello/minio/releases{/id}","deployments_url":"https://api.github.com/repos/donatello/minio/deployments","created_at":"2016-09-01T19:23:11Z","updated_at":"2016-09-01T19:23:13Z","pushed_at":"2018-02-28T23:54:41Z","git_url":"git://github.com/donatello/minio.git","ssh_url":"git@github.com:donatello/minio.git","clone_url":"https://github.com/donatello/minio.git","svn_url":"https://github.com/donatello/minio","homepage":"https://minio.io","size":31322,"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":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"minio:master","ref":"master","sha":"6faa1ef11a8f2b0bbbbad8b091c929b9d1932e42","user":{"login":"minio","id":695951,"avatar_url":"https://avatars3.githubusercontent.com/u/695951?v=4","gravatar_id":"","url":"https://api.github.com/users/minio","html_url":"https://github.com/minio","followers_url":"https://api.github.com/users/minio/followers","following_url":"https://api.github.com/users/minio/following{/other_user}","gists_url":"https://api.github.com/users/minio/gists{/gist_id}","starred_url":"https://api.github.com/users/minio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minio/subscriptions","organizations_url":"https://api.github.com/users/minio/orgs","repos_url":"https://api.github.com/users/minio/repos","events_url":"https://api.github.com/users/minio/events{/privacy}","received_events_url":"https://api.github.com/users/minio/received_events","type":"Organization","site_admin":false},"repo":{"id":29261473,"name":"minio","full_name":"minio/minio","owner":{"login":"minio","id":695951,"avatar_url":"https://avatars3.githubusercontent.com/u/695951?v=4","gravatar_id":"","url":"https://api.github.com/users/minio","html_url":"https://github.com/minio","followers_url":"https://api.github.com/users/minio/followers","following_url":"https://api.github.com/users/minio/following{/other_user}","gists_url":"https://api.github.com/users/minio/gists{/gist_id}","starred_url":"https://api.github.com/users/minio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minio/subscriptions","organizations_url":"https://api.github.com/users/minio/orgs","repos_url":"https://api.github.com/users/minio/repos","events_url":"https://api.github.com/users/minio/events{/privacy}","received_events_url":"https://api.github.com/users/minio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/minio/minio","description":"Minio is an open source object storage server compatible with Amazon S3 APIs","fork":false,"url":"https://api.github.com/repos/minio/minio","forks_url":"https://api.github.com/repos/minio/minio/forks","keys_url":"https://api.github.com/repos/minio/minio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/minio/minio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/minio/minio/teams","hooks_url":"https://api.github.com/repos/minio/minio/hooks","issue_events_url":"https://api.github.com/repos/minio/minio/issues/events{/number}","events_url":"https://api.github.com/repos/minio/minio/events","assignees_url":"https://api.github.com/repos/minio/minio/assignees{/user}","branches_url":"https://api.github.com/repos/minio/minio/branches{/branch}","tags_url":"https://api.github.com/repos/minio/minio/tags","blobs_url":"https://api.github.com/repos/minio/minio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/minio/minio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/minio/minio/git/refs{/sha}","trees_url":"https://api.github.com/repos/minio/minio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/minio/minio/statuses/{sha}","languages_url":"https://api.github.com/repos/minio/minio/languages","stargazers_url":"https://api.github.com/repos/minio/minio/stargazers","contributors_url":"https://api.github.com/repos/minio/minio/contributors","subscribers_url":"https://api.github.com/repos/minio/minio/subscribers","subscription_url":"https://api.github.com/repos/minio/minio/subscription","commits_url":"https://api.github.com/repos/minio/minio/commits{/sha}","git_commits_url":"https://api.github.com/repos/minio/minio/git/commits{/sha}","comments_url":"https://api.github.com/repos/minio/minio/comments{/number}","issue_comment_url":"https://api.github.com/repos/minio/minio/issues/comments{/number}","contents_url":"https://api.github.com/repos/minio/minio/contents/{+path}","compare_url":"https://api.github.com/repos/minio/minio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/minio/minio/merges","archive_url":"https://api.github.com/repos/minio/minio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/minio/minio/downloads","issues_url":"https://api.github.com/repos/minio/minio/issues{/number}","pulls_url":"https://api.github.com/repos/minio/minio/pulls{/number}","milestones_url":"https://api.github.com/repos/minio/minio/milestones{/number}","notifications_url":"https://api.github.com/repos/minio/minio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/minio/minio/labels{/name}","releases_url":"https://api.github.com/repos/minio/minio/releases{/id}","deployments_url":"https://api.github.com/repos/minio/minio/deployments","created_at":"2015-01-14T19:23:58Z","updated_at":"2018-03-01T14:37:07Z","pushed_at":"2018-03-01T14:37:37Z","git_url":"git://github.com/minio/minio.git","ssh_url":"git@github.com:minio/minio.git","clone_url":"https://github.com/minio/minio.git","svn_url":"https://github.com/minio/minio","homepage":"https://minio.io/downloads.html#download-server","size":31666,"stargazers_count":10226,"watchers_count":10226,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":855,"mirror_url":null,"archived":false,"open_issues_count":116,"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":855,"open_issues":116,"watchers":10226,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/minio/minio/pulls/5568"},"html":{"href":"https://github.com/minio/minio/pull/5568"},"issue":{"href":"https://api.github.com/repos/minio/minio/issues/5568"},"comments":{"href":"https://api.github.com/repos/minio/minio/issues/5568/comments"},"review_comments":{"href":"https://api.github.com/repos/minio/minio/pulls/5568/comments"},"review_comment":{"href":"https://api.github.com/repos/minio/minio/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/minio/minio/pulls/5568/commits"},"statuses":{"href":"https://api.github.com/repos/minio/minio/statuses/735d36e3d726a5a471c1f0d14b70be588292ce1b"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"vadmeste"}}