{"action":"created","comment":{"url":"https://api.github.com/repos/stripe/sequins/pulls/comments/24121702","id":24121702,"diff_hunk":"@@ -107,11 +114,26 @@ func (index *Index) Get(key string) (*io.SectionReader, error) {\n \t}\n \n \tfileIndex, offset := deserializeIndexEntry(bytes)\n-\tindex.readLocks[fileIndex].Lock()\n-\tdefer index.readLocks[fileIndex].Unlock()\n+\tf := index.files[fileIndex]\n+\n+\tf.lock.Lock()\n+\tdefer f.lock.Unlock()\n+\n+\t_, err = f.file.Seek(offset, 0)\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\n+\tok := f.reader.Scan()\n+\tif !ok {\n+\t\tif f.reader.Err() != nil {\n+\t\t\treturn nil, f.reader.Err()\n+\t\t} else {\n+\t\t\treturn nil, io.ErrUnexpectedEOF\n+\t\t}\n+\t}\n \n-\trecord, err := index.files[fileIndex].ReadRecordAtOffset(offset)\n-\treturn record.Value, err\n+\treturn f.reader.Value(), err","path":"index/index.go","position":98,"original_position":98,"commit_id":"90a07ee23e3d6f179c45a34206681f174d359523","original_commit_id":"90a07ee23e3d6f179c45a34206681f174d359523","user":{"login":"colinmarc","id":821775,"avatar_url":"https://avatars.githubusercontent.com/u/821775?v=3","gravatar_id":"","url":"https://api.github.com/users/colinmarc","html_url":"https://github.com/colinmarc","followers_url":"https://api.github.com/users/colinmarc/followers","following_url":"https://api.github.com/users/colinmarc/following{/other_user}","gists_url":"https://api.github.com/users/colinmarc/gists{/gist_id}","starred_url":"https://api.github.com/users/colinmarc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/colinmarc/subscriptions","organizations_url":"https://api.github.com/users/colinmarc/orgs","repos_url":"https://api.github.com/users/colinmarc/repos","events_url":"https://api.github.com/users/colinmarc/events{/privacy}","received_events_url":"https://api.github.com/users/colinmarc/received_events","type":"User","site_admin":false},"body":"ah, good point","created_at":"2015-02-04T21:33:33Z","updated_at":"2015-02-04T21:33:33Z","html_url":"https://github.com/stripe/sequins/pull/4#discussion_r24121702","pull_request_url":"https://api.github.com/repos/stripe/sequins/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/stripe/sequins/pulls/comments/24121702"},"html":{"href":"https://github.com/stripe/sequins/pull/4#discussion_r24121702"},"pull_request":{"href":"https://api.github.com/repos/stripe/sequins/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/stripe/sequins/pulls/4","id":28602118,"html_url":"https://github.com/stripe/sequins/pull/4","diff_url":"https://github.com/stripe/sequins/pull/4.diff","patch_url":"https://github.com/stripe/sequins/pull/4.patch","issue_url":"https://api.github.com/repos/stripe/sequins/issues/4","number":4,"state":"open","locked":false,"title":"Rewrite the sequencefile package to be faster and more memory-conscious","user":{"login":"colinmarc","id":821775,"avatar_url":"https://avatars.githubusercontent.com/u/821775?v=3","gravatar_id":"","url":"https://api.github.com/users/colinmarc","html_url":"https://github.com/colinmarc","followers_url":"https://api.github.com/users/colinmarc/followers","following_url":"https://api.github.com/users/colinmarc/following{/other_user}","gists_url":"https://api.github.com/users/colinmarc/gists{/gist_id}","starred_url":"https://api.github.com/users/colinmarc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/colinmarc/subscriptions","organizations_url":"https://api.github.com/users/colinmarc/orgs","repos_url":"https://api.github.com/users/colinmarc/repos","events_url":"https://api.github.com/users/colinmarc/events{/privacy}","received_events_url":"https://api.github.com/users/colinmarc/received_events","type":"User","site_admin":false},"body":"This churns all the sequencefile code and some of the index code, mainly for\r\nthe reasons of optimization. In particular, allocating a SectionReader for\r\neach key/value was actually pretty disastrous for memory. The new approach\r\nlooks more like a bufio.Scanner, and, internally, reuses a single memory slice.\r\n\r\nThere's some other miscellaneous cleanup.","created_at":"2015-02-04T00:09:20Z","updated_at":"2015-02-04T21:33:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f1dfc84365d299b934eebb67402185ccdfde63a6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/stripe/sequins/pulls/4/commits","review_comments_url":"https://api.github.com/repos/stripe/sequins/pulls/4/comments","review_comment_url":"https://api.github.com/repos/stripe/sequins/pulls/comments/{number}","comments_url":"https://api.github.com/repos/stripe/sequins/issues/4/comments","statuses_url":"https://api.github.com/repos/stripe/sequins/statuses/90a07ee23e3d6f179c45a34206681f174d359523","head":{"label":"stripe:rewrite-sequencefile","ref":"rewrite-sequencefile","sha":"90a07ee23e3d6f179c45a34206681f174d359523","user":{"login":"stripe","id":856813,"avatar_url":"https://avatars.githubusercontent.com/u/856813?v=3","gravatar_id":"","url":"https://api.github.com/users/stripe","html_url":"https://github.com/stripe","followers_url":"https://api.github.com/users/stripe/followers","following_url":"https://api.github.com/users/stripe/following{/other_user}","gists_url":"https://api.github.com/users/stripe/gists{/gist_id}","starred_url":"https://api.github.com/users/stripe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stripe/subscriptions","organizations_url":"https://api.github.com/users/stripe/orgs","repos_url":"https://api.github.com/users/stripe/repos","events_url":"https://api.github.com/users/stripe/events{/privacy}","received_events_url":"https://api.github.com/users/stripe/received_events","type":"Organization","site_admin":false},"repo":{"id":26888631,"name":"sequins","full_name":"stripe/sequins","owner":{"login":"stripe","id":856813,"avatar_url":"https://avatars.githubusercontent.com/u/856813?v=3","gravatar_id":"","url":"https://api.github.com/users/stripe","html_url":"https://github.com/stripe","followers_url":"https://api.github.com/users/stripe/followers","following_url":"https://api.github.com/users/stripe/following{/other_user}","gists_url":"https://api.github.com/users/stripe/gists{/gist_id}","starred_url":"https://api.github.com/users/stripe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stripe/subscriptions","organizations_url":"https://api.github.com/users/stripe/orgs","repos_url":"https://api.github.com/users/stripe/repos","events_url":"https://api.github.com/users/stripe/events{/privacy}","received_events_url":"https://api.github.com/users/stripe/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/stripe/sequins","description":"A simple K/V store on top of Hadoop's SequenceFile","fork":false,"url":"https://api.github.com/repos/stripe/sequins","forks_url":"https://api.github.com/repos/stripe/sequins/forks","keys_url":"https://api.github.com/repos/stripe/sequins/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stripe/sequins/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stripe/sequins/teams","hooks_url":"https://api.github.com/repos/stripe/sequins/hooks","issue_events_url":"https://api.github.com/repos/stripe/sequins/issues/events{/number}","events_url":"https://api.github.com/repos/stripe/sequins/events","assignees_url":"https://api.github.com/repos/stripe/sequins/assignees{/user}","branches_url":"https://api.github.com/repos/stripe/sequins/branches{/branch}","tags_url":"https://api.github.com/repos/stripe/sequins/tags","blobs_url":"https://api.github.com/repos/stripe/sequins/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stripe/sequins/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stripe/sequins/git/refs{/sha}","trees_url":"https://api.github.com/repos/stripe/sequins/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stripe/sequins/statuses/{sha}","languages_url":"https://api.github.com/repos/stripe/sequins/languages","stargazers_url":"https://api.github.com/repos/stripe/sequins/stargazers","contributors_url":"https://api.github.com/repos/stripe/sequins/contributors","subscribers_url":"https://api.github.com/repos/stripe/sequins/subscribers","subscription_url":"https://api.github.com/repos/stripe/sequins/subscription","commits_url":"https://api.github.com/repos/stripe/sequins/commits{/sha}","git_commits_url":"https://api.github.com/repos/stripe/sequins/git/commits{/sha}","comments_url":"https://api.github.com/repos/stripe/sequins/comments{/number}","issue_comment_url":"https://api.github.com/repos/stripe/sequins/issues/comments/{number}","contents_url":"https://api.github.com/repos/stripe/sequins/contents/{+path}","compare_url":"https://api.github.com/repos/stripe/sequins/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stripe/sequins/merges","archive_url":"https://api.github.com/repos/stripe/sequins/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stripe/sequins/downloads","issues_url":"https://api.github.com/repos/stripe/sequins/issues{/number}","pulls_url":"https://api.github.com/repos/stripe/sequins/pulls{/number}","milestones_url":"https://api.github.com/repos/stripe/sequins/milestones{/number}","notifications_url":"https://api.github.com/repos/stripe/sequins/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stripe/sequins/labels{/name}","releases_url":"https://api.github.com/repos/stripe/sequins/releases{/id}","created_at":"2014-11-20T00:38:21Z","updated_at":"2015-02-04T13:24:37Z","pushed_at":"2015-02-04T21:27:59Z","git_url":"git://github.com/stripe/sequins.git","ssh_url":"git@github.com:stripe/sequins.git","clone_url":"https://github.com/stripe/sequins.git","svn_url":"https://github.com/stripe/sequins","homepage":null,"size":220,"stargazers_count":44,"watchers_count":44,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":3,"forks":2,"open_issues":3,"watchers":44,"default_branch":"master"}},"base":{"label":"stripe:master","ref":"master","sha":"389fb4e4bb050c671f419888b0eae956da3e44d3","user":{"login":"stripe","id":856813,"avatar_url":"https://avatars.githubusercontent.com/u/856813?v=3","gravatar_id":"","url":"https://api.github.com/users/stripe","html_url":"https://github.com/stripe","followers_url":"https://api.github.com/users/stripe/followers","following_url":"https://api.github.com/users/stripe/following{/other_user}","gists_url":"https://api.github.com/users/stripe/gists{/gist_id}","starred_url":"https://api.github.com/users/stripe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stripe/subscriptions","organizations_url":"https://api.github.com/users/stripe/orgs","repos_url":"https://api.github.com/users/stripe/repos","events_url":"https://api.github.com/users/stripe/events{/privacy}","received_events_url":"https://api.github.com/users/stripe/received_events","type":"Organization","site_admin":false},"repo":{"id":26888631,"name":"sequins","full_name":"stripe/sequins","owner":{"login":"stripe","id":856813,"avatar_url":"https://avatars.githubusercontent.com/u/856813?v=3","gravatar_id":"","url":"https://api.github.com/users/stripe","html_url":"https://github.com/stripe","followers_url":"https://api.github.com/users/stripe/followers","following_url":"https://api.github.com/users/stripe/following{/other_user}","gists_url":"https://api.github.com/users/stripe/gists{/gist_id}","starred_url":"https://api.github.com/users/stripe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stripe/subscriptions","organizations_url":"https://api.github.com/users/stripe/orgs","repos_url":"https://api.github.com/users/stripe/repos","events_url":"https://api.github.com/users/stripe/events{/privacy}","received_events_url":"https://api.github.com/users/stripe/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/stripe/sequins","description":"A simple K/V store on top of Hadoop's SequenceFile","fork":false,"url":"https://api.github.com/repos/stripe/sequins","forks_url":"https://api.github.com/repos/stripe/sequins/forks","keys_url":"https://api.github.com/repos/stripe/sequins/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stripe/sequins/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stripe/sequins/teams","hooks_url":"https://api.github.com/repos/stripe/sequins/hooks","issue_events_url":"https://api.github.com/repos/stripe/sequins/issues/events{/number}","events_url":"https://api.github.com/repos/stripe/sequins/events","assignees_url":"https://api.github.com/repos/stripe/sequins/assignees{/user}","branches_url":"https://api.github.com/repos/stripe/sequins/branches{/branch}","tags_url":"https://api.github.com/repos/stripe/sequins/tags","blobs_url":"https://api.github.com/repos/stripe/sequins/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stripe/sequins/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stripe/sequins/git/refs{/sha}","trees_url":"https://api.github.com/repos/stripe/sequins/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stripe/sequins/statuses/{sha}","languages_url":"https://api.github.com/repos/stripe/sequins/languages","stargazers_url":"https://api.github.com/repos/stripe/sequins/stargazers","contributors_url":"https://api.github.com/repos/stripe/sequins/contributors","subscribers_url":"https://api.github.com/repos/stripe/sequins/subscribers","subscription_url":"https://api.github.com/repos/stripe/sequins/subscription","commits_url":"https://api.github.com/repos/stripe/sequins/commits{/sha}","git_commits_url":"https://api.github.com/repos/stripe/sequins/git/commits{/sha}","comments_url":"https://api.github.com/repos/stripe/sequins/comments{/number}","issue_comment_url":"https://api.github.com/repos/stripe/sequins/issues/comments/{number}","contents_url":"https://api.github.com/repos/stripe/sequins/contents/{+path}","compare_url":"https://api.github.com/repos/stripe/sequins/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stripe/sequins/merges","archive_url":"https://api.github.com/repos/stripe/sequins/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stripe/sequins/downloads","issues_url":"https://api.github.com/repos/stripe/sequins/issues{/number}","pulls_url":"https://api.github.com/repos/stripe/sequins/pulls{/number}","milestones_url":"https://api.github.com/repos/stripe/sequins/milestones{/number}","notifications_url":"https://api.github.com/repos/stripe/sequins/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stripe/sequins/labels{/name}","releases_url":"https://api.github.com/repos/stripe/sequins/releases{/id}","created_at":"2014-11-20T00:38:21Z","updated_at":"2015-02-04T13:24:37Z","pushed_at":"2015-02-04T21:27:59Z","git_url":"git://github.com/stripe/sequins.git","ssh_url":"git@github.com:stripe/sequins.git","clone_url":"https://github.com/stripe/sequins.git","svn_url":"https://github.com/stripe/sequins","homepage":null,"size":220,"stargazers_count":44,"watchers_count":44,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":3,"forks":2,"open_issues":3,"watchers":44,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/stripe/sequins/pulls/4"},"html":{"href":"https://github.com/stripe/sequins/pull/4"},"issue":{"href":"https://api.github.com/repos/stripe/sequins/issues/4"},"comments":{"href":"https://api.github.com/repos/stripe/sequins/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/stripe/sequins/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/stripe/sequins/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/stripe/sequins/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/stripe/sequins/statuses/90a07ee23e3d6f179c45a34206681f174d359523"}}}}