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

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


<item>
            <title>[SERVER-66110] Downgrading FCV can cause the active txnNumber on TransactionParticipant to change between session yielding and unyielding</title>
                <link>https://jira.mongodb.org/browse/SERVER-66110</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Consider an external session with latest txnNumber=5 where the txnNumber corresponds to a retryable write that was executed using an internal transaction.&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;client0 starts downgrading the FCV to 5.0.&lt;/li&gt;
	&lt;li&gt;Right after the setFCV thread finishes aborting unprepared transactions and waiting for prepared transactions to complete, client1 starts a transaction with txnNumber=6 and runs a write statement inside it. That statement is executed via the transaction API. To hand off the transaction to opCtx created by the API, the original opCtx for the transaction&#160;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/77d687fef953493da281bc908aeb0f9216ee02e0/src/mongo/db/transaction_participant_resource_yielder.cpp#L43-L58&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;yields&lt;/a&gt;&#160;the TransactionParticipant. The transaction API checks out the session, executes the write statement and checks the session back in. It doesn&#8217;t commit the transaction since the transaction is owned by the external client.&lt;/li&gt;
	&lt;li&gt;The setFCV thread &lt;a href=&quot;https://github.com/mongodb/mongo/blob/77d687fef953493da281bc908aeb0f9216ee02e0/src/mongo/db/commands/set_feature_compatibility_version_command.cpp#L946-L951&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;sets&lt;/a&gt; the &#8220;txnNum&#8221; for the config.transactions entry for the external session to 5 and its &#8220;lastWriteTime&#8221; to {t: 1, ts: Timestamp(1, 0)}. The direct write to the config.transactions causes the TransactionParticipant for the external session to be&#160;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/77d687fef953493da281bc908aeb0f9216ee02e0/src/mongo/db/session_catalog_mongod.cpp#L518&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;invalidated&lt;/a&gt;.&lt;/li&gt;
	&lt;li&gt;The original opCtx for the transaction &lt;a href=&quot;https://github.com/mongodb/mongo/blob/77d687fef953493da281bc908aeb0f9216ee02e0/src/mongo/db/transaction_participant_resource_yielder.cpp#L60-L73&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;unyields&lt;/a&gt; the TransactionParticipant. Upon checking out the session, it &lt;a href=&quot;https://github.com/mongodb/mongo/blob/77d687fef953493da281bc908aeb0f9216ee02e0/src/mongo/db/session_catalog_mongod.cpp#L596&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;refreshes&lt;/a&gt; the TransactionParticipant from disk. After refresh, the active txnNumber on TransactionParticipant is 5 instead of 6. As described in &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-66000&quot; title=&quot;Make post-downgrade retry error for retryable writes that are executed using internal transactions consistent&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-66000&quot;&gt;&lt;del&gt;SERVER-66000&lt;/del&gt;&lt;/a&gt;, setFCV doesn&#8217;t set or unset the &#8220;state&#8221; field of the config.transactions entry for the external session so there are two cases here:
	&lt;ul&gt;
		&lt;li&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;A&amp;#93;&lt;/span&gt; If the txnNumber before txnNumber=5 corresponds to a transaction, the refreshed TransactionParticipant would have state &#8220;committed&#8221; so &lt;a href=&quot;https://github.com/mongodb/mongo/blob/77d687fef953493da281bc908aeb0f9216ee02e0/src/mongo/db/transaction_participant_resource_yielder.cpp#L70&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;unstashing&lt;/a&gt; would fail with TransactionCommitted &lt;a href=&quot;https://github.com/mongodb/mongo/blob/77d687fef953493da281bc908aeb0f9216ee02e0/src/mongo/db/transaction_participant.cpp#L2207-L2211&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;.&lt;/li&gt;
		&lt;li&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;B&amp;#93;&lt;/span&gt; If the txnNumber before txnNumber=5 corresponds to a retryable write, the refreshed TransactionParticipant would have state &#8220;none&#8221;. Additionally, unstashing would return early &lt;a href=&quot;https://github.com/mongodb/mongo/blob/77d687fef953493da281bc908aeb0f9216ee02e0/src/mongo/db/transaction_participant.cpp#L1410&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt; so it does not fail.&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;A&amp;#93;&lt;/span&gt; is problematic since TransactionCommitted is not among the errors handled by drivers so the error would be returned to the external client and it is misleading since the transaction has not been committed yet.&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;B&amp;#93;&lt;/span&gt; shouldn&#8217;t cause any issues since when the client sends a command containing additional statements (no startTransaction) or a commit/abortTransaction command, that command would fail with NoSuchTransaction which is a transient transaction error so the drivers would retry the transaction with a higher txnNumber.&lt;/p&gt;

