The following revision doesn't seem to be merged into 10.0. Found while analyzing result difference in ps_ddl1.test:
revno: 4591.1.70
|
committer: Guilhem Bichot <guilhem.bichot@oracle.com>
|
branch nick: 5.6-3
|
timestamp: Sat 2012-11-24 15:45:56 +0100
|
message:
|
fix for Bug#13996639 CRASH IN ITEM_REF::FIX_FIELDS ON EXEC OF STORED
|
FUNCTION WITH ONLY_FULL_GROUP_BY. See per-file comments.
|
|
mysql-test/r/ps_ddl1.result:
|
side affect of the bugfix; this is a good change, as the removed comment says.
|
sql/sql_lex.cc:
|
LEX starts clean
|
sql/sql_optimizer.cc:
|
If optimize () fails, tag the Lex as "broken"
|
sql/sql_parse.cc:
|
At first execution of:
|
SELECT stored_func()
|
this happens:
|
1) body of stored_func is read from mysql.proc
|
2) body is parsed (sp_compile()) (for each substatement a LEX and some
|
Items are created)
|
3) parsing went ok so parse trees are cached (sp_cache_insert())
|
4) substatement starts executing (SELECT with a NOT IN (subq))
|
4.1) Item_in_subselect::fix_fields():
|
if (!(res= engine->prepare()))
|
{
|
(*ref)= substitution;
|
engine->prepare() calls JOIN::prepare() on subq, which calls
|
resolve_subquery() which starts IN2EXISTS transformation: adds
|
conditions (using some new Item_ref) to the subquery's WHERE, creates
|
Item_in_optimizer and puts it in 'substitution'. After
|
resolve_subquery(), JOIN::prepare() of subq fails in:
|
|
my_message(ER_MIX_OF_GROUP_FUNC_AND_FIELDS,
|
ER(ER_MIX_OF_GROUP_FUNC_AND_FIELDS), MYF(0));
|
DBUG_RETURN(-1);
|
|
So far, so good.
|
Thus engine->prepare() fails. Thus we don't do:
|
(*ref)= substitution;
|
i.e. the parent of the subquery continues to have its WHERE point to
|
Item_in_subselect. At this stage we have a broken parse tree, because
|
subq has been transformed but parent query points to pre-transform
|
subq. This mess is not rolled back (IN2EXISTS is a complex transform
|
which does not use change_item_tree()).
|
ER_MIX_OF_GROUP_FUNC_AND_FIELDS is sent to client.
|
So far, so good.
|
|
At 2nd execution of:
|
SELECT stored_func()
|
this happens:
|
1) cached parse trees of stored_func is read from cache
|
2) but this is the broken parse tree!
|
3) as the Item_ref depends on Item_in_optimizer::fix_fields() to set
|
its '*ref', and as Item_in_optimizer was not stored in parent query,
|
Item_in_optimizer::fix_fields() is not called, so
|
Item_ref::fix_fields() crashes.
|
|
Summary: first execution broke Item_in_subselect/LEX, 2nd execution reused it.
|
|
Solution: first execution marks the fact that it
|
broke LEX; 2nd execution sees the mark and asks for a
|
reprepare, which creates new parse trees, and thus works as the first
|
execution.
|
A new member m_broken is added to class LEX. It is set to "true" when
|
JOIN:: prepare () or JOIN:: optimize () fail, because it is possible
|
that those functions were doing transformations. It is set to "false"
|
when the Lex is initialized.
|
sql/sql_resolver.cc:
|
If prepare () fails, tag the Lex as "broken"
|
- is part of
-
MDEV-4784
merge test cases from 5.6
-
-
Stalled
{"report":{"fcp":880.6000001430511,"ttfb":167.20000004768372,"pageVisibility":"visible","entityId":33604,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"9e828498-c041-4db1-a8e0-7b49e286ad6d","navigationType":0,"readyForUser":962.6000001430511,"redirectCount":0,"resourceLoadedEnd":814,"resourceLoadedStart":172.10000014305115,"resourceTiming":[{"duration":178.79999995231628,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":172.10000014305115,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":172.10000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":350.90000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":178.79999995231628,"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":172.20000004768372,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":172.20000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":351,"responseStart":0,"secureConnectionStart":0},{"duration":191.70000004768372,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":172.40000009536743,"connectEnd":172.40000009536743,"connectStart":172.40000009536743,"domainLookupEnd":172.40000009536743,"domainLookupStart":172.40000009536743,"fetchStart":172.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":172.40000009536743,"responseEnd":364.10000014305115,"responseStart":364.10000014305115,"secureConnectionStart":172.40000009536743},{"duration":342.7000000476837,"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":172.5,"connectEnd":172.5,"connectStart":172.5,"domainLookupEnd":172.5,"domainLookupStart":172.5,"fetchStart":172.5,"redirectEnd":0,"redirectStart":0,"requestStart":172.5,"responseEnd":515.2000000476837,"responseStart":515.2000000476837,"secureConnectionStart":172.5},{"duration":346.69999980926514,"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":172.60000014305115,"connectEnd":172.60000014305115,"connectStart":172.60000014305115,"domainLookupEnd":172.60000014305115,"domainLookupStart":172.60000014305115,"fetchStart":172.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":172.60000014305115,"responseEnd":519.2999999523163,"responseStart":519.2999999523163,"secureConnectionStart":172.60000014305115},{"duration":347.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":172.60000014305115,"connectEnd":172.60000014305115,"connectStart":172.60000014305115,"domainLookupEnd":172.60000014305115,"domainLookupStart":172.60000014305115,"fetchStart":172.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":172.60000014305115,"responseEnd":519.9000000953674,"responseStart":519.9000000953674,"secureConnectionStart":172.60000014305115},{"duration":348.10000014305115,"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":172.79999995231628,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":172.79999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":520.9000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":347.40000009536743,"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":172.79999995231628,"connectEnd":172.79999995231628,"connectStart":172.79999995231628,"domainLookupEnd":172.79999995231628,"domainLookupStart":172.79999995231628,"fetchStart":172.79999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":172.79999995231628,"responseEnd":520.2000000476837,"responseStart":520.2000000476837,"secureConnectionStart":172.79999995231628},{"duration":348,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":173,"connectEnd":173,"connectStart":173,"domainLookupEnd":173,"domainLookupStart":173,"fetchStart":173,"redirectEnd":0,"redirectStart":0,"requestStart":173,"responseEnd":521,"responseStart":521,"secureConnectionStart":173},{"duration":348.39999985694885,"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":173.10000014305115,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":173.10000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":521.5,"responseStart":0,"secureConnectionStart":0},{"duration":348.40000009536743,"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":173.20000004768372,"connectEnd":173.20000004768372,"connectStart":173.20000004768372,"domainLookupEnd":173.20000004768372,"domainLookupStart":173.20000004768372,"fetchStart":173.20000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":173.20000004768372,"responseEnd":521.6000001430511,"responseStart":521.6000001430511,"secureConnectionStart":173.20000004768372},{"duration":482.2999999523163,"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":178.60000014305115,"connectEnd":178.60000014305115,"connectStart":178.60000014305115,"domainLookupEnd":178.60000014305115,"domainLookupStart":178.60000014305115,"fetchStart":178.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":178.60000014305115,"responseEnd":660.9000000953674,"responseStart":660.9000000953674,"secureConnectionStart":178.60000014305115},{"duration":635.3999998569489,"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":178.60000014305115,"connectEnd":178.60000014305115,"connectStart":178.60000014305115,"domainLookupEnd":178.60000014305115,"domainLookupStart":178.60000014305115,"fetchStart":178.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":178.60000014305115,"responseEnd":814,"responseStart":814,"secureConnectionStart":178.60000014305115},{"duration":147,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":513.2999999523163,"connectEnd":513.2999999523163,"connectStart":513.2999999523163,"domainLookupEnd":513.2999999523163,"domainLookupStart":513.2999999523163,"fetchStart":513.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":513.2999999523163,"responseEnd":660.2999999523163,"responseStart":660.2999999523163,"secureConnectionStart":513.2999999523163},{"duration":233.19999980926514,"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":800.1000001430511,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":800.1000001430511,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1033.2999999523163,"responseStart":0,"secureConnectionStart":0},{"duration":232.79999995231628,"initiatorType":"link","name":"https://jira.mariadb.org/s/50bc9be5bfead1a25e72c1a9338c94f6-CDN/lu2bu7/820016/12ta74/e108c7645258ccb43280ed3404e3e949/_/download/contextbatch/css/com.atlassian.jira.plugins.jira-development-integration-plugin:0,-_super,-jira.view.issue,-jira.global,-jira.general,-jira.browse.project,-project.issue.navigator,-atl.general/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":800.6000001430511,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":800.6000001430511,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1033.4000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":274,"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":801.4000000953674,"connectEnd":801.4000000953674,"connectStart":801.4000000953674,"domainLookupEnd":801.4000000953674,"domainLookupStart":801.4000000953674,"fetchStart":801.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":801.4000000953674,"responseEnd":1075.4000000953674,"responseStart":1075.4000000953674,"secureConnectionStart":801.4000000953674}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":12,"responseStart":168,"responseEnd":174,"domLoading":171,"domInteractive":1018,"domContentLoadedEventStart":1018,"domContentLoadedEventEnd":1064,"domComplete":1253,"loadEventStart":1253,"loadEventEnd":1254,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1001.2000000476837},{"name":"bigPipe.sidebar-id.end","time":1002},{"name":"bigPipe.activity-panel-pipe-id.start","time":1002.1000001430511},{"name":"bigPipe.activity-panel-pipe-id.end","time":1002.9000000953674},{"name":"activityTabFullyLoaded","time":1080.7999999523163}],"measures":[],"correlationId":"7682070f2415ea","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":83,"dbReadsTimeInMs":11,"dbConnsTimeInMs":19,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
MariaDB doesn't seem to be vulnerable, I mean, there's no crash in this case.