<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:33:44 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-54507] Can&apos;t execute $merge if sharding catalog cache is empty</title>
                <link>https://jira.mongodb.org/browse/SERVER-54507</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Manifestation of the bug: &lt;b&gt;The impossibility to execute the $merge pipeline stage&lt;/b&gt;&lt;/p&gt;


&lt;p&gt;Consider the case in which the $merge pipeline stage is executed in a shard that:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Has the CollectionShardingState correctly updated with the latest shard version of the target collection.&lt;/li&gt;
	&lt;li&gt;Doesn&apos;t currently hold any entry in the cache for the target collection.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;(This is possible because the sharding catalog cache is a LRU cache in which not frequently used entries can be evicted.)&lt;/p&gt;

&lt;p&gt;The shard executes &lt;a href=&quot;https://github.com/mongodb/mongo/blob/399ce1d4f498b815290cd0f16c881e0e22ebeda8/src/mongo/db/pipeline/document_source_merge.cpp#L444&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;DocumentSourceMerge::createFromBson() &lt;/a&gt;that triggers a call to &lt;a href=&quot;https://github.com/mongodb/mongo/blob/399ce1d4f498b815290cd0f16c881e0e22ebeda8/src/mongo/db/pipeline/document_source_merge.cpp#L458&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;MongoProcessInterface::ensureFieldsUniqueOrResolveDocumentKey()&lt;/a&gt;.&#160; This function in the end &lt;a href=&quot;https://github.com/mongodb/mongo/blob/3afb4b31149e5a747e25f2aab611621a99bf8667/src/mongo/s/catalog_cache.cpp#L326-L330&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;throws a StaleConfigInfo&lt;/a&gt; because the target collection is not present in the cache. The error is correctly handled by the shard that will execute the &lt;a href=&quot;https://github.com/mongodb/mongo/blob/3afb4b31149e5a747e25f2aab611621a99bf8667/src/mongo/db/s/shard_filtering_metadata_refresh.h#L41-L62&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;onShardVersionMismatch()&lt;/a&gt; procedure.&lt;/p&gt;

&lt;p&gt;Since the CollectionShardingState already contains the latest shard version for the target collection no action will be taken and no refresh of the catalog cache will be triggered.&lt;/p&gt;

&lt;p&gt;In other words if the CollectionShardingState is up to date, the StaleConfigInfo won&apos;t guarantee that the catalog cache will be refreshed.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1622704">SERVER-54507</key>
            <summary>Can&apos;t execute $merge if sharding catalog cache is empty</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="eric.cox@mongodb.com">Eric Cox</assignee>
                                    <reporter username="tommaso.tocci@mongodb.com">Tommaso Tocci</reporter>
                        <labels>
                    </labels>
                <created>Fri, 12 Feb 2021 18:01:08 +0000</created>
                <updated>Sun, 29 Oct 2023 21:57:34 +0000</updated>
                            <resolved>Fri, 7 May 2021 22:08:12 +0000</resolved>
                                    <version>4.4.4</version>
                                    <fixVersion>5.0.0-rc0</fixVersion>
                                    <component>Querying</component>
                                        <votes>0</votes>
                                    <watches>7</watches>
                                                                                                                <comments>
                            <comment id="3912734" author="xgen-internal-githook" created="Thu, 1 Jul 2021 17:16:00 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Eric Cox&apos;, &apos;email&apos;: &apos;eric.cox@mongodb.com&apos;, &apos;username&apos;: &apos;ericox&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-56815&quot; title=&quot;Complete TODO listed in SERVER-54507&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-56815&quot;&gt;&lt;del&gt;SERVER-56815&lt;/del&gt;&lt;/a&gt; Complete TODO listed in &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-54507&quot; title=&quot;Can&amp;#39;t execute $merge if sharding catalog cache is empty&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-54507&quot;&gt;&lt;del&gt;SERVER-54507&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/620a4c060e7cf06d340a81b01cad62f5812852f3&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/620a4c060e7cf06d340a81b01cad62f5812852f3&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3762196" author="xgen-internal-githook" created="Fri, 7 May 2021 21:53:13 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Eric Cox&apos;, &apos;email&apos;: &apos;eric.cox@mongodb.com&apos;, &apos;username&apos;: &apos;ericox&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-54507&quot; title=&quot;Can&amp;#39;t execute $merge if sharding catalog cache is empty&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-54507&quot;&gt;&lt;del&gt;SERVER-54507&lt;/del&gt;&lt;/a&gt; Can&apos;t execute merge if sharding catalog cache is empty&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/32fe49396dec58836033bca67ad1360b1a80f03c&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/32fe49396dec58836033bca67ad1360b1a80f03c&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="10520">
                    <name>Problem/Incident</name>
                                            <outwardlinks description="causes">
                                                        </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="1709023">SERVER-56815</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="1706905">SERVER-56763</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="299993" name="merge_cache_bug.patch" size="877" author="tommaso.tocci@mongodb.com" created="Fri, 12 Feb 2021 17:59:04 +0000"/>
                    </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>6.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_12450" key="com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes">
                        <customfieldname>Backport Requested</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="21266"><![CDATA[v4.9]]></customfieldvalue>
    <customfieldvalue key="18953"><![CDATA[v4.4]]></customfieldvalue>
    <customfieldvalue key="16775"><![CDATA[v4.2]]></customfieldvalue>
    <customfieldvalue key="15640"><![CDATA[v4.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>Thu, 18 Feb 2021 17:21:46 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        2 years, 31 weeks, 6 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_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>luke.bonanomi@mongodb.com</customfieldvalue>

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

                        </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>eric.cox@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>tommaso.tocci@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hyv0lj:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hygif3:</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="4464">Query Execution 2021-03-08</customfieldvalue>
    <customfieldvalue id="4466">Query Execution 2021-03-22</customfieldvalue>
    <customfieldvalue id="4468">Query Execution 2021-04-05</customfieldvalue>
    <customfieldvalue id="4470">Query Execution 2021-04-19</customfieldvalue>
    <customfieldvalue id="4472">Query Execution 2021-05-03</customfieldvalue>
    <customfieldvalue id="4697">Query Execution 2021-05-17</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10750" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Steps To Reproduce</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>&lt;p&gt;Even though it can be reproduced by a far more easy test case, I&apos;ve been able to reproduce consistently this bug by just flushing the cache for the target collection in jstests/sharding/query/merge_write_concern.js before to execute the $merge aggregation command.&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;nobr&quot;&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/attachment/299993/299993_merge_cache_bug.patch&quot; title=&quot;merge_cache_bug.patch attached to SERVER-54507&quot;&gt;merge_cache_bug.patch&lt;sup&gt;&lt;img class=&quot;rendericon&quot; src=&quot;https://jira.mongodb.org/images/icons/link_attachment_7.gif&quot; height=&quot;7&quot; width=&quot;7&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;</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|hyumun:</customfieldvalue>

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