&lt;p&gt;Similar issues also exist for internal transactions for retryable writes. However, the steps are as follows:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;client0 runs a retryable write statement with txnNumber=6. To hand off the transaction to opCtx created by the API, the original opCtx for the retryable write yields the TransactionParticipant. The transaction API checks out an internal session for the retryable write, executes the write statement in a transaction in that session, commits the transaction and checks the session back in.&lt;/li&gt;
	&lt;li&gt;client1 runs setFCV: 5.0 to completion.&lt;/li&gt;
	&lt;li&gt;The opCtx for the retryable write unyields the TransactionCommitted and that either fails with TransactionCommitted or not fail for the same reason (the active txnNumber has changed).&lt;/li&gt;
&lt;/ol&gt;
</description>
                <environment></environment>
        <key id="2037457">SERVER-66110</key>
            <summary>Downgrading FCV can cause the active txnNumber on TransactionParticipant to change between session yielding and unyielding</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="cheahuychou.mao@mongodb.com">Cheahuychou Mao</assignee>
                                    <reporter username="cheahuychou.mao@mongodb.com">Cheahuychou Mao</reporter>
                        <labels>
                    </labels>
                <created>Mon, 2 May 2022 14:40:31 +0000</created>
                <updated>Sun, 29 Oct 2023 21:38:44 +0000</updated>
                            <resolved>Thu, 5 May 2022 00:44:25 +0000</resolved>
                                                    <fixVersion>6.0.0-rc5</fixVersion>
                    <fixVersion>6.1.0-rc0</fixVersion>
                                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="4527441" author="xgen-internal-githook" created="Thu, 5 May 2022 00:38:51 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Cheahuychou Mao&apos;, &apos;email&apos;: &apos;mao.cheahuychou@gmail.com&apos;, &apos;username&apos;: &apos;cheahuychou&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-66110&quot; title=&quot;Downgrading FCV can cause the active txnNumber on TransactionParticipant to change between session yielding and unyielding&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-66110&quot;&gt;&lt;del&gt;SERVER-66110&lt;/del&gt;&lt;/a&gt; Downgrading FCV can cause the active txnNumber on TransactionParticipant to change between session yielding and unyielding&lt;/p&gt;

&lt;p&gt;(cherry picked from commit 6d06540e287aefa96b8acabb72d5c879d43ad4e9)&lt;br/&gt;
Branch: v6.0&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/c21af7e992ac945f694e469adbd608e3e6081975&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/c21af7e992ac945f694e469adbd608e3e6081975&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="4527399" author="xgen-internal-githook" created="Wed, 4 May 2022 23:59:11 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Cheahuychou Mao&apos;, &apos;email&apos;: &apos;mao.cheahuychou@gmail.com&apos;, &apos;username&apos;: &apos;cheahuychou&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-66110&quot; title=&quot;Downgrading FCV can cause the active txnNumber on TransactionParticipant to change between session yielding and unyielding&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-66110&quot;&gt;&lt;del&gt;SERVER-66110&lt;/del&gt;&lt;/a&gt; Downgrading FCV can cause the active txnNumber on TransactionParticipant to change between session yielding and unyielding&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/6d06540e287aefa96b8acabb72d5c879d43ad4e9&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/6d06540e287aefa96b8acabb72d5c879d43ad4e9&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, 2 May 2022 19:20:42 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        1 year, 40 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_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, 40 weeks 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>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i0taxz:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|i0c89s:</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="5735">Sharding NYC 2022-05-16</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|i0sx3b:</customfieldvalue>

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