<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:41:09 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-57167] Prevent throwing on session creation due to stepdown before stepdown completes</title>
                <link>https://jira.mongodb.org/browse/SERVER-57167</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;&lt;b&gt;Issue:&lt;/b&gt;&lt;br/&gt;
Since &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-52564&quot; title=&quot;Deadlock between step down and MongoDOperationContextSession&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-52564&quot;&gt;&lt;del&gt;SERVER-52564&lt;/del&gt;&lt;/a&gt;, session checkout &lt;a href=&quot;https://github.com/mongodb/mongo/blob/7e3f45501efc356f3cd5d753e1ceda9b4186089b/src/mongo/db/session_catalog.cpp#L83-L86&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;throws InterruptedDueToReplStateChange&lt;/a&gt;&#160; when a stepdown is in progress. Throwing a retryable error before stepdown is complete means retries may be exhausted (running against the node stepping down) before the new primary steps up and the command can be retargeted.&#160;&lt;/p&gt;

&lt;p&gt;Ideally, the command would be retargeted upon retry.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Proposal:&lt;/b&gt;&#160;Instead of bubbling the exception immediately back to the caller, wait for the stepdown to complete before throwing to the top layer.&#160;&lt;/p&gt;

&lt;p&gt;This could be done by catching the initial&#160;InterruptedDueToReplStateChange &lt;a href=&quot;https://github.com/mongodb/mongo/blob/7e3f45501efc356f3cd5d753e1ceda9b4186089b/src/mongo/db/session_catalog.cpp#L83-L86&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;exception thrown&lt;/a&gt;, blocking until the RSTL is released in the catch block, then calling checkForInterrupt() and throwing. Thus, by the time the session checkout throws, the stepdown has had time to complete.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1754718">SERVER-57167</key>
            <summary>Prevent throwing on session creation due to stepdown before stepdown completes</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="13203">Gone away</resolution>
                                        <assignee username="luis.osta@mongodb.com">Luis Osta</assignee>
                                    <reporter username="haley.connelly@mongodb.com">Haley Connelly</reporter>
                        <labels>
                            <label>sharding-wfbf-day</label>
                    </labels>
                <created>Mon, 24 May 2021 21:21:15 +0000</created>
                <updated>Fri, 27 Oct 2023 20:46:02 +0000</updated>
                            <resolved>Thu, 19 Aug 2021 18:18:38 +0000</resolved>
                                                                    <component>Sharding</component>
                                        <votes>0</votes>
                                    <watches>8</watches>
                                                                                                                <comments>
                            <comment id="4010606" author="JIRAUSER1253452" created="Thu, 19 Aug 2021 18:18:38 +0000"  >&lt;p&gt;Fixed by -&#160;&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-53431&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/SERVER-53431&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="4010331" author="matthew.russotto" created="Thu, 19 Aug 2021 17:05:19 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=luis.osta&quot; class=&quot;user-hover&quot; rel=&quot;luis.osta&quot;&gt;luis.osta&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Yes I believe &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-53431&quot; title=&quot;Server should respond running operations with appropriate topologyVersion on stepdown&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-53431&quot;&gt;&lt;del&gt;SERVER-53431&lt;/del&gt;&lt;/a&gt; should cover this; by the time the driver gets the retryable error, the server should no longer report itself as primary.&lt;/p&gt;</comment>
                            <comment id="4010197" author="JIRAUSER1253452" created="Thu, 19 Aug 2021 16:25:51 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=matthew.russotto&quot; class=&quot;user-hover&quot; rel=&quot;matthew.russotto&quot;&gt;matthew.russotto&lt;/a&gt; Since &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-53431&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/SERVER-53431&lt;/a&gt;&#160;has been backported does this mean that this fix is no longer necessary?&lt;/p&gt;</comment>
                            <comment id="3866688" author="matthew.russotto" created="Tue, 8 Jun 2021 16:43:31 +0000"  >&lt;p&gt;Yes, before &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-53431&quot; title=&quot;Server should respond running operations with appropriate topologyVersion on stepdown&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-53431&quot;&gt;&lt;del&gt;SERVER-53431&lt;/del&gt;&lt;/a&gt; we would kill ops while still reporting isMaster/isWritablePrimary true for a short period, but I think it didn&apos;t cause noticeable problems until the faster topology change notification project went in (which meant we saw the race every time).  Which is why that didn&apos;t get backported to 4.2.   Backporting &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-53431&quot; title=&quot;Server should respond running operations with appropriate topologyVersion on stepdown&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-53431&quot;&gt;&lt;del&gt;SERVER-53431&lt;/del&gt;&lt;/a&gt; to 4.2 will likely fix BF-20963.&lt;/p&gt;</comment>
                            <comment id="3864262" author="max.hirschhorn@10gen.com" created="Tue, 8 Jun 2021 00:48:40 +0000"  >&lt;blockquote&gt;
