<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 06:06:59 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-66993] TransactionParticipants can be refreshed incorrectly after failover/restart</title>
                <link>https://jira.mongodb.org/browse/SERVER-66993</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;To reduce the number of the matching session ids in the covered query read on the &quot;parentLsid&quot; during a TransactionParticipant refresh(see the comment below for details on how TransactionParticipant refreshes work), we look up the &lt;a href=&quot;https://github.com/mongodb/mongo/blob/668bc828c0c2e944139ec681734b3e21e82a80ff/src/mongo/db/transaction_participant.cpp#L2865&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;highest txnNumber known in memory&lt;/a&gt; and use it in find &lt;a href=&quot;https://github.com/mongodb/mongo/blob/668bc828c0c2e944139ec681734b3e21e82a80ff/src/mongo/db/transaction_participant.cpp#L348&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;filter&lt;/a&gt;. This txnNumber is currently computed as the &lt;a href=&quot;https://github.com/mongodb/mongo/blob/668bc828c0c2e944139ec681734b3e21e82a80ff/src/mongo/db/session_catalog.cpp#L312-L315&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;max of the lsid.txnNumber for the sessions that have been checked out from the SessionCatalog&lt;/a&gt;.&#160; Here is how this optimization can cause TransactionParticipants to get refreshed incorrectly after failover or restart.&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;mongos0 runs an internal transaction with session id {id, uid, 5, txnUUID} until it has entered prepare.&lt;/li&gt;
	&lt;li&gt;The replica set shuts down. Upon restart, each node reconstructs the prepared internal transaction from step 1. This only sets up the TransactionParticipant for the internal transaction session (via &lt;a href=&quot;https://github.com/10gen/mongo/blob/8113aef47fab9d0d14c953b78032ab1661360438/src/mongo/db/repl/transaction_oplog_application.cpp#L448&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;MongoDOperationContextSessionWithoutRefresh&lt;/a&gt;) and so the TransactionParticipant for the parent session is not marked valid.&#160;&lt;/li&gt;
	&lt;li&gt;mongos1 starts an internal transaction with session id {id, uid, 6, txnUUID}. Checking out the session causes TransactionParticipant to get refreshed. However, but from &lt;a href=&quot;https://github.com/mongodb/mongo/blob/d47db7491eec3f05df5021793a6a97e6f9f5c7d7/src/mongo/db/transaction_participant.cpp#L344&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;scanning the SessionCatalog&lt;/a&gt;, it thinks that the highest txnNumber is 6 and so it &lt;a href=&quot;https://github.com/mongodb/mongo/blob/d47db7491eec3f05df5021793a6a97e6f9f5c7d7/src/mongo/db/transaction_participant.cpp#L354&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;only looks for&lt;/a&gt; session ids with lsid.txnNumber &amp;gt;= 6 and finds no matching session ids so it concludes that the txnNumber to recover is 6. So &lt;a href=&quot;https://github.com/mongodb/mongo/blob/d47db7491eec3f05df5021793a6a97e6f9f5c7d7/src/mongo/db/transaction_participant.cpp#L2901&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;, it finds no other TransactionParticipants to refresh (i.e. the only TransactionParticipant in RetryableWriteTransactionParticipantCatalog is the one for {id, uid, 6, txnUUID}).&#160; The new transaction is able to start without getting blocked.&lt;/li&gt;
	&lt;li&gt;The transaction from step 1 is stuck in prepare.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;So the issue here is that it is incorrect to to infer the active txnNumber from the session ids. &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-66852&quot; title=&quot;Remove the Session objects for expired transaction sessions whose logical session hasn&amp;#39;t expired &quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-66852&quot;&gt;&lt;del&gt;SERVER-66852&lt;/del&gt;&lt;/a&gt; introduced a method named &lt;a href=&quot;https://github.com/mongodb/mongo/commit/8e96ecbf56a0763f4300aa38746ac86a8335d264#diff-5336e1dd82b568543a8580fbb8288926aa4d73a640bd1fe9131d036b4813ef63R2741-R2742&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;OperationContextSession::observeNewTxnNumberStarted()&lt;/a&gt; which is called when a new txnNumber starts. This is the correct number to use as the highest txnNumber known in memory.&lt;/p&gt;</description>
                <environment></environment>
        <key id="2061247">SERVER-66993</key>
            <summary>TransactionParticipants can be refreshed incorrectly after failover/restart</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="jack.mulrow@mongodb.com">Jack Mulrow</assignee>
                                    <reporter username="cheahuychou.mao@mongodb.com">Cheahuychou Mao</reporter>
                        <labels>
                    </labels>
                <created>Fri, 3 Jun 2022 03:14:10 +0000</created>
                <updated>Sun, 29 Oct 2023 21:37:21 +0000</updated>
                            <resolved>Tue, 7 Jun 2022 16:12:25 +0000</resolved>
                                                    <fixVersion>6.0.0-rc9</fixVersion>
                    <fixVersion>6.1.0-rc0</fixVersion>
                                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="4600241" author="xgen-internal-githook" created="Tue, 7 Jun 2022 17:55:36 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Jack Mulrow&apos;, &apos;email&apos;: &apos;jack.mulrow@mongodb.com&apos;, &apos;username&apos;: &apos;jsmulrow&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-66993&quot; title=&quot;TransactionParticipants can be refreshed incorrectly after failover/restart&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-66993&quot;&gt;&lt;del&gt;SERVER-66993&lt;/del&gt;&lt;/a&gt; Stop tracking highest child session txnNumber&lt;/p&gt;

&lt;p&gt;(cherry picked from commit f0a44617983763b0fdc1f37bdc35e391184ea63d)&lt;br/&gt;
Branch: v6.0&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/90cccd16effc6e4056fd9d297ffc1e6d60b9d01c&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/90cccd16effc6e4056fd9d297ffc1e6d60b9d01c&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="4599779" author="xgen-internal-githook" created="Tue, 7 Jun 2022 15:31:37 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Jack Mulrow&apos;, &apos;email&apos;: &apos;jack.mulrow@mongodb.com&apos;, &apos;username&apos;: &apos;jsmulrow&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-66993&quot; title=&quot;TransactionParticipants can be refreshed incorrectly after failover/restart&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-66993&quot;&gt;&lt;del&gt;SERVER-66993&lt;/del&gt;&lt;/a&gt; Stop tracking highest child session txnNumber&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/f0a44617983763b0fdc1f37bdc35e391184ea63d&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/f0a44617983763b0fdc1f37bdc35e391184ea63d&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10420">
                    <name>Backports</name>
                                            <outwardlinks description="backported by">
                                                        </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_12450" key="com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes">
                        <customfieldname>Backport Requested</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="23470"><![CDATA[v6.0]]></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>Mon, 6 Jun 2022 19:25:24 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        1 year, 35 weeks, 1 day 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_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PM-2210</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>
                            1 year, 35 weeks, 1 day ago
                        </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>cheahuychou.mao@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>jack.mulrow@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i0xc5r:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|i0g7pk:</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_22250" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Special Downgrade Instructions Required</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="23343"><![CDATA[Not Needed]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="5737">Sharding NYC 2022-06-13</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|i0wyb3:</customfieldvalue>

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