I believe that Mrr_ordered_index_reader::resume_read() is using saved_primary_key uninitialized if the current read hasn't been interrupted. This manifests itself in our case with the following case:
SET SESSION
|
optimizer_switch="mrr=on,mrr_sort_keys=on",
|
join_cache_level=8;
|
|
SELECT DISTINCT a.x FROM a LEFT JOIN b ON (a.x = b.x) WHERE ...
|
Our query produces an EXPLAIN containing:
"Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan"
|
With the result of the query we get many warnings like:
"Warning 1366 Incorrect string value: '\xE6S\x01\x00\x00\x00...' for column 'y' at row 93"
|
This is because the buffer being purported to be column 'y' is uninitialized or random data, and doesn't pass as valid UTF-8.
Unfortunately I don't have a minimal test case for this yet, but I am able to reproduce it with sensitive data locally and can prove that the below patch fixes the symptom.
Patch follows:
--- sql/multi_range_read.cc 2014-07-10 23:01:30.000000000 -0700
|
+++ sql/multi_range_read.cc 2014-10-15 19:34:56.000000000 -0700
|
@@ -467,6 +467,9 @@ void Mrr_ordered_index_reader::position(
|
|
void Mrr_ordered_index_reader::resume_read()
|
{
|
+ if (have_saved_rowid == FALSE)
|
+ return;
|
+
|
TABLE *table= file->get_table();
|
KEY *used_index= &table->key_info[file->active_index];
|
key_restore(table->record[0], saved_key_tuple,
|
@@ -477,6 +480,8 @@ void Mrr_ordered_index_reader::resume_re
|
&table->key_info[table->s->primary_key],
|
table->key_info[table->s->primary_key].key_length);
|
}
|
+
|
+ have_saved_rowid= FALSE;
|
}
|
{"report":{"fcp":680.2999999523163,"ttfb":137.19999992847443,"pageVisibility":"visible","entityId":46215,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"0ff9fa22-2841-4178-914d-1c1558777904","navigationType":0,"readyForUser":811.1000000238419,"redirectCount":0,"resourceLoadedEnd":726.1999999284744,"resourceLoadedStart":141.79999995231628,"resourceTiming":[{"duration":116.60000002384186,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":141.79999995231628,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":141.79999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":258.39999997615814,"responseStart":0,"secureConnectionStart":0},{"duration":116.60000002384186,"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":142,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":142,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":258.60000002384186,"responseStart":0,"secureConnectionStart":0},{"duration":136,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":142.10000002384186,"connectEnd":142.10000002384186,"connectStart":142.10000002384186,"domainLookupEnd":142.10000002384186,"domainLookupStart":142.10000002384186,"fetchStart":142.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":142.10000002384186,"responseEnd":278.10000002384186,"responseStart":278.10000002384186,"secureConnectionStart":142.10000002384186},{"duration":221.39999997615814,"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":142.29999995231628,"connectEnd":142.29999995231628,"connectStart":142.29999995231628,"domainLookupEnd":142.29999995231628,"domainLookupStart":142.29999995231628,"fetchStart":142.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":142.29999995231628,"responseEnd":363.6999999284744,"responseStart":363.60000002384186,"secureConnectionStart":142.29999995231628},{"duration":217.70000004768372,"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":142.29999995231628,"connectEnd":142.29999995231628,"connectStart":142.29999995231628,"domainLookupEnd":142.29999995231628,"domainLookupStart":142.29999995231628,"fetchStart":142.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":142.29999995231628,"responseEnd":360,"responseStart":360,"secureConnectionStart":142.29999995231628},{"duration":221.70000004768372,"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":142.39999997615814,"connectEnd":142.39999997615814,"connectStart":142.39999997615814,"domainLookupEnd":142.39999997615814,"domainLookupStart":142.39999997615814,"fetchStart":142.39999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":142.39999997615814,"responseEnd":364.10000002384186,"responseStart":364.10000002384186,"secureConnectionStart":142.39999997615814},{"duration":222.29999995231628,"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":142.5,"connectEnd":142.5,"connectStart":142.5,"domainLookupEnd":142.5,"domainLookupStart":142.5,"fetchStart":142.5,"redirectEnd":0,"redirectStart":0,"requestStart":142.5,"responseEnd":364.7999999523163,"responseStart":364.7999999523163,"secureConnectionStart":142.5},{"duration":218.5,"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":147,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":147,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":365.5,"responseStart":0,"secureConnectionStart":0},{"duration":218.10000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":147.19999992847443,"connectEnd":147.19999992847443,"connectStart":147.19999992847443,"domainLookupEnd":147.19999992847443,"domainLookupStart":147.19999992847443,"fetchStart":147.19999992847443,"redirectEnd":0,"redirectStart":0,"requestStart":147.19999992847443,"responseEnd":365.2999999523163,"responseStart":365.2999999523163,"secureConnectionStart":147.19999992847443},{"duration":218.39999997615814,"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":147.29999995231628,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":147.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":365.6999999284744,"responseStart":0,"secureConnectionStart":0},{"duration":218.5,"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":147.39999997615814,"connectEnd":147.39999997615814,"connectStart":147.39999997615814,"domainLookupEnd":147.39999997615814,"domainLookupStart":147.39999997615814,"fetchStart":147.39999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":147.39999997615814,"responseEnd":365.89999997615814,"responseStart":365.89999997615814,"secureConnectionStart":147.39999997615814},{"duration":423.89999997615814,"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":152.29999995231628,"connectEnd":152.29999995231628,"connectStart":152.29999995231628,"domainLookupEnd":152.29999995231628,"domainLookupStart":152.29999995231628,"fetchStart":152.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":152.29999995231628,"responseEnd":576.1999999284744,"responseStart":576.1999999284744,"secureConnectionStart":152.29999995231628},{"duration":573.0999999046326,"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":153.10000002384186,"connectEnd":153.10000002384186,"connectStart":153.10000002384186,"domainLookupEnd":153.10000002384186,"domainLookupStart":153.10000002384186,"fetchStart":153.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":153.10000002384186,"responseEnd":726.1999999284744,"responseStart":726.1999999284744,"secureConnectionStart":153.10000002384186},{"duration":144.10000002384186,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":495.39999997615814,"connectEnd":495.39999997615814,"connectStart":495.39999997615814,"domainLookupEnd":495.39999997615814,"domainLookupStart":495.39999997615814,"fetchStart":495.39999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":495.39999997615814,"responseEnd":639.5,"responseStart":639.5,"secureConnectionStart":495.39999997615814},{"duration":112.80000007152557,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":673.2999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":673.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":786.1000000238419,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":6,"responseStart":137,"responseEnd":153,"domLoading":140,"domInteractive":865,"domContentLoadedEventStart":865,"domContentLoadedEventEnd":904,"domComplete":1834,"loadEventStart":1834,"loadEventEnd":1835,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":847.6000000238419},{"name":"bigPipe.sidebar-id.end","time":848.3999999761581},{"name":"bigPipe.activity-panel-pipe-id.start","time":848.5},{"name":"bigPipe.activity-panel-pipe-id.end","time":851},{"name":"activityTabFullyLoaded","time":910.3999999761581}],"measures":[],"correlationId":"63e66c5415a578","effectiveType":"4g","downlink":9.4,"rtt":0,"serverDuration":73,"dbReadsTimeInMs":8,"dbConnsTimeInMs":14,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}