<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:23:57 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-30476] Use of exception thrown by ChunkManager::findIntersectingChunk() to determine single shard targeting</title>
                <link>https://jira.mongodb.org/browse/SERVER-30476</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;There are several places where we call ChunkManager::findIntersectingChunk() as a fast-path check to determine whether a single shard can be targeted for query. If it can&apos;t (one case being when shard key collation doesn&apos;t match the request) a uassert is triggered, which we then catch and ignore. &lt;/p&gt;

&lt;p&gt;We should refactor these call sites to not use exceptions as part of the non-error path.&lt;/p&gt;

&lt;p&gt;Here are a few examples. All callers of ChunkManager::findIntersectingChunk() and ChunkManager::findIntersectingChunkWithSimpleCollation() should be audited as part of this work.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/20c85d4848b4e4b3c88e1788eaff362143fffd20/src/mongo/s/chunk_manager.cpp#L126-L134&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/blob/20c85d4848b4e4b3c88e1788eaff362143fffd20/src/mongo/s/chunk_manager.cpp#L126-L134&lt;/a&gt;&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/blob/20c85d4848b4e4b3c88e1788eaff362143fffd20/src/mongo/s/commands/cluster_aggregate.cpp#L238-L243&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/blob/20c85d4848b4e4b3c88e1788eaff362143fffd20/src/mongo/s/commands/cluster_aggregate.cpp#L238-L243&lt;/a&gt;&lt;/p&gt;</description>
                <environment></environment>
        <key id="411576">SERVER-30476</key>
            <summary>Use of exception thrown by ChunkManager::findIntersectingChunk() to determine single shard targeting</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="10038" iconUrl="https://jira.mongodb.org/images/icons/subtask.gif" description="">Backlog</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="backlog-query-optimization">Backlog - Query Optimization</assignee>
                                    <reporter username="james.wahlin@mongodb.com">James Wahlin</reporter>
                        <labels>
                            <label>neweng</label>
                    </labels>
                <created>Wed, 2 Aug 2017 13:44:20 +0000</created>
                <updated>Tue, 6 Dec 2022 03:55:02 +0000</updated>
                                                                                                <votes>0</votes>
                                    <watches>7</watches>
                                                                                                                <comments>
                            <comment id="1641479" author="schwerin" created="Sun, 6 Aug 2017 21:31:08 +0000"  >&lt;p&gt;I don&apos;t think this should just be thought of as a performance problem. Swallowing exceptions without examining the code like that is risky at best. This implementation makes assumptions about all future implementations of findIntersectingChunk.&lt;/p&gt;</comment>
                            <comment id="1639755" author="kaloian.manassiev" created="Thu, 3 Aug 2017 14:47:40 +0000"  >&lt;p&gt;Yes, 2 is a true error case due to user error so leaving uassert there is acceptable. For  1, I am not clear on the details - but is that a common scenario? Isn&apos;t that already slower because we need to cast the collection of the request or do we just resort to broadcast in this case (which is also slow)?&lt;/p&gt;</comment>
                            <comment id="1638615" author="james.wahlin@10gen.com" created="Wed, 2 Aug 2017 14:07:04 +0000"  >&lt;p&gt;The callers I audited have confirmed that they have the shard key before calling. The cases where findIntersectingChunk() will uassert are:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;The request and the shard key collation do not match (a valid use case)&lt;/li&gt;
	&lt;li&gt;A chunk is not found in the chunk map that contains the shard key (which may be a true error case?)&lt;/li&gt;
&lt;/ol&gt;

</comment>
                            <comment id="1638606" author="kaloian.manassiev" created="Wed, 2 Aug 2017 13:51:14 +0000"  >&lt;p&gt;Is it the case that these methods expect the caller to have the shard key in the passed-in BSON or the check is more complex than that? If it is just a matter of checking for the presence of the shard key, we could prefix the hot paths with that.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>4.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25126"><![CDATA[Query Optimization]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Wed, 2 Aug 2017 13:51:14 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        6 years, 27 weeks, 3 days 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_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>false</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>alexander.golin@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            6 years, 27 weeks, 3 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>schwerin@mongodb.com</customfieldvalue>
            <customfieldvalue>backlog-query-optimization</customfieldvalue>
            <customfieldvalue>james.wahlin@mongodb.com</customfieldvalue>
            <customfieldvalue>kaloian.manassiev@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|htc65j:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr2fan:</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_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|htbs87:</customfieldvalue>

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