Data at rest encryption. MariaDB calls the get_latest_version() of the *_key_management plugins millions of times if innodb_encryption_threads>1 during data scrub.
Tested with file_key_management plugin, but it should not matter.
The issue can be seen at each background data scrub, so for testing purposes I have set the interval to 60 seconds:
innodb-background-scrub-data-check-interval=60
When using innodb_encryption_threads>1 the function get_latest_version() of the plugin is called millions of times, also cpu load raises considerably.
Using innodb_encryption_threads=1 there is no such issue.
Attachments
Issue Links
relates to
MDEV-14398When innodb_encryption_rotate_key_age=0 is set, server won't encrypt tablespaces
Reduce the number of calls to encryption_get_key_get_latest_version
when doing key rotation with two different methods:
(1) We need to fetch key information when tablespace not yet
have a encryption information, invalid keys are handled now
differently (see below). There was extra call to detect
if key_id is not found on key rotation.
(2) If key_id is not found from encryption plugin, do not
try fetching new key_version for it as it will fail anyway.
We store return value from encryption_get_key_get_latest_version
call and if it returns ENCRYPTION_KEY_VERSION_INVALID there
is no need to call it again.
Jan Lindström (Inactive)
added a comment - http://lists.askmonty.org/pipermail/commits/2016-December/010241.html
commit 2093b7dd9807506b6f83af0969b22f27ab6c034e
Author: Jan Lindström <jan.lindstrom@mariadb.com>
Date: Thu Dec 8 10:24:30 2016 +0200
MDEV-10368 : get_latest_version() called too often
Reduce the number of calls to encryption_get_key_get_latest_version
when doing key rotation with two different methods:
(1) We need to fetch key information when tablespace not yet
have a encryption information, invalid keys are handled now
differently (see below). There was extra call to detect
if key_id is not found on key rotation.
(2) If key_id is not found from encryption plugin, do not
try fetching new key_version for it as it will fail anyway.
We store return value from encryption_get_key_get_latest_version
call and if it returns ENCRYPTION_KEY_VERSION_INVALID there
is no need to call it again.
I did not do full refactoring as this is GA release and in my opinion we should avoid
large changes there.
Jan Lindström (Inactive)
added a comment - http://lists.askmonty.org/pipermail/commits/2016-December/010263.html
I did not do full refactoring as this is GA release and in my opinion we should avoid
large changes there.
Reduce the number of calls to encryption_get_key_get_latest_version
when doing key rotation with two different methods:
(1) We need to fetch key information when tablespace not yet
have a encryption information, invalid keys are handled now
differently (see below). There was extra call to detect
if key_id is not found on key rotation.
(2) If key_id is not found from encryption plugin, do not
try fetching new key_version for it as it will fail anyway.
We store return value from encryption_get_key_get_latest_version
call and if it returns ENCRYPTION_KEY_VERSION_INVALID there
is no need to call it again.
Jan Lindström (Inactive)
added a comment - commit 72cc73cea2e7071277b6a88bae0236cabf11788a
Author: Jan Lindström <jan.lindstrom@mariadb.com>
Date: Tue Dec 13 11:51:33 2016 +0200
MDEV-10368 : get_latest_version() called too often
Reduce the number of calls to encryption_get_key_get_latest_version
when doing key rotation with two different methods:
(1) We need to fetch key information when tablespace not yet
have a encryption information, invalid keys are handled now
differently (see below). There was extra call to detect
if key_id is not found on key rotation.
(2) If key_id is not found from encryption plugin, do not
try fetching new key_version for it as it will fail anyway.
We store return value from encryption_get_key_get_latest_version
call and if it returns ENCRYPTION_KEY_VERSION_INVALID there
is no need to call it again.
People
Jan Lindström (Inactive)
Claudio Nanni
Votes:
0Vote for this issue
Watchers:
9Start watching this issue
Dates
Created:
Updated:
Resolved:
Git Integration
Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.
{"report":{"fcp":1770.1000000238419,"ttfb":687.1000000238419,"pageVisibility":"visible","entityId":57398,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"77e35375-2cd1-432f-99a3-29cd0c17dfc8","navigationType":0,"readyForUser":1843.199999988079,"redirectCount":0,"resourceLoadedEnd":2228,"resourceLoadedStart":699.3999999761581,"resourceTiming":[{"duration":190.4000000357628,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":699.3999999761581,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":699.3999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":889.8000000119209,"responseStart":0,"secureConnectionStart":0},{"duration":334.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":699.6000000238419,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":699.6000000238419,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1034.1000000238419,"responseStart":0,"secureConnectionStart":0},{"duration":557.4000000357628,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":699.6999999880791,"connectEnd":699.6999999880791,"connectStart":699.6999999880791,"domainLookupEnd":699.6999999880791,"domainLookupStart":699.6999999880791,"fetchStart":699.6999999880791,"redirectEnd":0,"redirectStart":0,"requestStart":699.6999999880791,"responseEnd":1257.1000000238419,"responseStart":1257.1000000238419,"secureConnectionStart":699.6999999880791},{"duration":642.3000000119209,"initiatorType":"script","name":"https://jira.mariadb.org/s/099b33461394b8015fc36c0a4b96e19f-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":699.8999999761581,"connectEnd":699.8999999761581,"connectStart":699.8999999761581,"domainLookupEnd":699.8999999761581,"domainLookupStart":699.8999999761581,"fetchStart":699.8999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":699.8999999761581,"responseEnd":1342.199999988079,"responseStart":1342.199999988079,"secureConnectionStart":699.8999999761581},{"duration":646.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/94c15bff32baef80f4096a08aceae8bc-CDN/lu2bu7/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":700.1999999880791,"connectEnd":700.1999999880791,"connectStart":700.1999999880791,"domainLookupEnd":700.1999999880791,"domainLookupStart":700.1999999880791,"fetchStart":700.1999999880791,"redirectEnd":0,"redirectStart":0,"requestStart":700.1999999880791,"responseEnd":1346.699999988079,"responseStart":1346.699999988079,"secureConnectionStart":700.1999999880791},{"duration":647.1000000238419,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":700.3999999761581,"connectEnd":700.3999999761581,"connectStart":700.3999999761581,"domainLookupEnd":700.3999999761581,"domainLookupStart":700.3999999761581,"fetchStart":700.3999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":700.3999999761581,"responseEnd":1347.5,"responseStart":1347.5,"secureConnectionStart":700.3999999761581},{"duration":647.3999999761581,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":700.5,"connectEnd":700.5,"connectStart":700.5,"domainLookupEnd":700.5,"domainLookupStart":700.5,"fetchStart":700.5,"redirectEnd":0,"redirectStart":0,"requestStart":700.5,"responseEnd":1347.8999999761581,"responseStart":1347.8999999761581,"secureConnectionStart":700.5},{"duration":711.5999999642372,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bu7/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":700.6000000238419,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":700.6000000238419,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1412.199999988079,"responseStart":0,"secureConnectionStart":0},{"duration":647.5,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":700.8999999761581,"connectEnd":700.8999999761581,"connectStart":700.8999999761581,"domainLookupEnd":700.8999999761581,"domainLookupStart":700.8999999761581,"fetchStart":700.8999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":700.8999999761581,"responseEnd":1348.3999999761581,"responseStart":1348.3999999761581,"secureConnectionStart":700.8999999761581},{"duration":711.3000000119209,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bu7/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":701,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":701,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1412.300000011921,"responseStart":0,"secureConnectionStart":0},{"duration":647.6999999880791,"initiatorType":"script","name":"https://jira.mariadb.org/s/3339d87fa2538a859872f2df449bf8d0-CDN/lu2bu7/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":701.1999999880791,"connectEnd":701.1999999880791,"connectStart":701.1999999880791,"domainLookupEnd":701.1999999880791,"domainLookupStart":701.1999999880791,"fetchStart":701.1999999880791,"redirectEnd":0,"redirectStart":0,"requestStart":701.1999999880791,"responseEnd":1348.8999999761581,"responseStart":1348.8999999761581,"secureConnectionStart":701.1999999880791},{"duration":931.1999999880791,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":706.1000000238419,"connectEnd":706.1000000238419,"connectStart":706.1000000238419,"domainLookupEnd":706.1000000238419,"domainLookupStart":706.1000000238419,"fetchStart":706.1000000238419,"redirectEnd":0,"redirectStart":0,"requestStart":706.1000000238419,"responseEnd":1637.300000011921,"responseStart":1637.300000011921,"secureConnectionStart":706.1000000238419},{"duration":1513.699999988079,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":706.6000000238419,"connectEnd":706.6000000238419,"connectStart":706.6000000238419,"domainLookupEnd":706.6000000238419,"domainLookupStart":706.6000000238419,"fetchStart":706.6000000238419,"redirectEnd":0,"redirectStart":0,"requestStart":706.6000000238419,"responseEnd":2220.300000011921,"responseStart":2220.300000011921,"secureConnectionStart":706.6000000238419},{"duration":227.9000000357628,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1454.3999999761581,"connectEnd":1454.3999999761581,"connectStart":1454.3999999761581,"domainLookupEnd":1454.3999999761581,"domainLookupStart":1454.3999999761581,"fetchStart":1454.3999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":1454.3999999761581,"responseEnd":1682.300000011921,"responseStart":1682.300000011921,"secureConnectionStart":1454.3999999761581},{"duration":504.4000000357628,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2bu7/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/css/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":1716.8999999761581,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1716.8999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":2221.300000011921,"responseStart":0,"secureConnectionStart":0},{"duration":503.60000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-project.issue.navigator,-jira.view.issue,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":1718.199999988079,"connectEnd":1718.199999988079,"connectStart":1718.199999988079,"domainLookupEnd":1718.199999988079,"domainLookupStart":1718.199999988079,"fetchStart":1718.199999988079,"redirectEnd":0,"redirectStart":0,"requestStart":1718.199999988079,"responseEnd":2221.800000011921,"responseStart":2221.800000011921,"secureConnectionStart":1718.199999988079},{"duration":509.30000001192093,"initiatorType":"script","name":"https://jira.mariadb.org/s/f51ef5507eea4c158f257c66c93b2a3f-CDN/lu2bu7/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/js/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":1718.699999988079,"connectEnd":1718.699999988079,"connectStart":1718.699999988079,"domainLookupEnd":1718.699999988079,"domainLookupStart":1718.699999988079,"fetchStart":1718.699999988079,"redirectEnd":0,"redirectStart":0,"requestStart":1718.699999988079,"responseEnd":2228,"responseStart":2228,"secureConnectionStart":1718.699999988079},{"duration":497.7000000476837,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1761.3999999761581,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1761.3999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":2259.100000023842,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":529,"responseStart":687,"responseEnd":704,"domLoading":697,"domInteractive":2307,"domContentLoadedEventStart":2307,"domContentLoadedEventEnd":2367,"domComplete":2542,"loadEventStart":2542,"loadEventEnd":2543,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":2227.199999988079},{"name":"bigPipe.sidebar-id.end","time":2228.199999988079},{"name":"bigPipe.activity-panel-pipe-id.start","time":2228.300000011921},{"name":"bigPipe.activity-panel-pipe-id.end","time":2230.100000023842},{"name":"activityTabFullyLoaded","time":2393.300000011921}],"measures":[],"correlationId":"fe4c3977230704","effectiveType":"4g","downlink":9.4,"rtt":0,"serverDuration":102,"dbReadsTimeInMs":12,"dbConnsTimeInMs":20,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
http://lists.askmonty.org/pipermail/commits/2016-December/010241.html
commit 2093b7dd9807506b6f83af0969b22f27ab6c034e
Author: Jan Lindström <jan.lindstrom@mariadb.com>
Date: Thu Dec 8 10:24:30 2016 +0200
MDEV-10368: get_latest_version() called too oftenReduce the number of calls to encryption_get_key_get_latest_version
when doing key rotation with two different methods:
(1) We need to fetch key information when tablespace not yet
have a encryption information, invalid keys are handled now
differently (see below). There was extra call to detect
if key_id is not found on key rotation.
(2) If key_id is not found from encryption plugin, do not
try fetching new key_version for it as it will fail anyway.
We store return value from encryption_get_key_get_latest_version
call and if it returns ENCRYPTION_KEY_VERSION_INVALID there
is no need to call it again.