<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:13:45 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-26970] isMaster can return isMaster: true while in drain mode</title>
                <link>https://jira.mongodb.org/browse/SERVER-26970</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Earlier in this &lt;a href=&quot;https://github.com/mongodb/mongo/blob/80f8ffa2121c264ead069f3ed39a34a57ac3f5a7/src/mongo/db/repl/replication_coordinator_impl.cpp#L929-L931&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;code block&lt;/a&gt; _isWaitingForDrainToComplete is set to false, and at that point isMaster will begin to return true. This is because isMaster &lt;a href=&quot;https://github.com/mongodb/mongo/blob/80f8ffa2121c264ead069f3ed39a34a57ac3f5a7/src/mongo/db/repl/replication_coordinator_impl.cpp#L2011&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;does not wait for&lt;/a&gt; _canAcceptNonLocalWrites to be true to return true (which it probably should). This, however, occurs before we write the &quot;new primary&quot; noop to the server and log that &quot;transition to primary complete; database writes are now permitted&quot;, which should happen before drain mode is complete (especially the &quot;new primary&quot; noop). &lt;/p&gt;

&lt;p&gt;This code block also unlocks and relocks its mutex without checking if the state has changed afterwards, which should be reconsidered.&lt;/p&gt;

&lt;p&gt;Related, but tangential is that _isWaitingForDrainToComplete and _isCatchingUp and _canAcceptNonLocalWrites are all related but currently function as 3 separate booleans. We should investigate if they can be combined into an enum.&lt;/p&gt;</description>
                <environment></environment>
        <key id="330814">SERVER-26970</key>
            <summary>isMaster can return isMaster: true while in drain mode</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="3">Duplicate</resolution>
                                        <assignee username="siyuan.zhou@mongodb.com">Siyuan Zhou</assignee>
                                    <reporter username="judah.schvimer@mongodb.com">Judah Schvimer</reporter>
                        <labels>
                    </labels>
                <created>Wed, 9 Nov 2016 20:25:07 +0000</created>
                <updated>Fri, 24 Mar 2017 17:06:19 +0000</updated>
                            <resolved>Fri, 10 Mar 2017 18:32:10 +0000</resolved>
                                                                    <component>Replication</component>
                                        <votes>0</votes>
                                    <watches>8</watches>
                                                                                                                <comments>
                            <comment id="1521347" author="spencer" created="Fri, 10 Mar 2017 18:32:11 +0000"  >&lt;p&gt;The original issue this ticket was describing was fixed in &lt;a href=&quot;https://github.com/mongodb/mongo/commit/1da3111dc238698e4e70672b7ba260a368121e50&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/1da3111dc238698e4e70672b7ba260a368121e50&lt;/a&gt; as part of &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-27120&quot; title=&quot;Increase synchronization between producer/applier threads and stepdown/stepup&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-27120&quot;&gt;&lt;del&gt;SERVER-27120&lt;/del&gt;&lt;/a&gt;.  Any additional fixes to the process of transitioning to primary should happen in different tickets.&lt;/p&gt;</comment>
                            <comment id="1520779" author="siyuan.zhou@10gen.com" created="Fri, 10 Mar 2017 06:25:39 +0000"  >&lt;p&gt;_canAcceptNonLocalWrites is checked in isMaster as part of &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-27120&quot; title=&quot;Increase synchronization between producer/applier threads and stepdown/stepup&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-27120&quot;&gt;&lt;del&gt;SERVER-27120&lt;/del&gt;&lt;/a&gt;. &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-28269&quot; title=&quot;Set _canAcceptNonLocalWrites at the end of signalDrainComplete()&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-28269&quot;&gt;&lt;del&gt;SERVER-28269&lt;/del&gt;&lt;/a&gt; is filed for the proposed fix and this one will be resolved as a dup to &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-28269&quot; title=&quot;Set _canAcceptNonLocalWrites at the end of signalDrainComplete()&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-28269&quot;&gt;&lt;del&gt;SERVER-28269&lt;/del&gt;&lt;/a&gt; when it is finished.&lt;/p&gt;

&lt;p&gt;Regarding the lock and unlock of mutex, the state of replication cannot change because we are holding the global lock, so it&apos;s safe to re-acquire the mutex without checking the state.&lt;/p&gt;</comment>
                            <comment id="1519479" author="siyuan.zhou@10gen.com" created="Wed, 8 Mar 2017 22:38:56 +0000"  >&lt;p&gt;We set &lt;tt&gt;_canAcceptNonLocalWrites&lt;/tt&gt; before writing the &quot;new primary&quot; no-op, so the linked BF&apos;s run &lt;tt&gt;ReplSetTest.awaitReplication&lt;/tt&gt; and see isMaste: true and the last op &lt;b&gt;before&lt;/b&gt; the no-op. They don&apos;t expect the new no-op and failed.&lt;/p&gt;

