Type:
Bug
Priority:
Critical
Resolution:
Fixed
Affects Version/s:
10.4(EOL) , 10.5 , 10.6 , 10.11 , 11.0(EOL) , 11.1(EOL) , 11.2(EOL) , 11.3(EOL) , 11.4
I only tested this on 10.11. The bug could also be in earlier versions.
Applying this diff:
diff --git a/storage/spider/mysql-test/spider/bg/t/basic_sql.test b/storage/spider/mysql-test/spider/bg/t/basic_sql.test
index 9cf4ce99dc3..6a35fe8dd70 100644
--- a/storage/spider/mysql-test/spider/bg/t/basic_sql.test
+++ b/storage/spider/mysql-test/spider/bg/t/basic_sql.test
@@ -156,6 +156,7 @@ if ($USE_CHILD_GROUP2)
}
}
--connection master_1
+set @@optimizer_switch="semijoin=off";
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
--echo
Causes the following result change:
mtr spider/bg.basic_sql
+++ /home/my/maria-10.11/storage/spider/mysql-test/spider/bg/r/basic_sql.reject2023-01-13 20:10:47.205034143 +0200
@@ -49,6 +49,7 @@
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
SELECT a, b, c FROM tb_l
connection master_1;
+set @@optimizer_switch="semijoin=off";
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
a b date_format(c, '%Y-%m-%d %H:%i:%s')
1 a 2008-08-01 10:21:39
@@ -279,11 +280,6 @@
SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM tb_l a WHERE
EXISTS (SELECT * FROM ta_l b WHERE b.b = a.b) ORDER BY a.a;
a b date_format(a.c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
select using pushdown
{"report":{"fcp":6292.699999809265,"ttfb":213.19999980926514,"pageVisibility":"visible","entityId":118257,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0,"journeyId":"06829499-9807-4dfd-9b6c-3336a1f8c462","navigationType":0,"readyForUser":5846.799999713898,"redirectCount":0,"resourceLoadedEnd":5107.900000095367,"resourceLoadedStart":594.7999997138977,"resourceTiming":[{"duration":538.4000000953674,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":594.7999997138977,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":594.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1133.1999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":538.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":595.0999999046326,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":595.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1133.5999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":3515,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":595.2999997138977,"connectEnd":1124,"connectStart":1124,"domainLookupEnd":1124,"domainLookupStart":1124,"fetchStart":595.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":1127.1999998092651,"responseEnd":4110.299999713898,"responseStart":1300.7999997138977,"secureConnectionStart":1124},{"duration":4512.400000095367,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":595.5,"connectEnd":595.5,"connectStart":595.5,"domainLookupEnd":595.5,"domainLookupStart":595.5,"fetchStart":595.5,"redirectEnd":0,"redirectStart":0,"requestStart":1127.4000000953674,"responseEnd":5107.900000095367,"responseStart":1301.5,"secureConnectionStart":595.5},{"duration":719.0999999046326,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":595.6999998092651,"connectEnd":595.6999998092651,"connectStart":595.6999998092651,"domainLookupEnd":595.6999998092651,"domainLookupStart":595.6999998092651,"fetchStart":595.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":1127.5,"responseEnd":1314.7999997138977,"responseStart":1300,"secureConnectionStart":595.6999998092651},{"duration":941.3999996185303,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":595.9000000953674,"connectEnd":595.9000000953674,"connectStart":595.9000000953674,"domainLookupEnd":595.9000000953674,"domainLookupStart":595.9000000953674,"fetchStart":595.9000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":1127.6999998092651,"responseEnd":1537.2999997138977,"responseStart":1531.6999998092651,"secureConnectionStart":595.9000000953674},{"duration":718,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":596.1999998092651,"connectEnd":596.1999998092651,"connectStart":596.1999998092651,"domainLookupEnd":596.1999998092651,"domainLookupStart":596.1999998092651,"fetchStart":596.1999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":1127.7999997138977,"responseEnd":1314.1999998092651,"responseStart":1299.1999998092651,"secureConnectionStart":596.1999998092651},{"duration":537.1999998092651,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":596.4000000953674,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":596.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1133.5999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":940.4000000953674,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":596.5,"connectEnd":596.5,"connectStart":596.5,"domainLookupEnd":596.5,"domainLookupStart":596.5,"fetchStart":596.5,"redirectEnd":0,"redirectStart":0,"requestStart":1127.9000000953674,"responseEnd":1536.9000000953674,"responseStart":1468.4000000953674,"secureConnectionStart":596.5},{"duration":537,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/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":596.6999998092651,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":596.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1133.6999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":940.7999997138977,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/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":596.9000000953674,"connectEnd":596.9000000953674,"connectStart":596.9000000953674,"domainLookupEnd":596.9000000953674,"domainLookupStart":596.9000000953674,"fetchStart":596.9000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":1127.9000000953674,"responseEnd":1537.6999998092651,"responseStart":1316.1999998092651,"secureConnectionStart":596.9000000953674},{"duration":4407.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":597.6999998092651,"connectEnd":597.6999998092651,"connectStart":597.6999998092651,"domainLookupEnd":597.6999998092651,"domainLookupStart":597.6999998092651,"fetchStart":597.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":1534.2999997138977,"responseEnd":5005.199999809265,"responseStart":4737.199999809265,"secureConnectionStart":597.6999998092651},{"duration":4234.199999809265,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":771.4000000953674,"connectEnd":771.4000000953674,"connectStart":771.4000000953674,"domainLookupEnd":771.4000000953674,"domainLookupStart":771.4000000953674,"fetchStart":771.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":1770.7999997138977,"responseEnd":5005.599999904633,"responseStart":4738.099999904633,"secureConnectionStart":771.4000000953674},{"duration":770.9000000953674,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":4378.299999713898,"connectEnd":4378.299999713898,"connectStart":4378.299999713898,"domainLookupEnd":4378.299999713898,"domainLookupStart":4378.299999713898,"fetchStart":4378.299999713898,"redirectEnd":0,"redirectStart":0,"requestStart":5004.199999809265,"responseEnd":5149.199999809265,"responseStart":5143.599999904633,"secureConnectionStart":4378.299999713898}],"fetchStart":1,"domainLookupStart":1,"domainLookupEnd":1,"connectStart":1,"connectEnd":1,"requestStart":53,"responseStart":214,"responseEnd":937,"domLoading":341,"domInteractive":5917,"domContentLoadedEventStart":5917,"domContentLoadedEventEnd":5965,"domComplete":6911,"loadEventStart":6911,"loadEventEnd":6913,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":5895.400000095367},{"name":"bigPipe.sidebar-id.end","time":5896.400000095367},{"name":"bigPipe.activity-panel-pipe-id.start","time":5896.599999904633},{"name":"bigPipe.activity-panel-pipe-id.end","time":5898.199999809265},{"name":"activityTabFullyLoaded","time":5977}],"measures":[],"correlationId":"dd76fe60c46d79","effectiveType":"4g","downlink":9.9,"rtt":0,"serverDuration":89,"dbReadsTimeInMs":9,"dbConnsTimeInMs":17,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Somehow with the semijoin=off optimizer switch, it uses the group by
handler (gbh) for the EXISTS subquery. Because such subqueries set
explicit_limit to true (see
Item_exists_subselect::fix_length_and_dec()), the gbh uses the default
limit value 0, which causes the subquery to return empty results.
Either we make gbh use the correct limit 1 in this case, or ban gbh
from being used. The latter requires checking why the optimizer switch
causes gbh to be used for the subquery.