{"action":"closed","number":6,"pull_request":{"url":"https://api.github.com/repos/hapyrus/kodama/pulls/6","id":37969061,"html_url":"https://github.com/hapyrus/kodama/pull/6","diff_url":"https://github.com/hapyrus/kodama/pull/6.diff","patch_url":"https://github.com/hapyrus/kodama/pull/6.patch","issue_url":"https://api.github.com/repos/hapyrus/kodama/issues/6","number":6,"state":"closed","locked":false,"title":"Feature/b734 handle overflowed pos","user":{"login":"mmasashi","id":100385,"avatar_url":"https://avatars.githubusercontent.com/u/100385?v=3","gravatar_id":"","url":"https://api.github.com/users/mmasashi","html_url":"https://github.com/mmasashi","followers_url":"https://api.github.com/users/mmasashi/followers","following_url":"https://api.github.com/users/mmasashi/following{/other_user}","gists_url":"https://api.github.com/users/mmasashi/gists{/gist_id}","starred_url":"https://api.github.com/users/mmasashi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmasashi/subscriptions","organizations_url":"https://api.github.com/users/mmasashi/orgs","repos_url":"https://api.github.com/users/mmasashi/repos","events_url":"https://api.github.com/users/mmasashi/events{/privacy}","received_events_url":"https://api.github.com/users/mmasashi/received_events","type":"User","site_admin":false},"body":"Changes:\r\n- Handle overflowed position\r\n- Skip saving binlog position file with rotate event if the binlog file name is not changed\r\n\r\n### Summary\r\n\r\nmysqlbinlog format has the integer overflow issue for next event position field. In the huge binlog file, I found the end_log_pos(= next event pos) was reset after 4294864813, which is close to the unique integer max value (4294967295). According to mysql-server docs, only 4 bytes are reserved for the position.\r\n\r\n```\r\nlog_pos (4) -- position of the next event\r\n```\r\nhttps://dev.mysql.com/doc/internals/en/binlog-event-header.html\r\n\r\nThe issues from this limitation were as follows:\r\n\r\n- binlog `set_position` doesn't work with the position larger than 4294967295. \r\n- next position information gets reset after exceeding 4294967295 position\r\n\r\n### Approach\r\n\r\nSince next_position is used for the sent_position to avoid processing a processed event, we need to calculate the correct next position. Fortunately there is another field \"event_length\", which enable us to calculate the next position for most of cases. \r\n\r\nHowever, it cannot be used for some events like format event, I decided to use \"event_length\" only when the position is overflowed. From these background, I introduced a new notion \"current_position_overflowed\" and \"next_position_overflowed\" flag to handle overflowed position data. \r\n\r\nThose flags will be reset when receiving rotate events which changes the binlog file.","created_at":"2015-06-18T03:43:27Z","updated_at":"2015-06-19T20:37:31Z","closed_at":"2015-06-19T20:37:31Z","merged_at":"2015-06-19T20:37:31Z","merge_commit_sha":"589036fd4f0e826148dbd42411e161f7bd4ad063","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hapyrus/kodama/pulls/6/commits","review_comments_url":"https://api.github.com/repos/hapyrus/kodama/pulls/6/comments","review_comment_url":"https://api.github.com/repos/hapyrus/kodama/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hapyrus/kodama/issues/6/comments","statuses_url":"https://api.github.com/repos/hapyrus/kodama/statuses/376fd130473a11a76cb464e2543710cc896ceec4","head":{"label":"hapyrus:feature/b734_handle_overflowed_pos","ref":"feature/b734_handle_overflowed_pos","sha":"376fd130473a11a76cb464e2543710cc896ceec4","user":{"login":"hapyrus","id":438949,"avatar_url":"https://avatars.githubusercontent.com/u/438949?v=3","gravatar_id":"","url":"https://api.github.com/users/hapyrus","html_url":"https://github.com/hapyrus","followers_url":"https://api.github.com/users/hapyrus/followers","following_url":"https://api.github.com/users/hapyrus/following{/other_user}","gists_url":"https://api.github.com/users/hapyrus/gists{/gist_id}","starred_url":"https://api.github.com/users/hapyrus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hapyrus/subscriptions","organizations_url":"https://api.github.com/users/hapyrus/orgs","repos_url":"https://api.github.com/users/hapyrus/repos","events_url":"https://api.github.com/users/hapyrus/events{/privacy}","received_events_url":"https://api.github.com/users/hapyrus/received_events","type":"Organization","site_admin":false},"repo":{"id":29760098,"name":"kodama","full_name":"hapyrus/kodama","owner":{"login":"hapyrus","id":438949,"avatar_url":"https://avatars.githubusercontent.com/u/438949?v=3","gravatar_id":"","url":"https://api.github.com/users/hapyrus","html_url":"https://github.com/hapyrus","followers_url":"https://api.github.com/users/hapyrus/followers","following_url":"https://api.github.com/users/hapyrus/following{/other_user}","gists_url":"https://api.github.com/users/hapyrus/gists{/gist_id}","starred_url":"https://api.github.com/users/hapyrus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hapyrus/subscriptions","organizations_url":"https://api.github.com/users/hapyrus/orgs","repos_url":"https://api.github.com/users/hapyrus/repos","events_url":"https://api.github.com/users/hapyrus/events{/privacy}","received_events_url":"https://api.github.com/users/hapyrus/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hapyrus/kodama","description":"ruby-binlog based MySQL replication listener","fork":true,"url":"https://api.github.com/repos/hapyrus/kodama","forks_url":"https://api.github.com/repos/hapyrus/kodama/forks","keys_url":"https://api.github.com/repos/hapyrus/kodama/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hapyrus/kodama/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hapyrus/kodama/teams","hooks_url":"https://api.github.com/repos/hapyrus/kodama/hooks","issue_events_url":"https://api.github.com/repos/hapyrus/kodama/issues/events{/number}","events_url":"https://api.github.com/repos/hapyrus/kodama/events","assignees_url":"https://api.github.com/repos/hapyrus/kodama/assignees{/user}","branches_url":"https://api.github.com/repos/hapyrus/kodama/branches{/branch}","tags_url":"https://api.github.com/repos/hapyrus/kodama/tags","blobs_url":"https://api.github.com/repos/hapyrus/kodama/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hapyrus/kodama/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hapyrus/kodama/git/refs{/sha}","trees_url":"https://api.github.com/repos/hapyrus/kodama/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hapyrus/kodama/statuses/{sha}","languages_url":"https://api.github.com/repos/hapyrus/kodama/languages","stargazers_url":"https://api.github.com/repos/hapyrus/kodama/stargazers","contributors_url":"https://api.github.com/repos/hapyrus/kodama/contributors","subscribers_url":"https://api.github.com/repos/hapyrus/kodama/subscribers","subscription_url":"https://api.github.com/repos/hapyrus/kodama/subscription","commits_url":"https://api.github.com/repos/hapyrus/kodama/commits{/sha}","git_commits_url":"https://api.github.com/repos/hapyrus/kodama/git/commits{/sha}","comments_url":"https://api.github.com/repos/hapyrus/kodama/comments{/number}","issue_comment_url":"https://api.github.com/repos/hapyrus/kodama/issues/comments{/number}","contents_url":"https://api.github.com/repos/hapyrus/kodama/contents/{+path}","compare_url":"https://api.github.com/repos/hapyrus/kodama/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hapyrus/kodama/merges","archive_url":"https://api.github.com/repos/hapyrus/kodama/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hapyrus/kodama/downloads","issues_url":"https://api.github.com/repos/hapyrus/kodama/issues{/number}","pulls_url":"https://api.github.com/repos/hapyrus/kodama/pulls{/number}","milestones_url":"https://api.github.com/repos/hapyrus/kodama/milestones{/number}","notifications_url":"https://api.github.com/repos/hapyrus/kodama/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hapyrus/kodama/labels{/name}","releases_url":"https://api.github.com/repos/hapyrus/kodama/releases{/id}","created_at":"2015-01-24T00:37:59Z","updated_at":"2015-05-25T10:07:31Z","pushed_at":"2015-06-19T20:37:31Z","git_url":"git://github.com/hapyrus/kodama.git","ssh_url":"git@github.com:hapyrus/kodama.git","clone_url":"https://github.com/hapyrus/kodama.git","svn_url":"https://github.com/hapyrus/kodama","homepage":null,"size":224,"stargazers_count":1,"watchers_count":1,"language":"Ruby","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":1,"default_branch":"master"}},"base":{"label":"hapyrus:master","ref":"master","sha":"b40f55b6ecc1020571f4d235b325b313f2033afe","user":{"login":"hapyrus","id":438949,"avatar_url":"https://avatars.githubusercontent.com/u/438949?v=3","gravatar_id":"","url":"https://api.github.com/users/hapyrus","html_url":"https://github.com/hapyrus","followers_url":"https://api.github.com/users/hapyrus/followers","following_url":"https://api.github.com/users/hapyrus/following{/other_user}","gists_url":"https://api.github.com/users/hapyrus/gists{/gist_id}","starred_url":"https://api.github.com/users/hapyrus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hapyrus/subscriptions","organizations_url":"https://api.github.com/users/hapyrus/orgs","repos_url":"https://api.github.com/users/hapyrus/repos","events_url":"https://api.github.com/users/hapyrus/events{/privacy}","received_events_url":"https://api.github.com/users/hapyrus/received_events","type":"Organization","site_admin":false},"repo":{"id":29760098,"name":"kodama","full_name":"hapyrus/kodama","owner":{"login":"hapyrus","id":438949,"avatar_url":"https://avatars.githubusercontent.com/u/438949?v=3","gravatar_id":"","url":"https://api.github.com/users/hapyrus","html_url":"https://github.com/hapyrus","followers_url":"https://api.github.com/users/hapyrus/followers","following_url":"https://api.github.com/users/hapyrus/following{/other_user}","gists_url":"https://api.github.com/users/hapyrus/gists{/gist_id}","starred_url":"https://api.github.com/users/hapyrus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hapyrus/subscriptions","organizations_url":"https://api.github.com/users/hapyrus/orgs","repos_url":"https://api.github.com/users/hapyrus/repos","events_url":"https://api.github.com/users/hapyrus/events{/privacy}","received_events_url":"https://api.github.com/users/hapyrus/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hapyrus/kodama","description":"ruby-binlog based MySQL replication listener","fork":true,"url":"https://api.github.com/repos/hapyrus/kodama","forks_url":"https://api.github.com/repos/hapyrus/kodama/forks","keys_url":"https://api.github.com/repos/hapyrus/kodama/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hapyrus/kodama/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hapyrus/kodama/teams","hooks_url":"https://api.github.com/repos/hapyrus/kodama/hooks","issue_events_url":"https://api.github.com/repos/hapyrus/kodama/issues/events{/number}","events_url":"https://api.github.com/repos/hapyrus/kodama/events","assignees_url":"https://api.github.com/repos/hapyrus/kodama/assignees{/user}","branches_url":"https://api.github.com/repos/hapyrus/kodama/branches{/branch}","tags_url":"https://api.github.com/repos/hapyrus/kodama/tags","blobs_url":"https://api.github.com/repos/hapyrus/kodama/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hapyrus/kodama/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hapyrus/kodama/git/refs{/sha}","trees_url":"https://api.github.com/repos/hapyrus/kodama/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hapyrus/kodama/statuses/{sha}","languages_url":"https://api.github.com/repos/hapyrus/kodama/languages","stargazers_url":"https://api.github.com/repos/hapyrus/kodama/stargazers","contributors_url":"https://api.github.com/repos/hapyrus/kodama/contributors","subscribers_url":"https://api.github.com/repos/hapyrus/kodama/subscribers","subscription_url":"https://api.github.com/repos/hapyrus/kodama/subscription","commits_url":"https://api.github.com/repos/hapyrus/kodama/commits{/sha}","git_commits_url":"https://api.github.com/repos/hapyrus/kodama/git/commits{/sha}","comments_url":"https://api.github.com/repos/hapyrus/kodama/comments{/number}","issue_comment_url":"https://api.github.com/repos/hapyrus/kodama/issues/comments{/number}","contents_url":"https://api.github.com/repos/hapyrus/kodama/contents/{+path}","compare_url":"https://api.github.com/repos/hapyrus/kodama/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hapyrus/kodama/merges","archive_url":"https://api.github.com/repos/hapyrus/kodama/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hapyrus/kodama/downloads","issues_url":"https://api.github.com/repos/hapyrus/kodama/issues{/number}","pulls_url":"https://api.github.com/repos/hapyrus/kodama/pulls{/number}","milestones_url":"https://api.github.com/repos/hapyrus/kodama/milestones{/number}","notifications_url":"https://api.github.com/repos/hapyrus/kodama/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hapyrus/kodama/labels{/name}","releases_url":"https://api.github.com/repos/hapyrus/kodama/releases{/id}","created_at":"2015-01-24T00:37:59Z","updated_at":"2015-05-25T10:07:31Z","pushed_at":"2015-06-19T20:37:31Z","git_url":"git://github.com/hapyrus/kodama.git","ssh_url":"git@github.com:hapyrus/kodama.git","clone_url":"https://github.com/hapyrus/kodama.git","svn_url":"https://github.com/hapyrus/kodama","homepage":null,"size":224,"stargazers_count":1,"watchers_count":1,"language":"Ruby","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":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hapyrus/kodama/pulls/6"},"html":{"href":"https://github.com/hapyrus/kodama/pull/6"},"issue":{"href":"https://api.github.com/repos/hapyrus/kodama/issues/6"},"comments":{"href":"https://api.github.com/repos/hapyrus/kodama/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/hapyrus/kodama/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/hapyrus/kodama/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hapyrus/kodama/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/hapyrus/kodama/statuses/376fd130473a11a76cb464e2543710cc896ceec4"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"mmasashi","id":100385,"avatar_url":"https://avatars.githubusercontent.com/u/100385?v=3","gravatar_id":"","url":"https://api.github.com/users/mmasashi","html_url":"https://github.com/mmasashi","followers_url":"https://api.github.com/users/mmasashi/followers","following_url":"https://api.github.com/users/mmasashi/following{/other_user}","gists_url":"https://api.github.com/users/mmasashi/gists{/gist_id}","starred_url":"https://api.github.com/users/mmasashi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmasashi/subscriptions","organizations_url":"https://api.github.com/users/mmasashi/orgs","repos_url":"https://api.github.com/users/mmasashi/repos","events_url":"https://api.github.com/users/mmasashi/events{/privacy}","received_events_url":"https://api.github.com/users/mmasashi/received_events","type":"User","site_admin":false},"comments":1,"review_comments":4,"commits":4,"additions":266,"deletions":28,"changed_files":2}}