{"action":"created","comment":{"url":"https://api.github.com/repos/facebook/mysql-5.6/pulls/comments/142768175","pull_request_review_id":67178405,"id":142768175,"diff_hunk":"@@ -10439,31 +10517,23 @@ void ha_rocksdb::get_auto_increment(ulonglong off, ulonglong inc,\n         //      may not be in our sequence, but it is guaranteed to be equal\n         //      to or larger than any other value already inserted.\n         //\n-        //  For now I'm going to take option @2.\n-        new_val = std::numeric_limits<longlong>::max();\n+        //  For now I'm going to take option 2.\n+        new_val = std::numeric_limits<ulonglong>::max();\n         auto_incr = new_val;  // Store the largest value into auto_incr","path":"storage/rocksdb/ha_rocksdb.cc","position":170,"original_position":170,"commit_id":"f0b15daf7134714f118ff117f777218bf944509e","original_commit_id":"f0b15daf7134714f118ff117f777218bf944509e","user":{"login":"lth","id":292656,"avatar_url":"https://avatars1.githubusercontent.com/u/292656?v=4","gravatar_id":"","url":"https://api.github.com/users/lth","html_url":"https://github.com/lth","followers_url":"https://api.github.com/users/lth/followers","following_url":"https://api.github.com/users/lth/following{/other_user}","gists_url":"https://api.github.com/users/lth/gists{/gist_id}","starred_url":"https://api.github.com/users/lth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lth/subscriptions","organizations_url":"https://api.github.com/users/lth/orgs","repos_url":"https://api.github.com/users/lth/repos","events_url":"https://api.github.com/users/lth/events{/privacy}","received_events_url":"https://api.github.com/users/lth/received_events","type":"User","site_admin":false},"body":"If you have `n * inc + off > ULLONG_MAX`, then you definitely have a UNSIGNED BIGINT here, so it's the same as max_val. I can add an assert if needed.\r\n\r\nAs a side note, a return value of ULLONG_MAX for `get_auto_increment` has special meaning. This will return `ER_AUTOINC_READ_FAILED` to the user. So we have a quirk due to the SE API that we have different autoinc behaviour between UNSIGNED BIGINT and any of the other integer type. For UNSIGNED BIGINT, you get `ER_AUTOINC_READ_FAILED` once you hit max, whereas for everyone else, you just get duplicate key error (or no error if autoinc is on SK).","created_at":"2017-10-04T19:22:32Z","updated_at":"2017-10-04T19:22:32Z","html_url":"https://github.com/facebook/mysql-5.6/pull/720#discussion_r142768175","pull_request_url":"https://api.github.com/repos/facebook/mysql-5.6/pulls/720","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/facebook/mysql-5.6/pulls/comments/142768175"},"html":{"href":"https://github.com/facebook/mysql-5.6/pull/720#discussion_r142768175"},"pull_request":{"href":"https://api.github.com/repos/facebook/mysql-5.6/pulls/720"}},"in_reply_to_id":142738518},"pull_request":{"url":"https://api.github.com/repos/facebook/mysql-5.6/pulls/720","id":144247408,"html_url":"https://github.com/facebook/mysql-5.6/pull/720","diff_url":"https://github.com/facebook/mysql-5.6/pull/720.diff","patch_url":"https://github.com/facebook/mysql-5.6/pull/720.patch","issue_url":"https://api.github.com/repos/facebook/mysql-5.6/issues/720","number":720,"state":"open","locked":false,"title":"Fix auto_increment bug with large values","user":{"login":"lth","id":292656,"avatar_url":"https://avatars1.githubusercontent.com/u/292656?v=4","gravatar_id":"","url":"https://api.github.com/users/lth","html_url":"https://github.com/lth","followers_url":"https://api.github.com/users/lth/followers","following_url":"https://api.github.com/users/lth/following{/other_user}","gists_url":"https://api.github.com/users/lth/gists{/gist_id}","starred_url":"https://api.github.com/users/lth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lth/subscriptions","organizations_url":"https://api.github.com/users/lth/orgs","repos_url":"https://api.github.com/users/lth/repos","events_url":"https://api.github.com/users/lth/events{/privacy}","received_events_url":"https://api.github.com/users/lth/received_events","type":"User","site_admin":false},"body":"There are currently two related bugs in our autoincrement implementation\r\nrelating to large values.\r\n\r\n1. When inserting values larger than LLONG_MAX, we do not bump the\r\nautoincrement counter on the table because we are using signed 64bit integers\r\nto store autoincrement. Fix by converting to use ulonglong.\r\n\r\n2. When `auto_increment_increment` is set, and the next number in the sequence\r\nis larger than ULLONG_MAX, we are not currently do not error out, and instead\r\ninsert smaller values, due to underflow. Fix by calculating next value more\r\ncarefully, and return ULLONG_MAX when limit is reached, so that the server can\r\nhandle appropriately.","created_at":"2017-10-02T18:10:42Z","updated_at":"2017-10-04T19:22:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9c2cf73c520e49bee72431851700516577fdd891","assignee":null,"assignees":[],"requested_reviewers":[{"login":"yoshinorim","id":253614,"avatar_url":"https://avatars1.githubusercontent.com/u/253614?v=4","gravatar_id":"","url":"https://api.github.com/users/yoshinorim","html_url":"https://github.com/yoshinorim","followers_url":"https://api.github.com/users/yoshinorim/followers","following_url":"https://api.github.com/users/yoshinorim/following{/other_user}","gists_url":"https://api.github.com/users/yoshinorim/gists{/gist_id}","starred_url":"https://api.github.com/users/yoshinorim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yoshinorim/subscriptions","organizations_url":"https://api.github.com/users/yoshinorim/orgs","repos_url":"https://api.github.com/users/yoshinorim/repos","events_url":"https://api.github.com/users/yoshinorim/events{/privacy}","received_events_url":"https://api.github.com/users/yoshinorim/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/facebook/mysql-5.6/pulls/720/commits","review_comments_url":"https://api.github.com/repos/facebook/mysql-5.6/pulls/720/comments","review_comment_url":"https://api.github.com/repos/facebook/mysql-5.6/pulls/comments{/number}","comments_url":"https://api.github.com/repos/facebook/mysql-5.6/issues/720/comments","statuses_url":"https://api.github.com/repos/facebook/mysql-5.6/statuses/f0b15daf7134714f118ff117f777218bf944509e","head":{"label":"lth:fix_auto_bug","ref":"fix_auto_bug","sha":"f0b15daf7134714f118ff117f777218bf944509e","user":{"login":"lth","id":292656,"avatar_url":"https://avatars1.githubusercontent.com/u/292656?v=4","gravatar_id":"","url":"https://api.github.com/users/lth","html_url":"https://github.com/lth","followers_url":"https://api.github.com/users/lth/followers","following_url":"https://api.github.com/users/lth/following{/other_user}","gists_url":"https://api.github.com/users/lth/gists{/gist_id}","starred_url":"https://api.github.com/users/lth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lth/subscriptions","organizations_url":"https://api.github.com/users/lth/orgs","repos_url":"https://api.github.com/users/lth/repos","events_url":"https://api.github.com/users/lth/events{/privacy}","received_events_url":"https://api.github.com/users/lth/received_events","type":"User","site_admin":false},"repo":{"id":71388032,"name":"mysql-5.6","full_name":"lth/mysql-5.6","owner":{"login":"lth","id":292656,"avatar_url":"https://avatars1.githubusercontent.com/u/292656?v=4","gravatar_id":"","url":"https://api.github.com/users/lth","html_url":"https://github.com/lth","followers_url":"https://api.github.com/users/lth/followers","following_url":"https://api.github.com/users/lth/following{/other_user}","gists_url":"https://api.github.com/users/lth/gists{/gist_id}","starred_url":"https://api.github.com/users/lth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lth/subscriptions","organizations_url":"https://api.github.com/users/lth/orgs","repos_url":"https://api.github.com/users/lth/repos","events_url":"https://api.github.com/users/lth/events{/privacy}","received_events_url":"https://api.github.com/users/lth/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lth/mysql-5.6","description":"Facebook's branch of the Oracle MySQL v5.6 database. This includes MyRocks.","fork":true,"url":"https://api.github.com/repos/lth/mysql-5.6","forks_url":"https://api.github.com/repos/lth/mysql-5.6/forks","keys_url":"https://api.github.com/repos/lth/mysql-5.6/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lth/mysql-5.6/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lth/mysql-5.6/teams","hooks_url":"https://api.github.com/repos/lth/mysql-5.6/hooks","issue_events_url":"https://api.github.com/repos/lth/mysql-5.6/issues/events{/number}","events_url":"https://api.github.com/repos/lth/mysql-5.6/events","assignees_url":"https://api.github.com/repos/lth/mysql-5.6/assignees{/user}","branches_url":"https://api.github.com/repos/lth/mysql-5.6/branches{/branch}","tags_url":"https://api.github.com/repos/lth/mysql-5.6/tags","blobs_url":"https://api.github.com/repos/lth/mysql-5.6/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lth/mysql-5.6/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lth/mysql-5.6/git/refs{/sha}","trees_url":"https://api.github.com/repos/lth/mysql-5.6/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lth/mysql-5.6/statuses/{sha}","languages_url":"https://api.github.com/repos/lth/mysql-5.6/languages","stargazers_url":"https://api.github.com/repos/lth/mysql-5.6/stargazers","contributors_url":"https://api.github.com/repos/lth/mysql-5.6/contributors","subscribers_url":"https://api.github.com/repos/lth/mysql-5.6/subscribers","subscription_url":"https://api.github.com/repos/lth/mysql-5.6/subscription","commits_url":"https://api.github.com/repos/lth/mysql-5.6/commits{/sha}","git_commits_url":"https://api.github.com/repos/lth/mysql-5.6/git/commits{/sha}","comments_url":"https://api.github.com/repos/lth/mysql-5.6/comments{/number}","issue_comment_url":"https://api.github.com/repos/lth/mysql-5.6/issues/comments{/number}","contents_url":"https://api.github.com/repos/lth/mysql-5.6/contents/{+path}","compare_url":"https://api.github.com/repos/lth/mysql-5.6/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lth/mysql-5.6/merges","archive_url":"https://api.github.com/repos/lth/mysql-5.6/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lth/mysql-5.6/downloads","issues_url":"https://api.github.com/repos/lth/mysql-5.6/issues{/number}","pulls_url":"https://api.github.com/repos/lth/mysql-5.6/pulls{/number}","milestones_url":"https://api.github.com/repos/lth/mysql-5.6/milestones{/number}","notifications_url":"https://api.github.com/repos/lth/mysql-5.6/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lth/mysql-5.6/labels{/name}","releases_url":"https://api.github.com/repos/lth/mysql-5.6/releases{/id}","deployments_url":"https://api.github.com/repos/lth/mysql-5.6/deployments","created_at":"2016-10-19T18:37:13Z","updated_at":"2016-11-04T06:31:36Z","pushed_at":"2017-10-02T23:13:06Z","git_url":"git://github.com/lth/mysql-5.6.git","ssh_url":"git@github.com:lth/mysql-5.6.git","clone_url":"https://github.com/lth/mysql-5.6.git","svn_url":"https://github.com/lth/mysql-5.6","homepage":"https://github.com/facebook/mysql-5.6","size":352188,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"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":"webscalesql-5.6.27.75"}},"base":{"label":"facebook:fb-mysql-5.6.35","ref":"fb-mysql-5.6.35","sha":"e9b161f0f9877b69778c56dbc910e86061cdcc04","user":{"login":"facebook","id":69631,"avatar_url":"https://avatars3.githubusercontent.com/u/69631?v=4","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"repo":{"id":9454675,"name":"mysql-5.6","full_name":"facebook/mysql-5.6","owner":{"login":"facebook","id":69631,"avatar_url":"https://avatars3.githubusercontent.com/u/69631?v=4","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/facebook/mysql-5.6","description":"Facebook's branch of the Oracle MySQL v5.6 database. This includes MyRocks.","fork":false,"url":"https://api.github.com/repos/facebook/mysql-5.6","forks_url":"https://api.github.com/repos/facebook/mysql-5.6/forks","keys_url":"https://api.github.com/repos/facebook/mysql-5.6/keys{/key_id}","collaborators_url":"https://api.github.com/repos/facebook/mysql-5.6/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/facebook/mysql-5.6/teams","hooks_url":"https://api.github.com/repos/facebook/mysql-5.6/hooks","issue_events_url":"https://api.github.com/repos/facebook/mysql-5.6/issues/events{/number}","events_url":"https://api.github.com/repos/facebook/mysql-5.6/events","assignees_url":"https://api.github.com/repos/facebook/mysql-5.6/assignees{/user}","branches_url":"https://api.github.com/repos/facebook/mysql-5.6/branches{/branch}","tags_url":"https://api.github.com/repos/facebook/mysql-5.6/tags","blobs_url":"https://api.github.com/repos/facebook/mysql-5.6/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/facebook/mysql-5.6/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/facebook/mysql-5.6/git/refs{/sha}","trees_url":"https://api.github.com/repos/facebook/mysql-5.6/git/trees{/sha}","statuses_url":"https://api.github.com/repos/facebook/mysql-5.6/statuses/{sha}","languages_url":"https://api.github.com/repos/facebook/mysql-5.6/languages","stargazers_url":"https://api.github.com/repos/facebook/mysql-5.6/stargazers","contributors_url":"https://api.github.com/repos/facebook/mysql-5.6/contributors","subscribers_url":"https://api.github.com/repos/facebook/mysql-5.6/subscribers","subscription_url":"https://api.github.com/repos/facebook/mysql-5.6/subscription","commits_url":"https://api.github.com/repos/facebook/mysql-5.6/commits{/sha}","git_commits_url":"https://api.github.com/repos/facebook/mysql-5.6/git/commits{/sha}","comments_url":"https://api.github.com/repos/facebook/mysql-5.6/comments{/number}","issue_comment_url":"https://api.github.com/repos/facebook/mysql-5.6/issues/comments{/number}","contents_url":"https://api.github.com/repos/facebook/mysql-5.6/contents/{+path}","compare_url":"https://api.github.com/repos/facebook/mysql-5.6/compare/{base}...{head}","merges_url":"https://api.github.com/repos/facebook/mysql-5.6/merges","archive_url":"https://api.github.com/repos/facebook/mysql-5.6/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/facebook/mysql-5.6/downloads","issues_url":"https://api.github.com/repos/facebook/mysql-5.6/issues{/number}","pulls_url":"https://api.github.com/repos/facebook/mysql-5.6/pulls{/number}","milestones_url":"https://api.github.com/repos/facebook/mysql-5.6/milestones{/number}","notifications_url":"https://api.github.com/repos/facebook/mysql-5.6/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/facebook/mysql-5.6/labels{/name}","releases_url":"https://api.github.com/repos/facebook/mysql-5.6/releases{/id}","deployments_url":"https://api.github.com/repos/facebook/mysql-5.6/deployments","created_at":"2013-04-15T17:54:43Z","updated_at":"2017-10-04T15:39:18Z","pushed_at":"2017-10-03T19:14:46Z","git_url":"git://github.com/facebook/mysql-5.6.git","ssh_url":"git@github.com:facebook/mysql-5.6.git","clone_url":"https://github.com/facebook/mysql-5.6.git","svn_url":"https://github.com/facebook/mysql-5.6","homepage":"https://github.com/facebook/mysql-5.6","size":414636,"stargazers_count":1051,"watchers_count":1051,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":376,"mirror_url":null,"open_issues_count":108,"forks":376,"open_issues":108,"watchers":1051,"default_branch":"fb-mysql-5.6.35"}},"_links":{"self":{"href":"https://api.github.com/repos/facebook/mysql-5.6/pulls/720"},"html":{"href":"https://github.com/facebook/mysql-5.6/pull/720"},"issue":{"href":"https://api.github.com/repos/facebook/mysql-5.6/issues/720"},"comments":{"href":"https://api.github.com/repos/facebook/mysql-5.6/issues/720/comments"},"review_comments":{"href":"https://api.github.com/repos/facebook/mysql-5.6/pulls/720/comments"},"review_comment":{"href":"https://api.github.com/repos/facebook/mysql-5.6/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/facebook/mysql-5.6/pulls/720/commits"},"statuses":{"href":"https://api.github.com/repos/facebook/mysql-5.6/statuses/f0b15daf7134714f118ff117f777218bf944509e"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"lth"}}