&lt;p&gt;Usually we avoid drivers exhausting retries by returning isWritablePrimary: false from the hello command (isMaster: false from isMaster for older versions) for the affected node (even if the primary is in a state where it can technically still accept writes), rather than blocking anything on the stepdown completing. This is done with the _waitingForRSTLAtStepDown variable, here&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/f4e79552c206e31be0ed2a68d3fee7426a2f9f7e/src/mongo/db/repl/replication_coordinator_impl.cpp#L2553&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/blob/f4e79552c206e31be0ed2a68d3fee7426a2f9f7e/src/mongo/db/repl/replication_coordinator_impl.cpp#L2553&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=matthew.russotto&quot; class=&quot;user-hover&quot; rel=&quot;matthew.russotto&quot;&gt;matthew.russotto&lt;/a&gt;, is the behavior you&apos;re describing new with &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-53431&quot; title=&quot;Server should respond running operations with appropriate topologyVersion on stepdown&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-53431&quot;&gt;&lt;del&gt;SERVER-53431&lt;/del&gt;&lt;/a&gt;? If so, that could explain why we had only been seeing it on the 4.2 branch despite the changes from &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-52564&quot; title=&quot;Deadlock between step down and MongoDOperationContextSession&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-52564&quot;&gt;&lt;del&gt;SERVER-52564&lt;/del&gt;&lt;/a&gt; also being present on the 4.4 and master branches. My knowledge may be stale from when I had filed &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-34608&quot; title=&quot;Drivers may still see ismaster=true from primary in midst of stepping down immediately after operations are killed with InterruptedDueToReplStateChange&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-34608&quot;&gt;&lt;del&gt;SERVER-34608&lt;/del&gt;&lt;/a&gt; while working on integrating retryable writes into the mongo shell.&lt;/p&gt;</comment>
                            <comment id="3863372" author="matthew.russotto" created="Mon, 7 Jun 2021 19:32:47 +0000"  >&lt;p&gt;Usually we avoid drivers exhausting retries by returning isWritablePrimary: false from the hello command (isMaster: false from isMaster for older versions) for the affected node (even if the primary is in a state where it can technically still accept writes), rather than blocking anything on the stepdown completing.  This is done with the _waitingForRSTLAtStepDown variable, here&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/f4e79552c206e31be0ed2a68d3fee7426a2f9f7e/src/mongo/db/repl/replication_coordinator_impl.cpp#L2553&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/blob/f4e79552c206e31be0ed2a68d3fee7426a2f9f7e/src/mongo/db/repl/replication_coordinator_impl.cpp#L2553&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This seems to already occur before blocking session checkout, so I&apos;m not sure why we wouldn&apos;t retarget already?&lt;/p&gt;</comment>
                            <comment id="3820204" author="haley.connelly" created="Mon, 24 May 2021 21:22:25 +0000"  >&lt;p&gt;These changes should be backported at least to v4.2&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                                        </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="532248">SERVER-34608</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="647369">SERVER-38456</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="1531601">SERVER-52564</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_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Mon, 7 Jun 2021 19:32:47 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        2 years, 24 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_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, 24 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>39.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>haley.connelly@mongodb.com</customfieldvalue>
            <customfieldvalue>luis.osta@mongodb.com</customfieldvalue>
            <customfieldvalue>matthew.russotto@mongodb.com</customfieldvalue>
            <customfieldvalue>max.hirschhorn@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hzhc2f:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hz215r:</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_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|hzgybj:</customfieldvalue>

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