<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:17:48 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-48679] flushRoutingTableCacheUpdates should block on critical section with kWrite, not kRead</title>
                <link>https://jira.mongodb.org/browse/SERVER-48679</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;The donor &lt;a href=&quot;https://slack-redir.net/link?url=https%3A%2F%2Fgithub.com%2Fmongodb%2Fmongo%2Fblob%2F879d50a73179d0dd94fead476468af3ee4511b8f%2Fsrc%2Fmongo%2Fdb%2Fs%2Fmigration_source_manager.cpp%23L337-L348&amp;amp;v=3&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;writes&lt;/a&gt; the enterCriticalSectionCounter flag&lt;br/&gt;
 -&amp;gt; which causes secondaries to &lt;a href=&quot;https://slack-redir.net/link?url=https%3A%2F%2Fgithub.com%2Fmongodb%2Fmongo%2Fblob%2F751a68393e46e6f4706f4fce1c9b4ef2f6207f32%2Fsrc%2Fmongo%2Fdb%2Fs%2Fshard_server_op_observer.cpp%23L330-L335&amp;amp;v=3&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;clear&lt;/a&gt; their filtering metadata&lt;br/&gt;
 -&amp;gt; which causes the next versioned request on the secondary to throw StaleConfig and trigger the secondary to refresh&lt;br/&gt;
 -&amp;gt; which causes the secondary to &lt;a href=&quot;https://slack-redir.net/link?url=https%3A%2F%2Fgithub.com%2Fmongodb%2Fmongo%2Fblob%2F751a68393e46e6f4706f4fce1c9b4ef2f6207f32%2Fsrc%2Fmongo%2Fdb%2Fs%2Fshard_server_catalog_cache_loader.cpp%23L303-L323&amp;amp;v=3&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;send&lt;/a&gt; flushRoutingTableCacheUpdates to the primary&lt;br/&gt;
 -&amp;gt; which blocks behind the critical section &lt;a href=&quot;https://slack-redir.net/link?url=https%3A%2F%2Fgithub.com%2Fmongodb%2Fmongo%2Fblob%2F751a68393e46e6f4706f4fce1c9b4ef2f6207f32%2Fsrc%2Fmongo%2Fdb%2Fs%2Fflush_routing_table_cache_updates_command.cpp%23L127&amp;amp;v=3&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;only if reads are being blocked&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In 4.4 and earlier versions, if reads haven&apos;t &lt;a href=&quot;https://slack-redir.net/link?url=https%3A%2F%2Fgithub.com%2Fmongodb%2Fmongo%2Fblob%2F751a68393e46e6f4706f4fce1c9b4ef2f6207f32%2Fsrc%2Fmongo%2Fdb%2Fs%2Fmigration_source_manager.cpp%23L418-L420&amp;amp;v=3&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;started being blocked&lt;/a&gt; yet, the secondary will finish the refresh and serve reads for stale mongoses even if the migration commits.&#160;&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Donor writes enterCriticalSectionSignal at T90&lt;/li&gt;
	&lt;li&gt;Secondary sees the flag, invalidates its filtering metadata&lt;/li&gt;
	&lt;li&gt;Secondary gets versioned read, sendsflushRoutingTableCacheUpdates, gets back success&lt;/li&gt;
	&lt;li&gt;Donor starts blocking writes&lt;/li&gt;
	&lt;li&gt;Donor commits the migration, which succeeds at T100&lt;/li&gt;
	&lt;li&gt;Client does a write from mongos1, which contacts donor and gets back StaleConfig, then retries write on recipient, which succeeds at T101&lt;/li&gt;
	&lt;li&gt;Client does afterClusterTime: T101 read from mongos2, which is stale and contacts the donor secondary. &amp;gt;&amp;gt;&amp;gt; That secondary will wait until T101, then serve the read &amp;lt;&amp;lt;&amp;lt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;In 4.5, that happens to not be an issue since the refresh is done by calling &lt;a href=&quot;https://github.com/mongodb/mongo/blob/1af88ecaa952995d44e545708633196b2cd2bbb2/src/mongo/db/s/flush_routing_table_cache_updates_command.cpp#L141&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;onShardVersionMismatch&lt;/a&gt; which &lt;a href=&quot;https://github.com/mongodb/mongo/blob/866c1eafdf18072f4cd818c6566ff74f94fab397/src/mongo/db/s/shard_filtering_metadata_refresh.cpp#L205&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;waits for the critical section&lt;/a&gt;&#160;as long as&#160;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/866c1eafdf18072f4cd818c6566ff74f94fab397/src/mongo/db/s/shard_filtering_metadata_refresh.cpp#L164&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;writes are already being blocked&lt;/a&gt;.&#160;&lt;/p&gt;

