<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:27:19 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-31521] Shard primaries that step down can&apos;t force the new primary to refresh its routing table</title>
                <link>https://jira.mongodb.org/browse/SERVER-31521</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;If a shard primary steps down, it will trigger the ShardServerCatalogCacheLoader::onStepDown function which sets the &lt;a href=&quot;https://github.com/mongodb/mongo/blob/0287fb01445a7372469b1ac1486f7ede25ab6bf7/src/mongo/db/s/shard_server_catalog_cache_loader.cpp#L309&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;PrimarySteppedDown error code interrupt&lt;/a&gt; on the OperationContextGroup used by the ShardServerCatalogCacheLoader. This means that all operation contexts added to this group will be automatically interrupted until &lt;a href=&quot;https://github.com/mongodb/mongo/blob/0287fb01445a7372469b1ac1486f7ede25ab6bf7/src/mongo/db/s/shard_server_catalog_cache_loader.cpp#L317&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;resetInterrupt() is called in the ShardServerCatalogCacheLoader::onStepUp hook&lt;/a&gt;, when/if the node transitions back to primary.&lt;/p&gt;

&lt;p&gt;The problem is that when a secondary that used to be primary receives a command that forces it to refresh its routing table, it will &lt;a href=&quot;https://github.com/mongodb/mongo/blob/0287fb01445a7372469b1ac1486f7ede25ab6bf7/src/mongo/db/s/shard_server_catalog_cache_loader.cpp#L342&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;add an operation context to its OperationContextGroup&lt;/a&gt; and call _runSecondaryGetChunksSince, which will attempt to send a &lt;a href=&quot;https://github.com/mongodb/mongo/blob/0287fb01445a7372469b1ac1486f7ede25ab6bf7/src/mongo/db/s/shard_server_catalog_cache_loader.cpp#L249-L255&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&quot;forceRoutingTableRefresh&quot; command&lt;/a&gt; to the primary, but because the operation context was &lt;a href=&quot;https://github.com/mongodb/mongo/blob/0287fb01445a7372469b1ac1486f7ede25ab6bf7/src/mongo/db/operation_context_group.cpp#L81-L83&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;automatically interrupted upon being added to the group&lt;/a&gt;, this will fail with PrimarySteppedDown, and the primary will never actually receive the refresh command.&lt;/p&gt;

&lt;p&gt;I think &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-30148&quot; title=&quot;Move force primary refresh functionality out of the ShardServerCatalogCacheLoader into the ShardingState&amp;#39;s refresh logic&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-30148&quot;&gt;&lt;del&gt;SERVER-30148&lt;/del&gt;&lt;/a&gt; will fix this, because the ShardingState&apos;s refresh logic shouldn&apos;t use an operation context from the ShardServerCatalogCacheLoader&apos;s interrupted OperationContextGroup.&lt;/p&gt;</description>
                <environment></environment>
        <key id="444131">SERVER-31521</key>
            <summary>Shard primaries that step down can&apos;t force the new primary to refresh its routing table</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="dianna.hohensee@mongodb.com">Dianna Hohensee</assignee>
                                    <reporter username="jack.mulrow@mongodb.com">Jack Mulrow</reporter>
                        <labels>
                    </labels>
                <created>Wed, 11 Oct 2017 21:19:45 +0000</created>
                <updated>Mon, 30 Oct 2023 23:12:52 +0000</updated>
                            <resolved>Thu, 19 Oct 2017 20:37:05 +0000</resolved>
                                                    <fixVersion>3.6.0-rc1</fixVersion>
                                    <component>Sharding</component>
                                        <votes>0</votes>
                                    <watches>5</watches>
                                                                                                                <comments>
                            <comment id="1704228" author="xgen-internal-githook" created="Thu, 19 Oct 2017 20:36:47 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;email&apos;: &apos;dianna.hohensee@10gen.com&apos;, &apos;name&apos;: &apos;Dianna Hohensee&apos;, &apos;username&apos;: &apos;DiannaHohensee&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-31521&quot; title=&quot;Shard primaries that step down can&amp;#39;t force the new primary to refresh its routing table&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-31521&quot;&gt;&lt;del&gt;SERVER-31521&lt;/del&gt;&lt;/a&gt; Make OperationContextGroup have a non-sticky interrupt and update ShardServerCatalogCacheLoader accordingly&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/88c39edf9275e47e5db4b1dbffb0bf51f9187731&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/88c39edf9275e47e5db4b1dbffb0bf51f9187731&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1700338" author="kaloian.manassiev" created="Mon, 16 Oct 2017 21:28:27 +0000"  >&lt;p&gt;Yes, this is correct. Changing the behaviour of OperationContextGroup to not have a persistent &quot;interrupted&quot; state also seems reasonable to me.&lt;/p&gt;</comment>
                            <comment id="1700314" author="dianna.hohensee" created="Mon, 16 Oct 2017 21:21:11 +0000"  >&lt;p&gt;So the approach is to significantly change OperationContextGroup. It will continue to interrupt the OperationContexts that it holds at the time of interrupt, but it will no longer interrupt OperationContexts created afterwards. Removing concepts like OperationContextGroup::resetInterrupt(), so interrupt doesn&apos;t &apos;stick&apos;.&lt;/p&gt;</comment>
                            <comment id="1697749" author="kaloian.manassiev" created="Thu, 12 Oct 2017 21:09:11 +0000"  >&lt;p&gt;So the problem here is that the &quot;interrupted&quot; state of the OperationContextGroup is sticky until the node becomes primary again?&lt;/p&gt;

&lt;p&gt;Is this a problem for &lt;tt&gt;forceRoutingTableRefresh&lt;/tt&gt; only - it seems to me that even the local reads to refresh from the local chunks collection will also fail due to interrupt, wouldn&apos;t they? If that is the case, I don&apos;t think &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-30148&quot; title=&quot;Move force primary refresh functionality out of the ShardServerCatalogCacheLoader into the ShardingState&amp;#39;s refresh logic&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-30148&quot;&gt;&lt;del&gt;SERVER-30148&lt;/del&gt;&lt;/a&gt; will fix it, because the control flow will eventually still get to having to read the local collection contents and (if the storage engine is a good citizen and obeys interruption) we will have the same problem.&lt;/p&gt;

&lt;p&gt;I was looking at the usage of OperationContextGroup and given that we interrupt all active operation contexts and set the state to secondary atomically, we could remove the sticky interrupt state and just make the code &lt;a href=&quot;https://github.com/mongodb/mongo/blob/0287fb01445a7372469b1ac1486f7ede25ab6bf7/src/mongo/db/s/shard_server_catalog_cache_loader.cpp#L343&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt; check for whether it is still primary (or the right term)?&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                                        </inwardlinks>
                                    </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>1.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, 12 Oct 2017 21:09:11 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        6 years, 16 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_14262" key="com.atlassian.jira.plugin.system.customfieldtypes:datepicker">
                        <customfieldname>End date</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Wed, 18 Oct 2017 00:00:00 +0000</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, 6 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>dianna.hohensee@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>jack.mulrow@mongodb.com</customfieldvalue>
            <customfieldvalue>kaloian.manassiev@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hthlfj:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hraitz:</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="1927">Sharding 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, 11 Oct 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|hth7jb:</customfieldvalue>

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