payload: {"action":"created","comment":{"url":"https://api.github.com/repos/percona/percona-server/pulls/comments/299459633","pull_request_review_id":256857734,"id":299459633,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI5OTQ1OTYzMw==","diff_hunk":"@@ -327,6 +327,59 @@ struct fil_space_scrub_status_t {\n   ulint current_scrub_max_page_number; /*!< current scrub max page no */\n };\n \n+struct redo_log_key final {\n+  uint version;\n+  char key[ENCRYPTION_KEY_LEN];\n+  ulint read_count;\n+  ulint write_count;\n+  bool present;\n+\n+  bool persisted() const noexcept { return version != 0; }\n+};\n+\n+/** Handles the fetching/generation/storing/etc of keyring redo log keys.\n+\n+ This class is *NOT* thread safe, as thread safety is not required.\n+ Data is only accessed/modified on the following points:\n+ * When the redo space is created, at startup\n+ * During redo log recovery, at startup\n+ * When the server UUID is generated, at startup\n+ * When the user requests a new key version, checked periodically in the\n+   master thread\n+\n+ As these can't happen in parallel, no lock is used.\n+ */\n+class redo_log_keys final {\n+ public:\n+  /** Loads the latest redo log key from the keyring.\n+   * @param[in]\tgenerate If true, a key is generated if an existing key can't","path":"storage/innobase/include/fil0crypt.h","position":29,"original_position":29,"commit_id":"1411ac6ee3bf9cd2559ffb4458466152e87e2748","original_commit_id":"1411ac6ee3bf9cd2559ffb4458466152e87e2748","user":{"login":"laurynas-biveinis","id":58894,"node_id":"MDQ6VXNlcjU4ODk0","avatar_url":"https://avatars3.githubusercontent.com/u/58894?v=4","gravatar_id":"","url":"https://api.github.com/users/laurynas-biveinis","html_url":"https://github.com/laurynas-biveinis","followers_url":"https://api.github.com/users/laurynas-biveinis/followers","following_url":"https://api.github.com/users/laurynas-biveinis/following{/other_user}","gists_url":"https://api.github.com/users/laurynas-biveinis/gists{/gist_id}","starred_url":"https://api.github.com/users/laurynas-biveinis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laurynas-biveinis/subscriptions","organizations_url":"https://api.github.com/users/laurynas-biveinis/orgs","repos_url":"https://api.github.com/users/laurynas-biveinis/repos","events_url":"https://api.github.com/users/laurynas-biveinis/events{/privacy}","received_events_url":"https://api.github.com/users/laurynas-biveinis/received_events","type":"User","site_admin":false},"body":"```suggestion\r\n   @param[in]\tgenerate If true, a key is generated if an existing key can't\r\n```","created_at":"2019-07-02T12:36:24Z","updated_at":"2019-07-02T12:40:00Z","html_url":"https://github.com/percona/percona-server/pull/3236#discussion_r299459633","pull_request_url":"https://api.github.com/repos/percona/percona-server/pulls/3236","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/percona/percona-server/pulls/comments/299459633"},"html":{"href":"https://github.com/percona/percona-server/pull/3236#discussion_r299459633"},"pull_request":{"href":"https://api.github.com/repos/percona/percona-server/pulls/3236"}}},"pull_request":{"url":"https://api.github.com/repos/percona/percona-server/pulls/3236","id":287825829,"node_id":"MDExOlB1bGxSZXF1ZXN0Mjg3ODI1ODI5","html_url":"https://github.com/percona/percona-server/pull/3236","diff_url":"https://github.com/percona/percona-server/pull/3236.diff","patch_url":"https://github.com/percona/percona-server/pull/3236.patch","issue_url":"https://api.github.com/repos/percona/percona-server/issues/3236","number":3236,"state":"open","locked":false,"title":"PS-5565: Better versioning with keyring redo encryption (8.0)","user":{"login":"dutow","id":489009,"node_id":"MDQ6VXNlcjQ4OTAwOQ==","avatar_url":"https://avatars3.githubusercontent.com/u/489009?v=4","gravatar_id":"","url":"https://api.github.com/users/dutow","html_url":"https://github.com/dutow","followers_url":"https://api.github.com/users/dutow/followers","following_url":"https://api.github.com/users/dutow/following{/other_user}","gists_url":"https://api.github.com/users/dutow/gists{/gist_id}","starred_url":"https://api.github.com/users/dutow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dutow/subscriptions","organizations_url":"https://api.github.com/users/dutow/orgs","repos_url":"https://api.github.com/users/dutow/repos","events_url":"https://api.github.com/users/dutow/events{/privacy}","received_events_url":"https://api.github.com/users/dutow/received_events","type":"User","site_admin":false},"body":"Previously keyring redo encryption only selected a version when the\r\nredo log was created - changing the key version required recreating\r\nthe redo log.\r\n\r\nWith this change, individual pages all have separate versions. To\r\naccomplish this, we reuse the checksum field: during encryption, we\r\nassume that the checksum is correct, and replace it with the\r\nchecksum of the encrypted data, plus the key version.\r\nDuring reads, we calculate the checksum again, and assume that the\r\ndifference between the written data and the calculated value is the\r\nkey version.\r\nAn incorrect checksum will result in an incorrect key version,\r\nresulting in quite likely a decryption error.\r\nIn the unlikely case that the checksum is wrong, but the resulting\r\nnumber refers to an existing key, the decrypted data will be\r\ngarbage and log recovery will abort later.\r\n\r\nSince the redo key version now dynamic, it is exported as the\r\ninnodb_encryption_redo_key_version status variable.\r\n\r\nTo support this change, keyring handling of the redo log keys were\r\nextracted to the redo_log_key_mgr global variable. This variable is\r\nnow the owner of all used keyring redo keys, and everything else\r\nuses pointers to keys managed by it.\r\nThis way:\r\n* keyring key handling is extracted to a common place, without\r\n  too much code duplicated in multiple files\r\n* key-copying races between threads changing the keys and others\r\nwriting data to the redo log are prevented, as it is a simple\r\npointer change now\r\n\r\nThe commit also includes minor fixes for issues previously hidden\r\nby the limited usability of keyring redo encryption.\r\n\r\n(cherry picked from commit 56e845e4a111249208d7285ae07075340e05d8cf)","created_at":"2019-06-13T08:57:58Z","updated_at":"2019-07-02T12:40:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ef4268d3659251fcf1a0e36b30b208dc08ccd84b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/percona/percona-server/pulls/3236/commits","review_comments_url":"https://api.github.com/repos/percona/percona-server/pulls/3236/comments","review_comment_url":"https://api.github.com/repos/percona/percona-server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/percona/percona-server/issues/3236/comments","statuses_url":"https://api.github.com/repos/percona/percona-server/statuses/1411ac6ee3bf9cd2559ffb4458466152e87e2748","head":{"label":"dutow:ps-8.0-ps5565","ref":"ps-8.0-ps5565","sha":"1411ac6ee3bf9cd2559ffb4458466152e87e2748","user":{"login":"dutow","id":489009,"node_id":"MDQ6VXNlcjQ4OTAwOQ==","avatar_url":"https://avatars3.githubusercontent.com/u/489009?v=4","gravatar_id":"","url":"https://api.github.com/users/dutow","html_url":"https://github.com/dutow","followers_url":"https://api.github.com/users/dutow/followers","following_url":"https://api.github.com/users/dutow/following{/other_user}","gists_url":"https://api.github.com/users/dutow/gists{/gist_id}","starred_url":"https://api.github.com/users/dutow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dutow/subscriptions","organizations_url":"https://api.github.com/users/dutow/orgs","repos_url":"https://api.github.com/users/dutow/repos","events_url":"https://api.github.com/users/dutow/events{/privacy}","received_events_url":"https://api.github.com/users/dutow/received_events","type":"User","site_admin":false},"repo":{"id":111694230,"node_id":"MDEwOlJlcG9zaXRvcnkxMTE2OTQyMzA=","name":"percona-server","full_name":"dutow/percona-server","private":false,"owner":{"login":"dutow","id":489009,"node_id":"MDQ6VXNlcjQ4OTAwOQ==","avatar_url":"https://avatars3.githubusercontent.com/u/489009?v=4","gravatar_id":"","url":"https://api.github.com/users/dutow","html_url":"https://github.com/dutow","followers_url":"https://api.github.com/users/dutow/followers","following_url":"https://api.github.com/users/dutow/following{/other_user}","gists_url":"https://api.github.com/users/dutow/gists{/gist_id}","starred_url":"https://api.github.com/users/dutow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dutow/subscriptions","organizations_url":"https://api.github.com/users/dutow/orgs","repos_url":"https://api.github.com/users/dutow/repos","events_url":"https://api.github.com/users/dutow/events{/privacy}","received_events_url":"https://api.github.com/users/dutow/received_events","type":"User","site_admin":false},"html_url":"https://github.com/dutow/percona-server","description":"Percona Server","fork":true,"url":"https://api.github.com/repos/dutow/percona-server","forks_url":"https://api.github.com/repos/dutow/percona-server/forks","keys_url":"https://api.github.com/repos/dutow/percona-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dutow/percona-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dutow/percona-server/teams","hooks_url":"https://api.github.com/repos/dutow/percona-server/hooks","issue_events_url":"https://api.github.com/repos/dutow/percona-server/issues/events{/number}","events_url":"https://api.github.com/repos/dutow/percona-server/events","assignees_url":"https://api.github.com/repos/dutow/percona-server/assignees{/user}","branches_url":"https://api.github.com/repos/dutow/percona-server/branches{/branch}","tags_url":"https://api.github.com/repos/dutow/percona-server/tags","blobs_url":"https://api.github.com/repos/dutow/percona-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dutow/percona-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dutow/percona-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/dutow/percona-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dutow/percona-server/statuses/{sha}","languages_url":"https://api.github.com/repos/dutow/percona-server/languages","stargazers_url":"https://api.github.com/repos/dutow/percona-server/stargazers","contributors_url":"https://api.github.com/repos/dutow/percona-server/contributors","subscribers_url":"https://api.github.com/repos/dutow/percona-server/subscribers","subscription_url":"https://api.github.com/repos/dutow/percona-server/subscription","commits_url":"https://api.github.com/repos/dutow/percona-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/dutow/percona-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/dutow/percona-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/dutow/percona-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/dutow/percona-server/contents/{+path}","compare_url":"https://api.github.com/repos/dutow/percona-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dutow/percona-server/merges","archive_url":"https://api.github.com/repos/dutow/percona-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dutow/percona-server/downloads","issues_url":"https://api.github.com/repos/dutow/percona-server/issues{/number}","pulls_url":"https://api.github.com/repos/dutow/percona-server/pulls{/number}","milestones_url":"https://api.github.com/repos/dutow/percona-server/milestones{/number}","notifications_url":"https://api.github.com/repos/dutow/percona-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dutow/percona-server/labels{/name}","releases_url":"https://api.github.com/repos/dutow/percona-server/releases{/id}","deployments_url":"https://api.github.com/repos/dutow/percona-server/deployments","created_at":"2017-11-22T14:27:07Z","updated_at":"2019-06-24T13:32:55Z","pushed_at":"2019-07-01T14:53:11Z","git_url":"git://github.com/dutow/percona-server.git","ssh_url":"git@github.com:dutow/percona-server.git","clone_url":"https://github.com/dutow/percona-server.git","svn_url":"https://github.com/dutow/percona-server","homepage":"https://www.percona.com/software/mysql-database/percona-server","size":2400012,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"5.7"}},"base":{"label":"percona:8.0","ref":"8.0","sha":"aed8a3ffcce27d301e2fe41d2280b9e561f450a6","user":{"login":"percona","id":1683025,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2ODMwMjU=","avatar_url":"https://avatars0.githubusercontent.com/u/1683025?v=4","gravatar_id":"","url":"https://api.github.com/users/percona","html_url":"https://github.com/percona","followers_url":"https://api.github.com/users/percona/followers","following_url":"https://api.github.com/users/percona/following{/other_user}","gists_url":"https://api.github.com/users/percona/gists{/gist_id}","starred_url":"https://api.github.com/users/percona/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/percona/subscriptions","organizations_url":"https://api.github.com/users/percona/orgs","repos_url":"https://api.github.com/users/percona/repos","events_url":"https://api.github.com/users/percona/events{/privacy}","received_events_url":"https://api.github.com/users/percona/received_events","type":"Organization","site_admin":false},"repo":{"id":30753733,"node_id":"MDEwOlJlcG9zaXRvcnkzMDc1MzczMw==","name":"percona-server","full_name":"percona/percona-server","private":false,"owner":{"login":"percona","id":1683025,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2ODMwMjU=","avatar_url":"https://avatars0.githubusercontent.com/u/1683025?v=4","gravatar_id":"","url":"https://api.github.com/users/percona","html_url":"https://github.com/percona","followers_url":"https://api.github.com/users/percona/followers","following_url":"https://api.github.com/users/percona/following{/other_user}","gists_url":"https://api.github.com/users/percona/gists{/gist_id}","starred_url":"https://api.github.com/users/percona/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/percona/subscriptions","organizations_url":"https://api.github.com/users/percona/orgs","repos_url":"https://api.github.com/users/percona/repos","events_url":"https://api.github.com/users/percona/events{/privacy}","received_events_url":"https://api.github.com/users/percona/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/percona/percona-server","description":"Percona Server","fork":false,"url":"https://api.github.com/repos/percona/percona-server","forks_url":"https://api.github.com/repos/percona/percona-server/forks","keys_url":"https://api.github.com/repos/percona/percona-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/percona/percona-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/percona/percona-server/teams","hooks_url":"https://api.github.com/repos/percona/percona-server/hooks","issue_events_url":"https://api.github.com/repos/percona/percona-server/issues/events{/number}","events_url":"https://api.github.com/repos/percona/percona-server/events","assignees_url":"https://api.github.com/repos/percona/percona-server/assignees{/user}","branches_url":"https://api.github.com/repos/percona/percona-server/branches{/branch}","tags_url":"https://api.github.com/repos/percona/percona-server/tags","blobs_url":"https://api.github.com/repos/percona/percona-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/percona/percona-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/percona/percona-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/percona/percona-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/percona/percona-server/statuses/{sha}","languages_url":"https://api.github.com/repos/percona/percona-server/languages","stargazers_url":"https://api.github.com/repos/percona/percona-server/stargazers","contributors_url":"https://api.github.com/repos/percona/percona-server/contributors","subscribers_url":"https://api.github.com/repos/percona/percona-server/subscribers","subscription_url":"https://api.github.com/repos/percona/percona-server/subscription","commits_url":"https://api.github.com/repos/percona/percona-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/percona/percona-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/percona/percona-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/percona/percona-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/percona/percona-server/contents/{+path}","compare_url":"https://api.github.com/repos/percona/percona-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/percona/percona-server/merges","archive_url":"https://api.github.com/repos/percona/percona-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/percona/percona-server/downloads","issues_url":"https://api.github.com/repos/percona/percona-server/issues{/number}","pulls_url":"https://api.github.com/repos/percona/percona-server/pulls{/number}","milestones_url":"https://api.github.com/repos/percona/percona-server/milestones{/number}","notifications_url":"https://api.github.com/repos/percona/percona-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/percona/percona-server/labels{/name}","releases_url":"https://api.github.com/repos/percona/percona-server/releases{/id}","deployments_url":"https://api.github.com/repos/percona/percona-server/deployments","created_at":"2015-02-13T11:32:01Z","updated_at":"2019-07-02T06:51:33Z","pushed_at":"2019-07-02T11:44:40Z","git_url":"git://github.com/percona/percona-server.git","ssh_url":"git@github.com:percona/percona-server.git","clone_url":"https://github.com/percona/percona-server.git","svn_url":"https://github.com/percona/percona-server","homepage":"https://www.percona.com/software/mysql-database/percona-server","size":2396006,"stargazers_count":573,"watchers_count":573,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":255,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":71,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":255,"open_issues":71,"watchers":573,"default_branch":"8.0"}},"_links":{"self":{"href":"https://api.github.com/repos/percona/percona-server/pulls/3236"},"html":{"href":"https://github.com/percona/percona-server/pull/3236"},"issue":{"href":"https://api.github.com/repos/percona/percona-server/issues/3236"},"comments":{"href":"https://api.github.com/repos/percona/percona-server/issues/3236/comments"},"review_comments":{"href":"https://api.github.com/repos/percona/percona-server/pulls/3236/comments"},"review_comment":{"href":"https://api.github.com/repos/percona/percona-server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/percona/percona-server/pulls/3236/commits"},"statuses":{"href":"https://api.github.com/repos/percona/percona-server/statuses/1411ac6ee3bf9cd2559ffb4458466152e87e2748"}},"author_association":"CONTRIBUTOR"}}
other: {"actor":{"display_login":"laurynas-biveinis"}}