If the InnoDB log sequence number is at least 4294967296, then Mariabackup --backup will fail to decrypt encrypted redo log blocks.
Furthermore, if the most significant 32-bit half of the LSN changes during the redo log scanning in crash recovery, MariaDB will fail to decrypt the redo log blocks. This can be repeated by porting the following 10.2 test to 10.1:
cp mysql-test/suite/mariabackup/{xb_file_key_management,huge_lsn}.opt
|
--- ../10.1/mysql-test/suite/mariabackup/huge_lsn.test 2018-01-05 16:56:51.798820291 +0200
|
+++ mysql-test/suite/mariabackup/huge_lsn.test 2017-10-10 09:07:34.950402715 +0300
|
@@ -16,7 +16,7 @@
|
my $ps= $ENV{INNODB_PAGE_SIZE};
|
my $page;
|
die "Unable to read $file" unless sysread(FILE, $page, $ps) == $ps;
|
-substr($page,26,8) = pack("NN", 4096, ~1024);
|
+substr($page,26,8) = pack("NN", 4096, 0);
|
substr($page,0,4)=pack("N",0xdeadbeef);
|
substr($page,$ps-8,4)=pack("N",0xdeadbeef);
|
sysseek(FILE, 0, 0) || die "Unable to rewind $file\n";
|
@@ -28,7 +28,7 @@
|
|
--source include/start_mysqld.inc
|
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
|
---let SEARCH_PATTERN= InnoDB: .*started; log sequence number 17596481010700
|
+--let SEARCH_PATTERN= InnoDB: 5\.7\.\d+ started; log sequence number 17592186044428
|
--source include/search_pattern_in_file.inc
|
|
CREATE TABLE t(i INT) ENGINE INNODB;
|
Without the following patch, mariabackup would fail even earlier:
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
|
index 437fc4aa7f9..9d8e8cd1061 100644
|
--- a/extra/mariabackup/xtrabackup.cc
|
+++ b/extra/mariabackup/xtrabackup.cc
|
@@ -4039,6 +4039,7 @@ xtrabackup_backup_func(void)
|
|
mutex_enter(&log_sys->mutex);
|
xtrabackup_choose_lsn_offset(checkpoint_lsn_start);
|
+ srv_start_lsn = checkpoint_lsn_start;
|
mutex_exit(&log_sys->mutex);
|
|
/* copy log file by current position */
|
It looks like we have to replace srv_start_lsn in log_blocks_crypt with a proper parameter, similar to how it is in the 10.2 function log_crypt().
Only in that way, we can keep the current semantics of the variable srv_start_lsn while being able to decrypt the entire redo log, even if the most significant 32 bits of the LSN change. The dependence on srv_start_lsn was there already in the initial implementation that appeared in MariaDB 10.1.3.
{"report":{"fcp":915.7000000476837,"ttfb":256.2000000476837,"pageVisibility":"visible","entityId":65129,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"e359d38e-00d5-4c55-81d0-ebd4bdf2447b","navigationType":0,"readyForUser":976.8000000715256,"redirectCount":0,"resourceLoadedEnd":1089.5,"resourceLoadedStart":262.7000000476837,"resourceTiming":[{"duration":237.79999995231628,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":262.7000000476837,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":262.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":500.5,"responseStart":0,"secureConnectionStart":0},{"duration":237.59999990463257,"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":262.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":262.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":500.5,"responseStart":0,"secureConnectionStart":0},{"duration":246.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":263,"connectEnd":263,"connectStart":263,"domainLookupEnd":263,"domainLookupStart":263,"fetchStart":263,"redirectEnd":0,"redirectStart":0,"requestStart":263,"responseEnd":509.5,"responseStart":509.5,"secureConnectionStart":263},{"duration":283.5,"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":263.10000002384186,"connectEnd":263.10000002384186,"connectStart":263.10000002384186,"domainLookupEnd":263.10000002384186,"domainLookupStart":263.10000002384186,"fetchStart":263.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":263.10000002384186,"responseEnd":546.6000000238419,"responseStart":546.6000000238419,"secureConnectionStart":263.10000002384186},{"duration":287,"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":263.3000000715256,"connectEnd":263.3000000715256,"connectStart":263.3000000715256,"domainLookupEnd":263.3000000715256,"domainLookupStart":263.3000000715256,"fetchStart":263.3000000715256,"redirectEnd":0,"redirectStart":0,"requestStart":263.3000000715256,"responseEnd":550.3000000715256,"responseStart":550.3000000715256,"secureConnectionStart":263.3000000715256},{"duration":288.2999999523163,"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":263.3000000715256,"connectEnd":263.3000000715256,"connectStart":263.3000000715256,"domainLookupEnd":263.3000000715256,"domainLookupStart":263.3000000715256,"fetchStart":263.3000000715256,"redirectEnd":0,"redirectStart":0,"requestStart":263.3000000715256,"responseEnd":551.6000000238419,"responseStart":551.6000000238419,"secureConnectionStart":263.3000000715256},{"duration":289.6999999284744,"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":263.40000009536743,"connectEnd":263.40000009536743,"connectStart":263.40000009536743,"domainLookupEnd":263.40000009536743,"domainLookupStart":263.40000009536743,"fetchStart":263.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":263.40000009536743,"responseEnd":553.1000000238419,"responseStart":553.1000000238419,"secureConnectionStart":263.40000009536743},{"duration":290.40000009536743,"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":263.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":263.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":553.9000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":290.3000000715256,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":263.60000002384186,"connectEnd":263.60000002384186,"connectStart":263.60000002384186,"domainLookupEnd":263.60000002384186,"domainLookupStart":263.60000002384186,"fetchStart":263.60000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":263.60000002384186,"responseEnd":553.9000000953674,"responseStart":553.9000000953674,"secureConnectionStart":263.60000002384186},{"duration":291.5,"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":263.7000000476837,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":263.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":555.2000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":291.39999997615814,"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":263.90000009536743,"connectEnd":263.90000009536743,"connectStart":263.90000009536743,"domainLookupEnd":263.90000009536743,"domainLookupStart":263.90000009536743,"fetchStart":263.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":263.90000009536743,"responseEnd":555.3000000715256,"responseStart":555.3000000715256,"secureConnectionStart":263.90000009536743},{"duration":717.7000000476837,"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":264.60000002384186,"connectEnd":264.60000002384186,"connectStart":264.60000002384186,"domainLookupEnd":264.60000002384186,"domainLookupStart":264.60000002384186,"fetchStart":264.60000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":264.60000002384186,"responseEnd":982.3000000715256,"responseStart":982.3000000715256,"secureConnectionStart":264.60000002384186},{"duration":824.7999999523163,"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":264.7000000476837,"connectEnd":264.7000000476837,"connectStart":264.7000000476837,"domainLookupEnd":264.7000000476837,"domainLookupStart":264.7000000476837,"fetchStart":264.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":264.7000000476837,"responseEnd":1089.5,"responseStart":1089.5,"secureConnectionStart":264.7000000476837},{"duration":365.09999990463257,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":722.9000000953674,"connectEnd":722.9000000953674,"connectStart":722.9000000953674,"domainLookupEnd":722.9000000953674,"domainLookupStart":722.9000000953674,"fetchStart":722.9000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":722.9000000953674,"responseEnd":1088,"responseStart":1088,"secureConnectionStart":722.9000000953674},{"duration":196.39999997615814,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":894.1000000238419,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":894.1000000238419,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1090.5,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":84,"responseStart":256,"responseEnd":258,"domLoading":260,"domInteractive":1127,"domContentLoadedEventStart":1127,"domContentLoadedEventEnd":1163,"domComplete":1999,"loadEventStart":1999,"loadEventEnd":2001,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1094.1000000238419},{"name":"bigPipe.sidebar-id.end","time":1094.8000000715256},{"name":"bigPipe.activity-panel-pipe-id.start","time":1094.9000000953674},{"name":"bigPipe.activity-panel-pipe-id.end","time":1097.2000000476837},{"name":"activityTabFullyLoaded","time":1169.4000000953674}],"measures":[],"correlationId":"ec09416b011c54","effectiveType":"4g","downlink":9,"rtt":0,"serverDuration":101,"dbReadsTimeInMs":14,"dbConnsTimeInMs":23,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}