<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:33:58 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-14138] mongos incorrectly targets multiple shards for nested field shard key predicates</title>
                <link>https://jira.mongodb.org/browse/SERVER-14138</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;div class=&quot;panel&quot; style=&quot;background-color: #EEEEEE;border-color: #ccc;border-width: 1px;&quot;&gt;&lt;div class=&quot;panelHeader&quot; style=&quot;border-bottom-width: 1px;border-bottom-color: #ccc;background-color: #6CB33F;&quot;&gt;&lt;b&gt;Issue Status as of Jun 09, 2014&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;panelContent&quot; style=&quot;background-color: #EEEEEE;&quot;&gt;
&lt;p&gt;&lt;b&gt;ISSUE SUMMARY&lt;/b&gt;&lt;br/&gt;
On sharded collections using nested shard keys, some targeted operations fail to target the right shard and are broadcast instead. This issue only affects collections which are sharded over a nested shard key field (e.g. &lt;tt&gt;&apos;a.b&apos;&lt;/tt&gt;) where the predicates are specified in object notation (e.g. {&lt;tt&gt;a: {b: 1&lt;/tt&gt;}}) instead of dot notation (e.g. {&lt;tt&gt;&quot;a.b&quot;: 1&lt;/tt&gt;}), and only on limited updates/deletes &amp;#8211; i.e. single deletes, non-multi updates, and upserts.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;USER IMPACT&lt;/b&gt;&lt;br/&gt;
For upserts, orphaned documents may be created on all shards of a collection; these orphaned documents may cause write errors if using uniquely indexed fields (i.e. &lt;tt&gt;_id&lt;/tt&gt;) in the query. Upserts not containing uniquely indexed fields can result in growing numbers of orphaned documents.&lt;/p&gt;

&lt;p&gt;For single/non-multi deletes and updates there may be a performance impact, and updates to orphaned documents may be unexpectedly reported, resulting in incorrect write statistics. Also, there may be rare cases where the update applies an incorrect number of times despite being limited &amp;#8211; disable balancing on affected collections as a workaround for this specific case.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;WORKAROUNDS&lt;/b&gt;&lt;br/&gt;
Change the nested shard key to use dot notation (see example above). &lt;/p&gt;

&lt;p&gt;&lt;b&gt;AFFECTED VERSIONS&lt;/b&gt;&lt;br/&gt;
MongoDB 2.6.0 and 2.6.1 are affected by this issue.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;FIX VERSION&lt;/b&gt;&lt;br/&gt;
The fix is included in the 2.6.2 production release.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;RESOLUTION DETAILS&lt;/b&gt;&lt;br/&gt;
Explicitly look up the documents to update/delete in the ChunkManager.&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;h6&gt;&lt;a name=&quot;Originaldescription&quot;&gt;&lt;/a&gt;Original description&lt;/h6&gt;

&lt;p&gt;In a sharded collection, upserts resulting from a save() have different behaviors depending on the shape of the shard key. When the shard key is a simple key or a compound key composed of top-level fields, behavior is consistent with 2.4.10, i.e. upserts are targeted. However, with a compound shard key composed of fields from an embedded document, the upserts are broadcast to all shards. &lt;/p&gt;

&lt;p&gt;In the insert case of upsert, the broadcast upsert inserts a document on all shards. In the update case of upsert, the broadcast upsert updates the document on the chunk-owning shard and generates a duplicate key error on all remaining shards.&lt;/p&gt;

&lt;p&gt;Chunks must be distributed across multiple shards to observe the effect.&lt;/p&gt;</description>
                <environment></environment>
        <key id="139676">SERVER-14138</key>
            <summary>mongos incorrectly targets multiple shards for nested field shard key predicates</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="9">Done</resolution>
                                        <assignee username="greg_10gen">Greg Studer</assignee>
                                    <reporter username="norman.graham@mongodb.com">Norman Graham</reporter>
                        <labels>
                    </labels>
                <created>Tue, 3 Jun 2014 01:41:22 +0000</created>
                <updated>Wed, 11 Mar 2015 16:52:38 +0000</updated>
                            <resolved>Thu, 5 Jun 2014 23:44:50 +0000</resolved>
                                    <version>2.6.1</version>
                                    <fixVersion>2.6.2</fixVersion>
                    <fixVersion>2.7.2</fixVersion>
                                    <component>Sharding</component>
                                        <votes>0</votes>
                                    <watches>10</watches>
                                                                                                                <comments>
                            <comment id="620402" author="dan@10gen.com" created="Fri, 13 Jun 2014 17:00:43 +0000"  >&lt;p&gt;2.6.2 is currently planned for general availability on Monday.&lt;/p&gt;</comment>
                            <comment id="618766" author="torbochkinl@upmc.edu" created="Thu, 12 Jun 2014 15:38:18 +0000"  >&lt;p&gt;Thanks for the update Greg! I was wondering how long the testing usually takes? Trying to determine if we can expect the RHEL RPM today/tomorrow or Monday?&lt;/p&gt;</comment>
                            <comment id="617492" author="greg_10gen" created="Wed, 11 Jun 2014 19:08:26 +0000"  >&lt;p&gt;Yep, we&apos;re currently re-testing the -rc1 build. Assuming there are no issues found which require another rc, we will release after the testing completes.&lt;/p&gt;</comment>
                            <comment id="617003" author="torbochkinl@upmc.edu" created="Wed, 11 Jun 2014 14:18:30 +0000"  >&lt;p&gt;Thanks for looking into this!&lt;/p&gt;

