<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 06:10:48 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[SERVER-68438] Fix PrimaryOnlyService race condition with the PrimaryOnlyServiceClientObserver</title>
                <link>https://jira.mongodb.org/browse/SERVER-68438</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;There is currently a race condition between the POS and the PrimaryOnlyServiceClientObserver.&lt;/p&gt;

&lt;p&gt;When a new primary steps up, we transition from the &lt;a href=&quot;https://github.com/10gen/mongo/blob/11ed931625c685b453a5244553f1d97c81b80850/src/mongo/db/repl/primary_only_service.cpp#L338&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;kRebuilding&lt;/a&gt; to the &lt;a href=&quot;https://github.com/10gen/mongo/blob/11ed931625c685b453a5244553f1d97c81b80850/src/mongo/db/repl/primary_only_service.cpp#L426&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;kRunning&lt;/a&gt; state in the POS.&lt;/p&gt;

&lt;p&gt;In this case since the instance starts running before we are able to transition from `kRebuilding` to `kRunning. We create the OperationContext during the `&lt;a href=&quot;https://github.com/10gen/mongo/blob/11ed931625c685b453a5244553f1d97c81b80850/src/mongo/db/repl/primary_only_service.cpp#L779&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;run&lt;/a&gt;` of the PrimaryOnlyService, the PrimaryOnlyService will actually kill the OpCtx while being in that transition.&lt;/p&gt;

&lt;p&gt;The reason why the operation context is killed is because during that transition the PrimaryOnlyServiceClientObserver which will register the OperationContext will check the current state and find that the current state is indeed kRebuilding. However the second condition which is to check if `allowOpCtxWhileRebuilding` is set to true will no longer be true due to the&#160;&lt;br/&gt;
&lt;a href=&quot;https://github.com/10gen/mongo/blob/11ed931625c685b453a5244553f1d97c81b80850/src/mongo/db/repl/primary_only_service.cpp#L693&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;AllowOpCtxWhenServiceRebuildingBlock&lt;/a&gt; running out of scope and &lt;a href=&quot;https://github.com/10gen/mongo/blob/11ed931625c685b453a5244553f1d97c81b80850/src/mongo/db/repl/primary_only_service.cpp#L832&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;reseting the allowOpCtxWhileRebuilding flag to false&lt;/a&gt;.&lt;br/&gt;
We end up in a state where we are rebuilding but no longer are allowing the Operation Context while rebuilding and are not in the kRunning state yet.&lt;/p&gt;

&lt;p&gt;Since the instance starts running before the POS state is able to transition from the `kRebuilding` state to the `kRunning` state,&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="2102786">SERVER-68438</key>
            <summary>Fix PrimaryOnlyService race condition with the PrimaryOnlyServiceClientObserver</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="13202">Works as Designed</resolution>
                                        <assignee username="esha.maharishi@mongodb.com">Esha Maharishi</assignee>
                                    <reporter username="mathis.bessa@mongodb.com">Mathis Bessa</reporter>
                        <labels>
                    </labels>
                <created>Fri, 29 Jul 2022 19:48:19 +0000</created>
                <updated>Fri, 27 Oct 2023 13:51:57 +0000</updated>
                            <resolved>Mon, 1 Aug 2022 22:33:30 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>9</watches>
                                                                                                                <comments>
                            <comment id="4719668" author="JIRAUSER1262621" created="Mon, 1 Aug 2022 21:27:35 +0000"  >&lt;p&gt;After carefully reviewing the issue we decided to close this current ticket since reverting &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-51650&quot; title=&quot;Primary-Only Service&amp;#39;s _rebuildCV should be notified even if stepdown happens quickly after stepup&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-51650&quot;&gt;&lt;del&gt;SERVER-51650&lt;/del&gt;&lt;/a&gt; will fix the bug that was introduced (there was no already existing issue, sorry for the confusion).&lt;/p&gt;

&lt;p&gt;We are also going to work on &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-68473&quot; title=&quot;Improve existing comment to better explain the condition when registering the operation context&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-68473&quot;&gt;&lt;del&gt;SERVER-68473&lt;/del&gt;&lt;/a&gt; which will result in better explaining the logic in the code as a comment.&lt;/p&gt;

&lt;p&gt;The revert of &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-51650&quot; title=&quot;Primary-Only Service&amp;#39;s _rebuildCV should be notified even if stepdown happens quickly after stepup&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-51650&quot;&gt;&lt;del&gt;SERVER-51650&lt;/del&gt;&lt;/a&gt; will start shortly.&lt;/p&gt;</comment>
                            <comment id="4719476" author="george.wangensteen" created="Mon, 1 Aug 2022 20:25:17 +0000"  >&lt;p&gt;If &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-51650&quot; title=&quot;Primary-Only Service&amp;#39;s _rebuildCV should be notified even if stepdown happens quickly after stepup&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-51650&quot;&gt;&lt;del&gt;SERVER-51650&lt;/del&gt;&lt;/a&gt; has made the BFs more frequent, I&apos;m fine with reverting it until we fix the BF. Happy to do so, checking with Mathis.&lt;/p&gt;</comment>
                            <comment id="4719373" author="jason.chan" created="Mon, 1 Aug 2022 19:51:24 +0000"  >&lt;p&gt;Should we revert &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-51650&quot; title=&quot;Primary-Only Service&amp;#39;s _rebuildCV should be notified even if stepdown happens quickly after stepup&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-51650&quot;&gt;&lt;del&gt;SERVER-51650&lt;/del&gt;&lt;/a&gt; for now to prevent further BFs from being generated? &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=george.wangensteen%40mongodb.com&quot; class=&quot;user-hover&quot; rel=&quot;george.wangensteen@mongodb.com&quot;&gt;george.wangensteen@mongodb.com&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="4715857" author="suganthi.mani" created="Fri, 29 Jul 2022 23:23:15 +0000"  >&lt;p&gt;I don&apos;t see any reason for POS to not allow instances to &lt;a href=&quot;https://github.com/10gen/mongo/blob/f0fe2f924db95442ff3efe509f01382c1f48fe11/src/mongo/db/repl/primary_only_service.cpp#L265&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;create the opCtx while POS is in rebuilding state&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="4715426" author="suganthi.mani" created="Fri, 29 Jul 2022 19:54:50 +0000"  >&lt;p&gt;Note:  &lt;a href=&quot;https://github.com/mongodb/mongo/commit/11ed931625c685b453a5244553f1d97c81b80850&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;This&lt;/a&gt; commit made the race condition more frequent. We need to fix this sooner as we have lots of BF failures.&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="1515354">SERVER-51650</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>5.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 29 Jul 2022 19:54:50 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        1 year, 27 weeks, 2 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></customfieldvalue>


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_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>
                            1 year, 27 weeks, 2 days ago
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_16465" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Linked BF Score</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>131.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10032" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Operating System</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10026"><![CDATA[ALL]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>esha.maharishi@mongodb.com</customfieldvalue>
            <customfieldvalue>george.wangensteen@mongodb.com</customfieldvalue>
            <customfieldvalue>jason.chan@mongodb.com</customfieldvalue>
            <customfieldvalue>mathis.bessa@mongodb.com</customfieldvalue>
            <customfieldvalue>suganthi.mani@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i14flb:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|i0n8qg:</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_10750" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Steps To Reproduce</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>&lt;p&gt;Step-up on a secondary during a tenant migration.&lt;/p&gt;</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|i141qn:</customfieldvalue>

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