&lt;p&gt;The HELP ticket is in a different scenario. The shard was blocked on stepping up because it cannot see the config servers. _canAcceptNonLocalWrites was set before that so a client thought the primary is ready to accept new writes. Discussed with &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=kaloian.manassiev&quot; class=&quot;user-hover&quot; rel=&quot;kaloian.manassiev&quot;&gt;kaloian.manassiev&lt;/a&gt;, I believe we cannot just move &lt;tt&gt;_canAcceptNonLocalWrites&lt;/tt&gt; to after enabling sharding, because sharding needs to write to $admin database. Without seeing the config servers, no writes can be accepted anyway, so it&apos;s more about informative error messages.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=spencer&quot; class=&quot;user-hover&quot; rel=&quot;spencer&quot;&gt;spencer&lt;/a&gt;, we could fix the BF&apos;s by setting &lt;tt&gt;_canAcceptNonLocalWrites&lt;/tt&gt; after the no-op write and before enabling sharding, but that wouldn&apos;t fix the HELP ticket.&lt;/p&gt;</comment>
                            <comment id="1518302" author="spencer" created="Tue, 7 Mar 2017 21:17:14 +0000"  >&lt;p&gt;We&apos;ve had users hit this issue and be pointed at this ticket to wait for the fix.  Given that the behavior has been fixed I think we should ahead and close this ticket out.  If you think there is something in the way we acquire and release mutexes during stepdown that needs to be looked at, please file a new ticket for that.  I don&apos;t think it&apos;s guaranteed that &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-27892&quot; title=&quot;Clarify locking rules for _canAcceptNonLocalWrites and _canServeNonLocalReads&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-27892&quot;&gt;&lt;del&gt;SERVER-27892&lt;/del&gt;&lt;/a&gt; will wind up addressing that.&lt;/p&gt;</comment>
                            <comment id="1518167" author="siyuan.zhou@10gen.com" created="Tue, 7 Mar 2017 19:39:19 +0000"  >&lt;p&gt;isMaster itself was fixed by &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-27120&quot; title=&quot;Increase synchronization between producer/applier threads and stepdown/stepup&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-27120&quot;&gt;&lt;del&gt;SERVER-27120&lt;/del&gt;&lt;/a&gt;, but &lt;a href=&quot;https://github.com/mongodb/mongo/blob/e20c8f98eb6e060cc6f46ee60a2683ea7043f1a1/src/mongo/db/repl/replication_coordinator_impl.cpp#L929-L931&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;the lock and unlock of mutex&lt;/a&gt; still looks suspicious. Is it covered by &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-27892&quot; title=&quot;Clarify locking rules for _canAcceptNonLocalWrites and _canServeNonLocalReads&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-27892&quot;&gt;&lt;del&gt;SERVER-27892&lt;/del&gt;&lt;/a&gt;? If not, we can keep this ticket open to track that.&lt;/p&gt;</comment>
                            <comment id="1518118" author="spencer" created="Tue, 7 Mar 2017 19:05:46 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=siyuan.zhou&quot; class=&quot;user-hover&quot; rel=&quot;siyuan.zhou&quot;&gt;siyuan.zhou&lt;/a&gt;, was this fixed as part of &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-27120&quot; title=&quot;Increase synchronization between producer/applier threads and stepdown/stepup&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-27120&quot;&gt;&lt;del&gt;SERVER-27120&lt;/del&gt;&lt;/a&gt;?&lt;/p&gt;</comment>
                            <comment id="1452748" author="siyuan.zhou@10gen.com" created="Thu, 8 Dec 2016 20:49:14 +0000"  >&lt;p&gt;In &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-27120&quot; title=&quot;Increase synchronization between producer/applier threads and stepdown/stepup&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-27120&quot;&gt;&lt;del&gt;SERVER-27120&lt;/del&gt;&lt;/a&gt;, I tried to separate the states of bgsync producer and applier from the replication coordinator. After that work, I&apos;ll remove &lt;tt&gt;_isWaitingForDrainToComplete&lt;/tt&gt; and &lt;tt&gt;_isCatchingUp&lt;/tt&gt; to favor bgsync producer and applier&apos;s own states. Drain mode and catchup mode actually don&apos;t affect replication coordinator&apos;s behavior. They only affect bgsync and applier&apos;s behavior.&lt;/p&gt;

&lt;p&gt;The code in isMaster was &lt;a href=&quot;https://mongodbcr.appspot.com/103750001/diff/90001/src/mongo/db/repl/replication_coordinator_impl.cpp&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;audited in my patch (line 2059)&lt;/a&gt; and will be changed to check &lt;tt&gt;_canAcceptNonLocalWrites&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;The lock and unlock should still be reconsidered though.&lt;/p&gt;</comment>
                            <comment id="1430518" author="milkie" created="Wed, 9 Nov 2016 20:33:27 +0000"  >&lt;p&gt;We already had a ticket to make those 3 an enum earlier this year.  The difficulty was that &quot;_canAcceptNonLocalWrites&quot; has special locking behavior that is not shared with the other bools.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                                        </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="332980">SERVER-27120</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="363281">SERVER-28269</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                                        </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>8.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>4.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Wed, 9 Nov 2016 20:33:27 +0000</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            6 years, 48 weeks, 5 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>milkie@mongodb.com</customfieldvalue>
            <customfieldvalue>judah.schvimer@mongodb.com</customfieldvalue>
            <customfieldvalue>siyuan.zhou@mongodb.com</customfieldvalue>
            <customfieldvalue>spencer@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrjr8v:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrb0qn:</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="1313">Repl 2017-01-23</customfieldvalue>
    <customfieldvalue id="1450">Repl 2017-02-13</customfieldvalue>
    <customfieldvalue id="1453">Repl 2017-03-06</customfieldvalue>
    <customfieldvalue id="1617">Repl 2017-03-27</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|hsedcf:</customfieldvalue>

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