<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:46:22 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-59108] Resolve race with transaction operation not killed after step down</title>
                <link>https://jira.mongodb.org/browse/SERVER-59108</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;In &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-50486&quot; title=&quot;invokeWithSessionCheckedOut being called on prepared transactions on secondaries&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-50486&quot;&gt;&lt;del&gt;SERVER-50486&lt;/del&gt;&lt;/a&gt;, we added a &lt;a href=&quot;https://github.com/mongodb/mongo/blob/110a58f2ece4fd1efaa93ccf552883fef047a00b/src/mongo/db/service_entry_point_common.cpp#L1477-L1482&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;flag on the opCtx of transaction operations&lt;/a&gt; to ensure that these operations would be interrupted on step down. We then &lt;a href=&quot;https://github.com/mongodb/mongo/blob/110a58f2ece4fd1efaa93ccf552883fef047a00b/src/mongo/db/service_entry_point_common.cpp#L1488&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;check to make sure we are still the primary&lt;/a&gt;. The &lt;tt&gt;commandCanRunHere&lt;/tt&gt; function will return true if &lt;a href=&quot;https://github.com/mongodb/mongo/blob/9b87aa49a79d4018f8de9ec2c95fd2742f3b8303/src/mongo/db/repl/replication_coordinator_impl.cpp#L2810&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;we can accept non-local writes&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In the stepDown code path, we first &lt;a href=&quot;https://github.com/mongodb/mongo/blob/9b87aa49a79d4018f8de9ec2c95fd2742f3b8303/src/mongo/db/repl/replication_coordinator_impl.cpp#L2570&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;acquire the RSTL&lt;/a&gt;, which is where we run the killOps thread to kill the opCtx of any commands that have the flag set. Only then do we &lt;a href=&quot;https://github.com/mongodb/mongo/blob/9b87aa49a79d4018f8de9ec2c95fd2742f3b8303/src/mongo/db/repl/replication_coordinator_impl.cpp#L2587&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;update if we can accept non-local writes or not&lt;/a&gt;. As a result, it seems possible for the following to happen:&lt;/p&gt;

&lt;ol&gt;
	&lt;li&gt;In the user thread t1, we add a user command to the &lt;tt&gt;_clients&lt;/tt&gt; vector in &lt;tt&gt;ServiceContext&lt;/tt&gt;. However, we haven&apos;t yet hit &lt;tt&gt;ExecCommandDatabase::_initiateCommand()&lt;/tt&gt; and &lt;a href=&quot;https://github.com/mongodb/mongo/blob/110a58f2ece4fd1efaa93ccf552883fef047a00b/src/mongo/db/service_entry_point_common.cpp#L1477-L1482&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;set the flag&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;In the &lt;tt&gt;stepDown&lt;/tt&gt; thread t2, we attempt to acquire RSTL and loop through all commands. Since the flag is not yet set for the command in t1, it is not killed&lt;/li&gt;
	&lt;li&gt;In t1, we now set the flag and check if we can still service non-local writes. Since we still can, the command proceeds&lt;/li&gt;
	&lt;li&gt;In t2, we acquire RSTL and set that we can no longer service non-local writes.&lt;/li&gt;
&lt;/ol&gt;
</description>
                <environment></environment>
        <key id="1841250">SERVER-59108</key>
            <summary>Resolve race with transaction operation not killed after step down</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="vesselina.ratcheva@mongodb.com">Vesselina Ratcheva</assignee>
                                    <reporter username="xuerui.fa@mongodb.com">Xuerui Fa</reporter>
                        <labels>
                    </labels>
                <created>Wed, 4 Aug 2021 18:03:37 +0000</created>
                <updated>Sun, 29 Oct 2023 21:49:54 +0000</updated>
                            <resolved>Mon, 11 Oct 2021 20:28:13 +0000</resolved>
                                                    <fixVersion>4.4.11</fixVersion>
                    <fixVersion>4.2.18</fixVersion>
                    <fixVersion>5.0.4</fixVersion>
                    <fixVersion>5.1.0-rc0</fixVersion>
                                                        <votes>0</votes>
                                    <watches>8</watches>
                                                                                                                <comments>
                            <comment id="4137052" author="xgen-internal-githook" created="Thu, 21 Oct 2021 00:56:38 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Vesselina Ratcheva&apos;, &apos;email&apos;: &apos;vesselina.ratcheva@10gen.com&apos;, &apos;username&apos;: &apos;vessy-mongodb&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-59108&quot; title=&quot;Resolve race with transaction operation not killed after step down&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-59108&quot;&gt;&lt;del&gt;SERVER-59108&lt;/del&gt;&lt;/a&gt; Resolve race with transaction operation not killed after stepdown&lt;/p&gt;

