<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 06:45:31 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-81115] ReplicaSetAwareService Can Be Shutdown While Node is Still Primary</title>
                <link>https://jira.mongodb.org/browse/SERVER-81115</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;On stepdown, ReplicaSetAwareServices will be &lt;a href=&quot;https://github.com/10gen/mongo/blob/b9235dbace065846cc17937201c8eac9582bfd98/src/mongo/db/repl/replication_coordinator_impl.cpp#L4803&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;notified of the stepdown&lt;/a&gt; as part of &lt;a href=&quot;https://github.com/10gen/mongo/blob/b9235dbace065846cc17937201c8eac9582bfd98/src/mongo/db/repl/replication_coordinator_impl.cpp#L4707-L4708&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;stepdown actions&lt;/a&gt; only after the node is &lt;a href=&quot;https://github.com/10gen/mongo/blob/b9235dbace065846cc17937201c8eac9582bfd98/src/mongo/db/repl/replication_coordinator_impl.cpp#L4704&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;no longer writable&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;On shutdown, in most cases this property will hold, as prior to &lt;a href=&quot;https://github.com/10gen/mongo/blob/b9235dbace065846cc17937201c8eac9582bfd98/src/mongo/db/mongod_main.cpp#L1567&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;shutting down the replication coordinator&lt;/a&gt; (and therefore &lt;a href=&quot;https://github.com/10gen/mongo/blob/b9235dbace065846cc17937201c8eac9582bfd98/src/mongo/db/repl/replication_coordinator_impl.cpp#L1101&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;shutting down ReplicaSetAwareServices&lt;/a&gt;), we will first &lt;a href=&quot;https://github.com/10gen/mongo/blob/b9235dbace065846cc17937201c8eac9582bfd98/src/mongo/db/mongod_main.cpp#L1470&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;trigger a stepdown&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;However, in rare cases, it can be possible for the node to remain primary even after ReplicaSetAwareServices are shut down if the stepdown attempt during shutdown fails (for example, because no secondaries are caught up at the time of the shutdown). The stepdown is able to fail because, despite the &lt;a href=&quot;https://github.com/10gen/mongo/blob/b9235dbace065846cc17937201c8eac9582bfd98/src/mongo/db/mongod_main.cpp#L1463&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;forceShutdown parameter&lt;/a&gt; perhaps suggesting otherwise, the stepdown attempt is &lt;a href=&quot;https://github.com/10gen/mongo/blob/b9235dbace065846cc17937201c8eac9582bfd98/src/mongo/db/commands/shutdown_d.cpp#L76&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;not forced&lt;/a&gt;. Instead, the forceShutdown parameter only determines whether we &lt;a href=&quot;https://github.com/10gen/mongo/blob/b9235dbace065846cc17937201c8eac9582bfd98/src/mongo/db/commands/shutdown_d.cpp#L85-L87&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;return the actual error&lt;/a&gt; if the stepdown attempt does fail, or if we swallow it and &lt;a href=&quot;https://github.com/10gen/mongo/blob/b9235dbace065846cc17937201c8eac9582bfd98/src/mongo/db/commands/shutdown_d.cpp#L96&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;return OK anyway&lt;/a&gt;. It should also be noted that the caller &lt;a href=&quot;https://github.com/10gen/mongo/blob/b9235dbace065846cc17937201c8eac9582bfd98/src/mongo/db/mongod_main.cpp#L1470&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;invariants&lt;/a&gt; that stepDownForShutdown returns OK, which is to say that we aren&apos;t going to take any meaningful action in the event that the stepdown attempt fails (e.g. by deciding to abort the shutdown).&lt;/p&gt;

&lt;p&gt;The ultimate consequence of this is that PrimaryOnlyServices (built on top of ReplicaSetAwareService) needed to expose its shutdown state (see &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-78108&quot; title=&quot;POS interface should expose its shutdown state &quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-78108&quot;&gt;&lt;del&gt;SERVER-78108&lt;/del&gt;&lt;/a&gt;) in order to explicitly disambiguate &quot;the service does not exist because it has no state document on disk&quot; from &quot;the service does not exist because the node is shutting down.&quot; Previously, it was thought that these cases could be disambiguated by &lt;a href=&quot;https://github.com/10gen/mongo/blob/b9235dbace065846cc17937201c8eac9582bfd98/src/mongo/db/s/shardsvr_commit_reshard_collection_command.cpp#L134-L137&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;performing a no-op write&lt;/a&gt; after attempting to acquire a handle to the service, based on the assumption that ReplicaSetAwareServices would not have been shut down as long as the node was still a writable primary. The violation of this assumption eventually led to BF-29013 (see &lt;a href=&quot;https://jira.mongodb.org/browse/BF-29013?focusedCommentId=5702610&amp;amp;page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-5702610&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;this comment&lt;/a&gt; for specific details) and &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-78009&quot; title=&quot;shardSvrCommitReshardCollection command should fail recoverably if the node is shutting down&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-78009&quot;&gt;&lt;del&gt;SERVER-78009&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This ticket exists to answer a few questions:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;Is it possible and desirable to formalize the assumed property that ReplicaSetAwareService will not have its stepdown or shutdown hooks called until after the node is no longer a writable primary as a guarantee?&lt;/li&gt;
	&lt;li&gt;Can 1. be accomplished trivially by forcing the stepdown being performed &lt;a href=&quot;https://github.com/10gen/mongo/blob/b9235dbace065846cc17937201c8eac9582bfd98/src/mongo/db/commands/shutdown_d.cpp#L76&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt; (at least in the case that forceShutdown is true)?&lt;/li&gt;
	&lt;li&gt;If the answer to 2. is no, is there some other reasonable way of maintaining this property as a guarantee?&lt;/li&gt;
&lt;/ol&gt;
</description>
                <environment></environment>
        <key id="2443812">SERVER-81115</key>
            <summary>ReplicaSetAwareService Can Be Shutdown While Node is Still Primary</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="11262" iconUrl="https://jira.mongodb.org/images/icons/statuses/generic.png" description="">Investigating</status>
                    <statusCategory id="4" key="indeterminate" colorName="inprogress"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="lingzhi.deng@mongodb.com">Lingzhi Deng</assignee>
                                    <reporter username="brett.nawrocki@mongodb.com">Brett Nawrocki</reporter>
                        <labels>
                    </labels>
                <created>Fri, 15 Sep 2023 18:24:12 +0000</created>
                <updated>Fri, 10 Nov 2023 15:55:57 +0000</updated>
                                                                            <component>Replication</component>
                                        <votes>0</votes>
                                    <watches>7</watches>
                                                                                                                    <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="2365917">SERVER-78009</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="1297450">SERVER-47190</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>0.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>3.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25128"><![CDATA[Replication]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        20 weeks, 5 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>lingzhi.deng@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            20 weeks, 5 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>brett.nawrocki@mongodb.com</customfieldvalue>
            <customfieldvalue>lingzhi.deng@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i2qtg7:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|i28s0g:</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="7777">Repl 2023-10-02</customfieldvalue>
    <customfieldvalue id="7778">Repl 2023-10-16</customfieldvalue>
    <customfieldvalue id="7877">Repl 2023-10-30</customfieldvalue>

                        </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|i2qflj:</customfieldvalue>

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