&lt;p&gt;Despite that, we want to change flushRoutingTableCacheUpdates in all versions to block behind the critical section with kWrite, &lt;a href=&quot;https://github.com/mongodb/mongo/blob/c9138c2550e356c29029c612d0f7306e4f3bae5e/src/mongo/db/s/flush_routing_table_cache_updates_command.cpp#L127&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;not kRead, as it does today&lt;/a&gt;.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1376576">SERVER-48679</key>
            <summary>flushRoutingTableCacheUpdates should block on critical section with kWrite, not kRead</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="luis.osta@mongodb.com">Luis Osta</assignee>
                                    <reporter username="esha.maharishi@mongodb.com">Esha Maharishi</reporter>
                        <labels>
                    </labels>
                <created>Tue, 9 Jun 2020 21:49:45 +0000</created>
                <updated>Sun, 29 Oct 2023 22:07:15 +0000</updated>
                            <resolved>Wed, 1 Jul 2020 15:14:01 +0000</resolved>
                                    <version>3.6.18</version>
                    <version>4.5.1</version>
                    <version>4.0.18</version>
                    <version>4.2.7</version>
                    <version>4.4.0-rc8</version>
                                    <fixVersion>4.4.1</fixVersion>
                    <fixVersion>4.7.0</fixVersion>
                    <fixVersion>4.2.10</fixVersion>
                    <fixVersion>4.0.22</fixVersion>
                                    <component>Sharding</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="3452777" author="xgen-internal-githook" created="Mon, 19 Oct 2020 20:04:02 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Luis Osta&apos;, &apos;email&apos;: &apos;luis.osta@mongodb.com&apos;, &apos;username&apos;: &apos;LuisOsta&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-48679&quot; title=&quot;flushRoutingTableCacheUpdates should block on critical section with kWrite, not kRead&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-48679&quot;&gt;&lt;del&gt;SERVER-48679&lt;/del&gt;&lt;/a&gt; flushRoutingTableCacheUpdates should block on critical section with kWrite, not kRead&lt;/p&gt;

&lt;p&gt;(cherry picked from commit 9f4b81e5bdcf38f9b10459203a804ba406528770)&lt;br/&gt;
Branch: v4.0&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/c3c59be0a89fcea095f701ff615ccc416fde5001&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/c3c59be0a89fcea095f701ff615ccc416fde5001&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3334074" author="xgen-internal-githook" created="Wed, 12 Aug 2020 04:56:39 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Luis Osta&apos;, &apos;email&apos;: &apos;luis.osta@mongodb.com&apos;, &apos;username&apos;: &apos;LuisOsta&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-48679&quot; title=&quot;flushRoutingTableCacheUpdates should block on critical section with kWrite, not kRead&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-48679&quot;&gt;&lt;del&gt;SERVER-48679&lt;/del&gt;&lt;/a&gt; flushRoutingTableCacheUpdates should block on critical section with kWrite, not kRead&lt;/p&gt;

&lt;p&gt;(cherry picked from commit 9f4b81e5bdcf38f9b10459203a804ba406528770)&lt;br/&gt;
Branch: v4.2&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/1dd91dee7c8cb437a893cd7f6ff22d0bd26ee1d4&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/1dd91dee7c8cb437a893cd7f6ff22d0bd26ee1d4&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3334072" author="xgen-internal-githook" created="Wed, 12 Aug 2020 04:46:26 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Luis Osta&apos;, &apos;email&apos;: &apos;luis.osta@mongodb.com&apos;, &apos;username&apos;: &apos;LuisOsta&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-48679&quot; title=&quot;flushRoutingTableCacheUpdates should block on critical section with kWrite, not kRead&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-48679&quot;&gt;&lt;del&gt;SERVER-48679&lt;/del&gt;&lt;/a&gt; flushRoutingTableCacheUpdates should block on critical section with kWrite, not kRead&lt;/p&gt;

&lt;p&gt;(cherry picked from commit 9f4b81e5bdcf38f9b10459203a804ba406528770)&lt;br/&gt;
Branch: v4.4&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/18e6827bd918c06b5d43d39b2f196102973ea31d&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/18e6827bd918c06b5d43d39b2f196102973ea31d&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3261824" author="xgen-internal-githook" created="Wed, 1 Jul 2020 15:22:02 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Luis Osta&apos;, &apos;email&apos;: &apos;luis.osta@mongodb.com&apos;, &apos;username&apos;: &apos;LuisOsta&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-48679&quot; title=&quot;flushRoutingTableCacheUpdates should block on critical section with kWrite, not kRead&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-48679&quot;&gt;&lt;del&gt;SERVER-48679&lt;/del&gt;&lt;/a&gt; flushRoutingTableCacheUpdates should block on critical section with kWrite, not kRead&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/9f4b81e5bdcf38f9b10459203a804ba406528770&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/9f4b81e5bdcf38f9b10459203a804ba406528770&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10420">
                    <name>Backports</name>
                                            <outwardlinks description="backported by">
                                                        </outwardlinks>
                                                        </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="1471627">SERVER-50898</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>4.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_12450" key="com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes">
                        <customfieldname>Backport Requested</customfieldname>
                        <customfieldvalues>
                                <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>Tue, 30 Jun 2020 19:32:34 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        3 years, 16 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_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>
                            3 years, 16 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>0.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>esha.maharishi@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>luis.osta@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hxp8jz:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hxcc7r:</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="3956">Sharding 2020-06-15</customfieldvalue>
    <customfieldvalue id="3957">Sharding 2020-06-29</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|hxoutb:</customfieldvalue>

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