<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:54:20 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-40201] Retrying commit on original router after a read only commit incorrectly uses two phase commit</title>
                <link>https://jira.mongodb.org/browse/SERVER-40201</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;To enable read only commit optimizations, shard responses to transaction commands contain a &lt;tt&gt;readOnly&lt;/tt&gt; boolean field that is true if the shard&apos;s local transaction &lt;a href=&quot;https://github.com/mongodb/mongo/blob/c8120ddaf8a8bd9da9c8095165a4df485d5a58c9/src/mongo/db/transaction_participant.cpp#L1064-L1065&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;is &quot;in-progress&quot; and has applied no operations that would be written to the oplog&lt;/a&gt;. While running a sharded transaction, &lt;a href=&quot;https://github.com/mongodb/mongo/blob/c8120ddaf8a8bd9da9c8095165a4df485d5a58c9/src/mongo/s/multi_statement_transaction_requests_sender.cpp#L68&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;mongos tracks which shards have ever returned &lt;tt&gt;readOnly=false&lt;/tt&gt;&lt;/a&gt; and will &lt;a href=&quot;https://github.com/mongodb/mongo/blob/c8120ddaf8a8bd9da9c8095165a4df485d5a58c9/src/mongo/s/transaction_router.cpp#L802-L804&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;skip two phase commit if no participants ever did&lt;/a&gt;, sending commitTransaction directly to each shard instead.&lt;/p&gt;

&lt;p&gt;After committing however, a shard will fail the in-progress condition, so its commit response contains &lt;tt&gt;readOnly=false&lt;/tt&gt;, leading the router to mark the participant as not read only. This means if the client retries commit against the original mongos, the router will no longer believe the transaction is read only, so it sends coordinateCommit to the coordinator, which will try to drive a two phase commit. This will fail during phase one if any participants already committed the txnId, because the coordinator receives &lt;tt&gt;TransactionCommitted&lt;/tt&gt; as their prepare response and retries sending prepare until timing out.&lt;/p&gt;

&lt;p&gt;This is especially a problem for failover testing, because a stepdown on any shard during read only commit will lead the shell to retry commitTransaction (because it is treated as a retryable write), which stalls until the coordinator times out if any other shard successfully committed.&lt;/p&gt;</description>
                <environment></environment>
        <key id="718925">SERVER-40201</key>
            <summary>Retrying commit on original router after a read only commit incorrectly uses two phase commit</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="esha.maharishi@mongodb.com">Esha Maharishi</assignee>
                                    <reporter username="jack.mulrow@mongodb.com">Jack Mulrow</reporter>
                        <labels>
                    </labels>
                <created>Mon, 18 Mar 2019 22:23:07 +0000</created>
                <updated>Sun, 29 Oct 2023 22:22:51 +0000</updated>
                            <resolved>Wed, 20 Mar 2019 19:11:27 +0000</resolved>
                                                    <fixVersion>4.1.10</fixVersion>
                                    <component>Sharding</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="2186552" author="xgen-internal-githook" created="Wed, 20 Mar 2019 19:10:49 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;email&apos;: &apos;esha.maharishi@mongodb.com&apos;, &apos;name&apos;: &apos;Esha Maharishi&apos;, &apos;username&apos;: &apos;EshaMaharishi&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-40201&quot; title=&quot;Retrying commit on original router after a read only commit incorrectly uses two phase commit&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-40201&quot;&gt;&lt;del&gt;SERVER-40201&lt;/del&gt;&lt;/a&gt; Retrying commit on original router after a read only commit incorrectly uses two phase commit&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/1d8d992f2fef6db349a11893da4f2bf52c39dc86&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/1d8d992f2fef6db349a11893da4f2bf52c39dc86&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2184949" author="jack.mulrow" created="Tue, 19 Mar 2019 15:50:52 +0000"  >&lt;p&gt;I agree both of those approaches should work. I originally thought the easiest fix is to allow participants to return readOnly=true even if they are not in the kInProgress state so committing/aborting a read-only transaction doesn&apos;t make a participant no longer read-only, but it turns out participants &lt;a href=&quot;https://github.com/mongodb/mongo/blob/751ac6e4692ebe5a5026d96596ca4cffd40f8ffa/src/mongo/db/transaction_participant.cpp#L1189&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;clear their transaction operations on commit&lt;/a&gt;, so we&apos;d have to change how participants track whether they&apos;re read-only, which is possible but probably overkill.&lt;/p&gt;

&lt;p&gt;So that said, I&apos;m fine with either option.&lt;/p&gt;</comment>
                            <comment id="2184484" author="esha.maharishi@10gen.com" created="Mon, 18 Mar 2019 23:03:20 +0000"  >&lt;p&gt;Hmm. I think we could get around this by either&lt;/p&gt;

&lt;p&gt;1) having committing the read-only transaction use the ARS directly rather than the MRS - this way, the participants readOnly fields will not be updated with the response from commit&lt;/p&gt;

&lt;p&gt;2) TransactionRouter::processParticipantResponse should be a noop if commit has been received. We could do this by changing the TransactionRouter::_initaitedTwoPhaseCommit bool to just TransactionRouter::_initiatedCommit and checking the bool in processParticipantPresponse.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                        <issuelink>
            <issuekey id="711063">SERVER-39991</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>3.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_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, 18 Mar 2019 23:03:20 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        4 years, 47 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_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PM-564</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>
                            4 years, 47 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>esha.maharishi@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|hur633:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr7pcv:</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="2825">Sharding 2019-03-25</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|huqscf:</customfieldvalue>

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