<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 06:53:49 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[SERVER-84013] Incorrect results for index scan plan on query with duplicate predicates in nested $or</title>
                <link>https://jira.mongodb.org/browse/SERVER-84013</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description></description>
                <environment></environment>
        <key id="2520115">SERVER-84013</key>
            <summary>Incorrect results for index scan plan on query with duplicate predicates in nested $or</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="2" iconUrl="https://jira.mongodb.org/images/icons/priorities/critical.svg">Critical - P2</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="13201">Fixed</resolution>
                                        <assignee username="ben.shteinfeld@mongodb.com">Ben Shteinfeld</assignee>
                                    <reporter username="ben.shteinfeld@mongodb.com">Ben Shteinfeld</reporter>
                        <labels>
                            <label>7.0-release-blocker</label>
                    </labels>
                <created>Fri, 8 Dec 2023 16:13:43 +0000</created>
                <updated>Wed, 3 Jan 2024 20:17:56 +0000</updated>
                            <resolved>Thu, 14 Dec 2023 19:30:06 +0000</resolved>
                                    <version>7.0.3</version>
                    <version>6.0.12</version>
                    <version>5.0.23</version>
                    <version>7.0.4</version>
                                    <fixVersion>7.2.1</fixVersion>
                    <fixVersion>7.3.0-rc0</fixVersion>
                    <fixVersion>7.0.5</fixVersion>
                    <fixVersion>6.0.13</fixVersion>
                    <fixVersion>5.0.24</fixVersion>
                                                        <votes>0</votes>
                                    <watches>11</watches>
                                                                                                                <comments>
                            <comment id="5983977" author="xgen-internal-githook" created="Wed, 3 Jan 2024 20:06:37 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Ben Shteinfeld&apos;, &apos;email&apos;: &apos;ben.shteinfeld@mongodb.com&apos;, &apos;username&apos;: &apos;bshteinfeld&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-84013&quot; title=&quot;Incorrect results for index scan plan on query with duplicate predicates in nested $or&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-84013&quot;&gt;&lt;del&gt;SERVER-84013&lt;/del&gt;&lt;/a&gt; Avoid invoking MatchExpression::optimize() on children of&lt;br/&gt;
$or in the subplanner.&lt;/p&gt;

&lt;p&gt;The subplanner invokes the query planner for each branch of a rooted&lt;br/&gt;
$or. Doing this requires constructing a CanonicalQuery representing a&lt;br/&gt;
single branch of the $or. A side-effect of cosntructing a CanonicalQuery&lt;br/&gt;
is that the MatchExpression is optimized. The subplanner assumes that&lt;br/&gt;
both of these MatchExpressions are identical and makes decisions about&lt;br/&gt;
index bounds based on the order of predicates in the MatchExpression.&lt;br/&gt;
There are queries (as demostrated in the regression test this patch&lt;br/&gt;
introduces) for which this assumption is not true and leads to&lt;br/&gt;
incorrect index bounds and thus results.&lt;/p&gt;

&lt;p&gt;This patch fixes the bug by ensuring that the subplanner does not&lt;br/&gt;
invoke MatchExpression optimization a second time when constructing a&lt;br/&gt;
copy of the children of the $or.&lt;/p&gt;

&lt;p&gt;(cherry picked from commit ac1c1f25667e0845964b61cb6aadca648485d54c)&lt;br/&gt;
Branch: v7.2&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/420c9fe4741fd54e3d94d805bd65a39460b72d8b&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/420c9fe4741fd54e3d94d805bd65a39460b72d8b&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="5954740" author="xgen-internal-githook" created="Fri, 15 Dec 2023 22:17:21 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Ben Shteinfeld&apos;, &apos;email&apos;: &apos;ben.shteinfeld@mongodb.com&apos;, &apos;username&apos;: &apos;bshteinfeld&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-84013&quot; title=&quot;Incorrect results for index scan plan on query with duplicate predicates in nested $or&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-84013&quot;&gt;&lt;del&gt;SERVER-84013&lt;/del&gt;&lt;/a&gt; Avoid invoking MatchExpression::optimize() on children of&lt;br/&gt;
$or in the subplanner.&lt;/p&gt;

