<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:38:25 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-34971] Improve mongoS targeting of replacement-style updates for collections whose shard key includes _id</title>
                <link>https://jira.mongodb.org/browse/SERVER-34971</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Replacement-style updates on a sharded cluster are targeted by &lt;tt&gt;mongoS&lt;/tt&gt; on the basis of the replacement document&apos;s shard key values rather than the query component, with some relaxed constraints for updates whose queries contain an exact match on &lt;tt&gt;_id&lt;/tt&gt;. Consider a collection sharded on &lt;tt&gt;_id&lt;/tt&gt;, or &lt;tt&gt;_id&lt;/tt&gt; plus any number of additional fields. Then, replacement-style updates of the form shown below are legal, despite the fact that the replacement document does not contain the entire shard key:&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;db.collection.update({_id: x}, {a: y, b: z}) &lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;This is because &lt;tt&gt;mongoD&lt;/tt&gt; always automatically propagates the &lt;tt&gt;_id&lt;/tt&gt; field of the existing document into the replacement document. The operation above will therefore succeed, assuming that the replacement document contains all other fields in the shard key and their values match those in the existing document.&lt;/p&gt;

&lt;p&gt;Similarly, it should also be legal to perform the above operation with &lt;tt&gt;upsert:true&lt;/tt&gt;, since &lt;tt&gt;mongoD&lt;/tt&gt; will extract the &lt;tt&gt;_id&lt;/tt&gt; from the query component when generating the new document to upsert.&lt;/p&gt;

&lt;p&gt;However, there are a few shortcomings with the current targeting logic:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;The non-upsert replacement will succeed, but because the replacement document does not contain the entire shard key, the operation will be scattered to all shards that own chunks for the collection. This is unnecessary; the update should target a single shard.&lt;/li&gt;
	&lt;li&gt;Because updates which target multiple endpoints are dispatched with &lt;tt&gt;ChunkVersion::IGNORED()&lt;/tt&gt;, scattering will update any orphaned documents present in the cluster, as well as the cloned documents that are temporarily present on both the source and destination shards while a chunk migration is in flight. This leads to the unintuitive situation where a &lt;tt&gt;multi:false&lt;/tt&gt; update with an exact match on &lt;tt&gt;_id&lt;/tt&gt;&#160;returns &lt;tt&gt;nMatched&lt;/tt&gt; and &lt;tt&gt;nModified&lt;/tt&gt;&#160;greater than 1.&lt;/li&gt;
	&lt;li&gt;Attempting this operation with &lt;tt&gt;upsert:true&lt;/tt&gt; will fail, because the targeting logic requires an exact shard key match but only considers the replacement document. Since the &lt;tt&gt;_id&lt;/tt&gt;&#160;is available in the request, this upsert should be permitted.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;&lt;del&gt;Finally, &lt;tt&gt;multi:true&lt;/tt&gt; operations of the form shown above, or which target a range of &lt;tt&gt;_ids&lt;/tt&gt;, will also succeed but must again scatter to all shards. These should target only the relevant subset of shards.&lt;/del&gt;&lt;br/&gt;
 &lt;em&gt;Note: after further discussion, it was determined that this improvement is not feasible at present. Targeting more than one shard obliges us to target all shards with unversioned updates.&lt;/em&gt;&lt;br/&gt;
 &#160;&lt;br/&gt;
 To address these shortcomings, we should merge the replacement document into the query component as a set of additional constraints, and target on the basis of the resulting composite query.&lt;/p&gt;</description>
                <environment></environment>
        <key id="543189">SERVER-34971</key>
            <summary>Improve mongoS targeting of replacement-style updates for collections whose shard key includes _id</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="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="bernard.gorman@mongodb.com">Bernard Gorman</assignee>
                                    <reporter username="bernard.gorman@mongodb.com">Bernard Gorman</reporter>
                        <labels>
                    </labels>
                <created>Sun, 13 May 2018 18:49:50 +0000</created>
                <updated>Sun, 29 Oct 2023 22:31:51 +0000</updated>
                            <resolved>Mon, 11 Jun 2018 11:41:16 +0000</resolved>
                                                    <fixVersion>4.1.1</fixVersion>
                                    <component>Querying</component>
                    <component>Sharding</component>
                                        <votes>0</votes>
                                    <watches>10</watches>
                                                                                                                <comments>
                            <comment id="1916625" author="bernard.gorman" created="Mon, 11 Jun 2018 11:39:26 +0000"  >&lt;p&gt;To summarise the changes introduced by this patch:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;Single-doc updates with an inexact match on the shard key are now permitted to run &lt;b&gt;iff&lt;/b&gt; all chunks referenced by the update reside on a single shard.&lt;/li&gt;
	&lt;li&gt;For replacement-style updates, &lt;tt&gt;mongoS&lt;/tt&gt; will validate that the replacement doc contains all shard key fields before dispatching the operation.
	&lt;ul&gt;
		&lt;li&gt;The replacement document is not required to possess the &lt;tt&gt;_id&lt;/tt&gt; field if it is present in the shard key, since &lt;tt&gt;mongod&lt;/tt&gt; will automatically propagate &lt;tt&gt;_id&lt;/tt&gt; from the document being replaced.&lt;/li&gt;
		&lt;li&gt;If the shard key contains &lt;tt&gt;_id&lt;/tt&gt; and the only missing shard key field in the replacement doc is &lt;tt&gt;_id&lt;/tt&gt;, then &lt;tt&gt;mongoS&lt;/tt&gt; will attempt to extract its value from an exact match in the query component of the update, if such a predicate exists. This will allow the operation to be targeted directly by shard key.&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
	&lt;li&gt;All other behaviours, including the ability to perform single updates by exact &lt;tt&gt;_id&lt;/tt&gt; match with the collection default collation, remain unchanged.&lt;/li&gt;