&lt;p&gt;(cherry picked from commit 1b31e6ca3d25a35f31f48547aafe0ec33c8c9bfd)&lt;br/&gt;
Branch: v4.2&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/5bb885c0fd06484ca4b3a596b1959d64e3080e8b&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/5bb885c0fd06484ca4b3a596b1959d64e3080e8b&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="4137030" author="xgen-internal-githook" created="Thu, 21 Oct 2021 00:33:51 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Vesselina Ratcheva&apos;, &apos;email&apos;: &apos;vesselina.ratcheva@10gen.com&apos;, &apos;username&apos;: &apos;vessy-mongodb&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-59108&quot; title=&quot;Resolve race with transaction operation not killed after step down&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-59108&quot;&gt;&lt;del&gt;SERVER-59108&lt;/del&gt;&lt;/a&gt; Resolve race with transaction operation not killed after stepdown&lt;/p&gt;

&lt;p&gt;(cherry picked from commit 1b31e6ca3d25a35f31f48547aafe0ec33c8c9bfd)&lt;br/&gt;
Branch: v4.4&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/bba630c895a90a59b78d12105424575b2f847b91&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/bba630c895a90a59b78d12105424575b2f847b91&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="4136938" author="xgen-internal-githook" created="Thu, 21 Oct 2021 00:01:11 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Vesselina Ratcheva&apos;, &apos;email&apos;: &apos;vesselina.ratcheva@10gen.com&apos;, &apos;username&apos;: &apos;vessy-mongodb&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-59108&quot; title=&quot;Resolve race with transaction operation not killed after step down&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-59108&quot;&gt;&lt;del&gt;SERVER-59108&lt;/del&gt;&lt;/a&gt; Resolve race with transaction operation not killed after stepdown&lt;/p&gt;

&lt;p&gt;(cherry picked from commit 1b31e6ca3d25a35f31f48547aafe0ec33c8c9bfd)&lt;br/&gt;
Branch: v5.0&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/af958aeb4c242065d33fe0831eac0368fa3e3f21&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/af958aeb4c242065d33fe0831eac0368fa3e3f21&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="4114902" author="xgen-internal-githook" created="Mon, 11 Oct 2021 03:33:03 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Vesselina Ratcheva&apos;, &apos;email&apos;: &apos;vesselina.ratcheva@10gen.com&apos;, &apos;username&apos;: &apos;vessy-mongodb&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-59108&quot; title=&quot;Resolve race with transaction operation not killed after step down&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-59108&quot;&gt;&lt;del&gt;SERVER-59108&lt;/del&gt;&lt;/a&gt; Resolve race with transaction operation not killed after stepdown&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/1b31e6ca3d25a35f31f48547aafe0ec33c8c9bfd&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/1b31e6ca3d25a35f31f48547aafe0ec33c8c9bfd&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10420">
                    <name>Backports</name>
                                            <outwardlinks description="backported by">
                                                        </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                                        </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10520">
                    <name>Problem/Incident</name>
                                            <outwardlinks description="causes">
                                                        </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="1450243">SERVER-50486</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="2043397">SERVER-66351</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>4.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_12450" key="com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes">
                        <customfieldname>Backport Requested</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="21777"><![CDATA[v5.0]]></customfieldvalue>
    <customfieldvalue key="18953"><![CDATA[v4.4]]></customfieldvalue>
    <customfieldvalue key="16775"><![CDATA[v4.2]]></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>Fri, 1 Oct 2021 09:07:25 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        2 years, 16 weeks 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_17050" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Downstream Team Attention</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="16941"><![CDATA[Not Needed]]></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>
                            2 years, 16 weeks ago
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_16465" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Linked BF Score</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>70.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>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>vesselina.ratcheva@mongodb.com</customfieldvalue>
            <customfieldvalue>xuerui.fa@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hzw2hr:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr2x0v:</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="5142">Repl 2021-09-06</customfieldvalue>
    <customfieldvalue id="5143">Repl 2021-09-20</customfieldvalue>
    <customfieldvalue id="5144">Repl 2021-10-04</customfieldvalue>
    <customfieldvalue id="5145">Repl 2021-10-18</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|hzvoqn:</customfieldvalue>

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