<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:26:16 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-31192] Get shard key into documentKey and resumeToken in changeStream &apos;insert&apos; notification entries</title>
                <link>https://jira.mongodb.org/browse/SERVER-31192</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;For a sharded collection, &lt;tt&gt;DocumentSourceChangeStream&lt;/tt&gt; requires the shard key in order to extract the shard key from insert entries. When a &lt;tt&gt;DocumentSourceChangeStream&lt;/tt&gt; is constructed, it should store the shard key for the collection. It can get the shard key by calling &lt;tt&gt;CatalogCache::getCollectionRoutingInfo()&lt;/tt&gt;, which will be modified to include the UUID for the collection, to protect against renames. It is important to store the shard key inside &lt;tt&gt;DocumentSourceChangeStream&lt;/tt&gt;, so that it can continue to extract the shard key from insert entries even after the collection has been dropped and the shard key is no longer available in the &lt;tt&gt;CatalogCache&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;Note that if &lt;tt&gt;CatalogCache::getCollectionRoutingInfo()&lt;/tt&gt; returns a mismatched UUID for the namespace, the aggregation should fail.&lt;/p&gt;</description>
                <environment></environment>
        <key id="430129">SERVER-31192</key>
            <summary>Get shard key into documentKey and resumeToken in changeStream &apos;insert&apos; notification entries</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</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="nathan.myers">Nathan Myers</assignee>
                                    <reporter username="tess.avitabile@mongodb.com">Tess Avitabile</reporter>
                        <labels>
                    </labels>
                <created>Wed, 20 Sep 2017 21:23:24 +0000</created>
                <updated>Mon, 30 Oct 2023 23:13:27 +0000</updated>
                            <resolved>Fri, 20 Oct 2017 20:58:21 +0000</resolved>
                                                    <fixVersion>3.6.0-rc1</fixVersion>
                                    <component>Aggregation Framework</component>
                                        <votes>0</votes>
                                    <watches>5</watches>
                                                                                                                <comments>
                            <comment id="1705274" author="xgen-internal-githook" created="Fri, 20 Oct 2017 20:54:29 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;email&apos;: &apos;ncm@cantrip.org&apos;, &apos;name&apos;: &apos;Nathan Myers&apos;, &apos;username&apos;: &apos;ncm&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-31192&quot; title=&quot;Get shard key into documentKey and resumeToken in changeStream &amp;#39;insert&amp;#39; notification entries&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-31192&quot;&gt;&lt;del&gt;SERVER-31192&lt;/del&gt;&lt;/a&gt; Make Change Stream extract documentKey from insert op log entry&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/f32371804b610a22fabd7ef8bc726c431c547cf3&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/f32371804b610a22fabd7ef8bc726c431c547cf3&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1678909" author="tess.avitabile" created="Thu, 21 Sep 2017 17:11:52 +0000"  >&lt;p&gt;Hmm though we are holding a collection lock when the change stream cursor is first created, right? So I guess we should always succeed after refresh?&lt;/p&gt;</comment>
                            <comment id="1678697" author="tess.avitabile" created="Thu, 21 Sep 2017 14:30:15 +0000"  >&lt;p&gt;Thanks, Esha. It seems reasonable to me to call &lt;tt&gt;CatalogCache::getCollectionRoutingInfo()&lt;/tt&gt; and if we do not get a return value with the correct UUID, to try &lt;tt&gt;CatalogCache::getShardedCollectionRoutingInfoWithRefresh()&lt;/tt&gt;.&lt;/p&gt;</comment>
                            <comment id="1678249" author="esha.maharishi@10gen.com" created="Wed, 20 Sep 2017 23:24:32 +0000"  >&lt;p&gt;Instead of mongos sending setShardVersion, we could make the shard invalidate its routing table cache entry for the namespace in the OpObserver for dropCollection:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/r3.5.13/src/mongo/db/s/collection_sharding_state.cpp#L375-L404&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/blob/r3.5.13/src/mongo/db/s/collection_sharding_state.cpp#L375-L404&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;to invalidate the entry, do Grid::get(opCtx)&lt;del&gt;&amp;gt;catalogCache()&lt;/del&gt;&amp;gt;invalidateShardedCollection(nss);&lt;/p&gt;

&lt;p&gt;Alternatively there is a CatalogCache::getShardedCollectionRoutingInfoWithRefresh(): &lt;a href=&quot;https://github.com/mongodb/mongo/blob/r3.5.13/src/mongo/s/catalog_cache.cpp#L195&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/blob/r3.5.13/src/mongo/s/catalog_cache.cpp#L195&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;EDIT:&lt;/p&gt;

&lt;p&gt;It&apos;s not correct to clear the routing table cache entry in the OpObserver for dropCollection, because the shard may refresh its cache before the collection entry is removed from config.collections on the config server.&lt;/p&gt;</comment>
                            <comment id="1678238" author="esha.maharishi@10gen.com" created="Wed, 20 Sep 2017 23:07:32 +0000"  >&lt;p&gt;Mongos does send setShardVersion after dropping a sharded collection: &lt;a href=&quot;https://github.com/mongodb/mongo/blob/r3.5.13/src/mongo/s/catalog/sharding_catalog_client_impl.cpp#L551-L568&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/blob/r3.5.13/src/mongo/s/catalog/sharding_catalog_client_impl.cpp#L551-L568&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But it&apos;s possible that the setShardVersion won&apos;t reach the shard due to, say, a network error.&lt;/p&gt;</comment>
                            <comment id="1678169" author="tess.avitabile" created="Wed, 20 Sep 2017 21:32:00 +0000"  >&lt;p&gt;I will test this behavior, but CC &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=esha.maharishi&quot; class=&quot;user-hover&quot; rel=&quot;esha.maharishi&quot;&gt;esha.maharishi&lt;/a&gt;, in case she knows off the top of her head.&lt;/p&gt;</comment>
                            <comment id="1678162" author="spencer" created="Wed, 20 Sep 2017 21:28:50 +0000"  >&lt;p&gt;Do we definitely clear the CatalogCache on collection drops?  If so then I think you&apos;re right and if the UUID doesn&apos;t match we should fail the command.  If it doesn&apos;t then we should probably try to refresh the cache once to see if it matches once we have the most up to date version.  We&apos;ll also need to be prepared to load the cache if there&apos;s no information in the cache for this collection yet, though that may happen automatically.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                            <outwardlinks description="depends on">
                                        <issuelink>
            <issuekey id="430121">SERVER-31191</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is depended on by">
                                        <issuelink>
            <issuekey id="415114">SERVER-30599</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>7.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_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>Wed, 20 Sep 2017 21:28:50 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        6 years, 16 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/SERVER-31191'>SERVER-31191</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_14262" key="com.atlassian.jira.plugin.system.customfieldtypes:datepicker">
                        <customfieldname>End date</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Tue, 26 Sep 2017 00:00:00 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PM-89</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>luke.bonanomi@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            6 years, 16 weeks, 5 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>esha.maharishi@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>nathan.myers</customfieldvalue>
            <customfieldvalue>spencer@mongodb.com</customfieldvalue>
            <customfieldvalue>tess.avitabile@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|htf91j:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|ht72l3:</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="1893">Repl 2017-10-02</customfieldvalue>
    <customfieldvalue id="1915">Repl 2017-10-23</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_14261" key="com.atlassian.jira.plugin.system.customfieldtypes:datepicker">
                        <customfieldname>Start date</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Wed, 20 Sep 2017 00:00:00 +0000</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|htev4v:</customfieldvalue>

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