&lt;p&gt;The subplanner invokes the query planner for each branch of a rooted&lt;br/&gt;
$or. Doing this requires constructing a CanonicalQuery representing a&lt;br/&gt;
single branch of the $or. A side-effect of cosntructing a CanonicalQuery&lt;br/&gt;
is that the MatchExpression is optimized. The subplanner assumes that&lt;br/&gt;
both of these MatchExpressions are identical and makes decisions about&lt;br/&gt;
index bounds based on the order of predicates in the MatchExpression.&lt;br/&gt;
There are queries (as demostrated in the regression test this patch&lt;br/&gt;
introduces) for which this assumption is not true and leads to&lt;br/&gt;
incorrect index bounds and thus results.&lt;/p&gt;

&lt;p&gt;This patch fixes the bug by ensuring that the subplanner does not&lt;br/&gt;
invoke MatchExpression optimization a second time when constructing a&lt;br/&gt;
copy of the children of the $or.&lt;/p&gt;

&lt;p&gt;(cherry picked from commit 854ce65ffc67bbefdcfba7d7286a44e8ea5ad1a6)&lt;/p&gt;

&lt;p&gt;GitOrigin-RevId: 1126dea253e78bdd05bee2bc6c51604bf84c2578&lt;br/&gt;
Branch: v5.0&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/bb2eac7ea20d01158147a9187205b1482a8d07d2&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/bb2eac7ea20d01158147a9187205b1482a8d07d2&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="5954360" author="xgen-internal-githook" created="Fri, 15 Dec 2023 19:28:43 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Ben Shteinfeld&apos;, &apos;email&apos;: &apos;ben.shteinfeld@mongodb.com&apos;, &apos;username&apos;: &apos;bshteinfeld&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-84013&quot; title=&quot;Incorrect results for index scan plan on query with duplicate predicates in nested $or&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-84013&quot;&gt;&lt;del&gt;SERVER-84013&lt;/del&gt;&lt;/a&gt; Avoid invoking MatchExpression::optimize() on children of&lt;br/&gt;
$or in the subplanner.&lt;/p&gt;

&lt;p&gt;The subplanner invokes the query planner for each branch of a rooted&lt;br/&gt;
$or. Doing this requires constructing a CanonicalQuery representing a&lt;br/&gt;
single branch of the $or. A side-effect of cosntructing a CanonicalQuery&lt;br/&gt;
is that the MatchExpression is optimized. The subplanner assumes that&lt;br/&gt;
both of these MatchExpressions are identical and makes decisions about&lt;br/&gt;
index bounds based on the order of predicates in the MatchExpression.&lt;br/&gt;
There are queries (as demostrated in the regression test this patch&lt;br/&gt;
introduces) for which this assumption is not true and leads to&lt;br/&gt;
incorrect index bounds and thus results.&lt;/p&gt;

&lt;p&gt;This patch fixes the bug by ensuring that the subplanner does not&lt;br/&gt;
invoke MatchExpression optimization a second time when constructing a&lt;br/&gt;
copy of the children of the $or.&lt;/p&gt;

&lt;p&gt;GitOrigin-RevId: 854ce65ffc67bbefdcfba7d7286a44e8ea5ad1a6&lt;br/&gt;
Branch: v6.0&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/dcd8c73a04409a8ac680d59697922818b6a70f7c&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/dcd8c73a04409a8ac680d59697922818b6a70f7c&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="5952598" author="xgen-internal-githook" created="Fri, 15 Dec 2023 00:08:27 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Ben Shteinfeld&apos;, &apos;email&apos;: &apos;ben.shteinfeld@mongodb.com&apos;, &apos;username&apos;: &apos;bshteinfeld&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-84013&quot; title=&quot;Incorrect results for index scan plan on query with duplicate predicates in nested $or&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-84013&quot;&gt;&lt;del&gt;SERVER-84013&lt;/del&gt;&lt;/a&gt; Avoid invoking MatchExpression::optimize() on children of&lt;br/&gt;
$or in the subplanner.&lt;/p&gt;