&lt;/ul&gt;
</comment>
                            <comment id="1916609" author="xgen-internal-githook" created="Mon, 11 Jun 2018 11:17:14 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;username&apos;: &apos;gormanb&apos;, &apos;name&apos;: &apos;Bernard Gorman&apos;, &apos;email&apos;: &apos;bernard.gorman@gmail.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-34971&quot; title=&quot;Improve mongoS targeting of replacement-style updates for collections whose shard key includes _id&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-34971&quot;&gt;&lt;del&gt;SERVER-34971&lt;/del&gt;&lt;/a&gt; Improve mongoS targeting for single-shard updates, and for replacement-style updates when the shard key includes _id&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/0dd1fc7ddde2a489558f5328dce5125bddfb9e4d&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/0dd1fc7ddde2a489558f5328dce5125bddfb9e4d&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10420">
                    <name>Backports</name>
                                            <outwardlinks description="backported by">
                                                        </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                                        </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="117013">SERVER-13010</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="424145">SERVER-30970</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>2.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>3.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_12450" key="com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes">
                        <customfieldname>Backport Requested</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="15141"><![CDATA[v3.6]]></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_13552" key="com.go2group.jira.plugin.crm:crm_generic_field">
                        <customfieldname>Case</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[[5002K00000z9h8cQAA, 5002K00000zeHkeQAE]]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Mon, 11 Jun 2018 11:17:14 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        5 years, 35 weeks, 2 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>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>luke.bonanomi@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            5 years, 35 weeks, 2 days ago
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_16465" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Linked BF Score</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>3.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>bernard.gorman@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|htxxnr:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr8w7j:</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_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="2300">Query 2018-05-21</customfieldvalue>
    <customfieldvalue id="2301">Query 2018-06-04</customfieldvalue>
    <customfieldvalue id="2365">Query 2018-06-18</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|htxjx3:</customfieldvalue>

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