&lt;p&gt;I saw the 2.6.2 release was slated to release yesterday and there was a release candidate available. We are specifically looking to use the RHEL RPM and were looking for the  2.6.2 version here:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/RPMS/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/RPMS/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Are you expecting the official release 2.6.2 shortly?&lt;/p&gt;

&lt;p&gt;Thanks!&lt;/p&gt;
</comment>
                            <comment id="611381" author="xgen-internal-githook" created="Fri, 6 Jun 2014 15:48:21 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;gregstuder&apos;, u&apos;name&apos;: u&apos;Greg Studer&apos;, u&apos;email&apos;: u&apos;greg@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-14138&quot; title=&quot;mongos incorrectly targets multiple shards for nested field shard key predicates&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-14138&quot;&gt;&lt;del&gt;SERVER-14138&lt;/del&gt;&lt;/a&gt; fix shard key targeting tests backported from v2.7&lt;br/&gt;
Branch: v2.6&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/90d6761433af542814185a8ec45a11208df9fe6f&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/90d6761433af542814185a8ec45a11208df9fe6f&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="610507" author="xgen-internal-githook" created="Thu, 5 Jun 2014 23:43:33 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;gregstuder&apos;, u&apos;name&apos;: u&apos;Greg Studer&apos;, u&apos;email&apos;: u&apos;greg@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-14138&quot; title=&quot;mongos incorrectly targets multiple shards for nested field shard key predicates&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-14138&quot;&gt;&lt;del&gt;SERVER-14138&lt;/del&gt;&lt;/a&gt; mongos incorrectly targets multiple shards for nested field shard keys&lt;br/&gt;
(cherry picked from commit 777de742ee578b62b12ded8381aadf98dfa9fa5f)&lt;/p&gt;

&lt;p&gt;Conflicts:&lt;br/&gt;
	jstests/sharding/hash_regex_targetting.js&lt;br/&gt;
Branch: v2.6&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/03c83b974897ce58d7cd6f69e27cae7bc1433e2f&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/03c83b974897ce58d7cd6f69e27cae7bc1433e2f&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="610347" author="xgen-internal-githook" created="Thu, 5 Jun 2014 21:47:32 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;gregstuder&apos;, u&apos;name&apos;: u&apos;Greg Studer&apos;, u&apos;email&apos;: u&apos;greg@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-14138&quot; title=&quot;mongos incorrectly targets multiple shards for nested field shard key predicates&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-14138&quot;&gt;&lt;del&gt;SERVER-14138&lt;/del&gt;&lt;/a&gt; mongos incorrectly targets multiple shards for nested field shard keys&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/777de742ee578b62b12ded8381aadf98dfa9fa5f&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/777de742ee578b62b12ded8381aadf98dfa9fa5f&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                            <outwardlinks description="depends on">
                                                        </outwardlinks>
                                                                <inwardlinks description="is depended on by">
                                                        </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                                        </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="139998">SERVER-14161</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="44572" name="upsertTest.js" size="1704" author="norman.graham@mongodb.com" created="Tue, 3 Jun 2014 01:41:22 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>7.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_12451" key="com.atlassian.jira.plugin.system.customfieldtypes:multiversion">
                        <customfieldname>Backport Completed</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="13820">2.6.2</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>Tue, 3 Jun 2014 16:22:26 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        9 years, 35 weeks, 5 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[<s><a href='https://jira.mongodb.org/browse/WRITING-809'>WRITING-809</a></s>]]></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>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>ramon.fernandez@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            9 years, 35 weeks, 5 days 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>dan@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>greg_10gen</customfieldvalue>
            <customfieldvalue>torbochkinl@upmc.edu</customfieldvalue>
            <customfieldvalue>norman.graham@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrltwv:</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>120441</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_10750" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Steps To Reproduce</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>&lt;p&gt;Create a 4 shard cluster with shards named &quot;a&quot;, &quot;b&quot;, &quot;c&quot;, and &quot;d&quot;. Then run the attached javascript functions.&lt;/p&gt;</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_10166" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Tests Written</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10154"><![CDATA[Complete]]></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_11861" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>User Summary</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="11858"><![CDATA[Completed]]></customfieldvalue>

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

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