&lt;p&gt;The subplanner invokes the query planner for each branch of a rooted&lt;br/&gt;
$or. Doing this requires constructing a CanonicalQuery representing a&lt;br/&gt;
single branch of the $or. A side-effect of cosntructing a CanonicalQuery&lt;br/&gt;
is that the MatchExpression is optimized. The subplanner assumes that&lt;br/&gt;
both of these MatchExpressions are identical and makes decisions about&lt;br/&gt;
index bounds based on the order of predicates in the MatchExpression.&lt;br/&gt;
There are queries (as demostrated in the regression test this patch&lt;br/&gt;
introduces) for which this assumption is not true and leads to&lt;br/&gt;
incorrect index bounds and thus results.&lt;/p&gt;

&lt;p&gt;This patch fixes the bug by ensuring that the subplanner does not&lt;br/&gt;
invoke MatchExpression optimization a second time when constructing a&lt;br/&gt;
copy of the children of the $or.&lt;/p&gt;

&lt;p&gt;GitOrigin-RevId: 1396b42063d30feff79e1adf4a9774f9601383b6&lt;br/&gt;
Branch: v7.0&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/82e5630496d8cc1fba7705111f1dc68e6aede247&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/82e5630496d8cc1fba7705111f1dc68e6aede247&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="5951337" author="xgen-internal-githook" created="Thu, 14 Dec 2023 16:17:19 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Ben Shteinfeld&apos;, &apos;email&apos;: &apos;ben.shteinfeld@mongodb.com&apos;, &apos;username&apos;: &apos;bshteinfeld&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-84013&quot; title=&quot;Incorrect results for index scan plan on query with duplicate predicates in nested $or&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-84013&quot;&gt;&lt;del&gt;SERVER-84013&lt;/del&gt;&lt;/a&gt; Avoid invoking MatchExpression::optimize() on children of&lt;br/&gt;
$or in the subplanner.&lt;/p&gt;

&lt;p&gt;The subplanner invokes the query planner for each branch of a rooted&lt;br/&gt;
$or. Doing this requires constructing a CanonicalQuery representing a&lt;br/&gt;
single branch of the $or. A side-effect of cosntructing a CanonicalQuery&lt;br/&gt;
is that the MatchExpression is optimized. The subplanner assumes that&lt;br/&gt;
both of these MatchExpressions are identical and makes decisions about&lt;br/&gt;
index bounds based on the order of predicates in the MatchExpression.&lt;br/&gt;
There are queries (as demostrated in the regression test this patch&lt;br/&gt;
introduces) for which this assumption is not true and leads to&lt;br/&gt;
incorrect index bounds and thus results.&lt;/p&gt;

&lt;p&gt;This patch fixes the bug by ensuring that the subplanner does not&lt;br/&gt;
invoke MatchExpression optimization a second time when constructing a&lt;br/&gt;
copy of the children of the $or.&lt;/p&gt;

&lt;p&gt;GitOrigin-RevId: ac1c1f25667e0845964b61cb6aadca648485d54c&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/e85ad8897c810bd5bda16ebc94c2318a16563da5&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/e85ad8897c810bd5bda16ebc94c2318a16563da5&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10420">
                    <name>Backports</name>
                                            <outwardlinks description="backported by">
                                                        </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="2509934">SERVER-83602</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>5.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_12450" key="com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes">
                        <customfieldname>Backport Requested</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="26553"><![CDATA[v7.2]]></customfieldvalue>
    <customfieldvalue key="25578"><![CDATA[v7.0]]></customfieldvalue>
    <customfieldvalue key="23470"><![CDATA[v6.0]]></customfieldvalue>
    <customfieldvalue key="21777"><![CDATA[v5.0]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10038"><![CDATA[Fully Compatible]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 8 Dec 2023 20:35:16 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        5 weeks ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></customfieldvalue>


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_17050" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Downstream Team Attention</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="16941"><![CDATA[Not Needed]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>dbeng-pm-bot</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            5 weeks ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_10032" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Operating System</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10026"><![CDATA[ALL]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>ben.shteinfeld@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i33uef:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|i2lm70:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_23361" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Requested By</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                            <customfield id="customfield_22250" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Special Downgrade Instructions Required</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="23343"><![CDATA[Not Needed]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="7262">QO 2023-12-11</customfieldvalue>
    <customfieldvalue id="7263">QO 2023-12-25</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_22870" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Triagers</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i33gjr:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                    </customfields>
    </item>
</channel>
</rss>