<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:50:19 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-60624] txn_commit_optimizations_for_read_only_shards.js pauses replication on coordinator and can leave transaction stuck in prepare</title>
                <link>https://jira.mongodb.org/browse/SERVER-60624</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;&lt;b&gt;Context&lt;/b&gt;&lt;br/&gt;
The test &lt;b&gt;txn_commit_optimizations_for_read_only_shards.js&lt;/b&gt; runs transaction with the &lt;b&gt;coordinateCommitReturnImmediatelyAfterPersistingDecision&lt;/b&gt; server parameter enabled.&lt;/p&gt;

&lt;p&gt;This means that the commitTransaction command will return early as soon as the &lt;a href=&quot;https://github.com/mongodb/mongo/blob/dccba0661624787d8f398058928b7a29a31a2a86/src/mongo/db/s/transaction_coordinator.cpp#L279&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;_decisionPromise gets emplaced&lt;/a&gt; (either successfully or due to an error).&lt;/p&gt;

&lt;p&gt;This means that the next test case will be able to start before the TransactionCoordinator is finished with the existing transaction. Which is part of the coverage for this test.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;The problem&lt;/b&gt;&lt;br/&gt;
For certain test cases, the &lt;b&gt;beforeStatements&lt;/b&gt; function stops server replication. Meaning that the secondary stops applying oplogs.&lt;/p&gt;

&lt;p&gt;This results in the following being possible:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;txnNumber 51 starts. If the secondary falls behind the oplog. Then the opTime for &lt;b&gt;decisionPersisted&lt;/b&gt; hasn&apos;t been reached yet. But execution continues and the &lt;b&gt;_decisionPromise&lt;/b&gt; is emplaced.&lt;/li&gt;
	&lt;li&gt;The next test case starts for txnNumber 52 and replication is &lt;a href=&quot;https://github.com/10gen/mongo/blob/5b73e9d9102fc0c48d514ea43bfd0a8db9addc81/jstests/sharding/txn_commit_optimizations_for_read_only_shards.js#L293&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;completely stopped&lt;/a&gt;. This results in the existing transaction to be stuck &lt;a href=&quot;https://github.com/mongodb/mongo/blob/dccba0661624787d8f398058928b7a29a31a2a86/src/mongo/db/s/transaction_coordinator.cpp#L290&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;waiting for majority write concern&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;The new test case gets stuck waiting for txnNumber 51 to &lt;a href=&quot;https://github.com/10gen/mongo/blob/3caebc8d39c9e54916a7df5768c6ebd809861a39/src/mongo/db/service_entry_point_common.cpp#L874&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;exit the prepared state&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;Since the new test case can never finish (because txnNumber 52 is waiting for the previous one to exit the prepared state), replication is never restarted and txnNumber 51 can never finish.&lt;/li&gt;
	&lt;li&gt;This will cause the test to hang forever&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;Since the issue arises form the test stopping replication with the coordinateCommitReturnImmediatelyAfterPersistingDecision flag enabled, this is a test-only problem&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Proposed Solution&lt;/b&gt;&lt;br/&gt;
If either in the &lt;b&gt;cleanUp&lt;/b&gt; option available in the failureMode or in the for loop itself, we would wait for the existing transaction to finish before moving on to the next test then this problem wouldn&apos;t occur. As then, the new test case wouldn&apos;t be able to stop replication before the transaction was finished.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1896497">SERVER-60624</key>
            <summary>txn_commit_optimizations_for_read_only_shards.js pauses replication on coordinator and can leave transaction stuck in prepare</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="matt.boros@mongodb.com">Matt Boros</assignee>
                                    <reporter username="luis.osta@mongodb.com">Luis Osta</reporter>
                        <labels>
                            <label>neweng</label>
                            <label>sharding-nyc-subteam1</label>
                            <label>sharding-wfbf-day</label>
                    </labels>
                <created>Tue, 12 Oct 2021 16:47:05 +0000</created>
                <updated>Sun, 29 Oct 2023 21:47:30 +0000</updated>
                            <resolved>Wed, 29 Dec 2021 18:39:43 +0000</resolved>
                                                    <fixVersion>5.3.0</fixVersion>
                    <fixVersion>5.0.6</fixVersion>
                                    <component>Sharding</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="4271150" author="xgen-internal-githook" created="Thu, 30 Dec 2021 16:30:08 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Matt Boros&apos;, &apos;email&apos;: &apos;matt.boros@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-60624&quot; title=&quot;txn_commit_optimizations_for_read_only_shards.js pauses replication on coordinator and can leave transaction stuck in prepare&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-60624&quot;&gt;&lt;del&gt;SERVER-60624&lt;/del&gt;&lt;/a&gt; Use unique LSID for each test in txn_commit_optimizations_for_read_only_shards.js&lt;/p&gt;

&lt;p&gt;(cherry picked from commit 6e8beaab454ba83cf6123625de45bc0b22fb1079)&lt;br/&gt;
Branch: v5.0&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/c0f12d1a4c98e811b21233f6c8ff7df948056f76&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/c0f12d1a4c98e811b21233f6c8ff7df948056f76&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="4271111" author="xgen-internal-githook" created="Thu, 30 Dec 2021 16:04:46 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Matt Boros&apos;, &apos;email&apos;: &apos;matt.boros@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-60624&quot; title=&quot;txn_commit_optimizations_for_read_only_shards.js pauses replication on coordinator and can leave transaction stuck in prepare&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-60624&quot;&gt;&lt;del&gt;SERVER-60624&lt;/del&gt;&lt;/a&gt; Use unique LSID for each test in txn_commit_optimizations_for_read_only_shards.js&lt;/p&gt;

&lt;p&gt;(cherry picked from commit 6e8beaab454ba83cf6123625de45bc0b22fb1079)&lt;br/&gt;
Branch: v5.2&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/6f015837d63a2b9f672d78ae3feabff707cea96c&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/6f015837d63a2b9f672d78ae3feabff707cea96c&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="4257777" author="xgen-internal-githook" created="Fri, 17 Dec 2021 21:24:47 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Matt Boros&apos;, &apos;email&apos;: &apos;matt.boros@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-60624&quot; title=&quot;txn_commit_optimizations_for_read_only_shards.js pauses replication on coordinator and can leave transaction stuck in prepare&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-60624&quot;&gt;&lt;del&gt;SERVER-60624&lt;/del&gt;&lt;/a&gt; Use unique LSID for each test in txn_commit_optimizations_for_read_only_shards.js&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/6e8beaab454ba83cf6123625de45bc0b22fb1079&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/6e8beaab454ba83cf6123625de45bc0b22fb1079&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="4205763" author="max.hirschhorn@10gen.com" created="Mon, 22 Nov 2021 19:43:47 +0000"  >&lt;blockquote&gt;
&lt;p&gt;&lt;b&gt;Proposed Solution&lt;/b&gt;&lt;br/&gt;
If either in the &lt;b&gt;cleanUp&lt;/b&gt; option available in the failureMode or in the for loop itself, we would wait for the existing transaction to finish before moving on to the next test then this problem wouldn&apos;t occur. As then, the new test case wouldn&apos;t be able to stop replication before the transaction was finished.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Another thought here would be to give each test case a unique logical session ID to run with. This way each test won&apos;t need to wait for the cross&amp;#45;shard transaction from the previous test case to finish executing.&lt;/p&gt;</comment>
                            <comment id="4119383" author="JIRAUSER1253452" created="Tue, 12 Oct 2021 16:55:56 +0000"  >&lt;p&gt;The server parameter in question was introduced as part of &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-48060&quot; title=&quot;Make tests only set server parameter for making transaction coordinator return decision early if the shards are in latest binVersion&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-48060&quot;&gt;&lt;del&gt;SERVER-48060&lt;/del&gt;&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="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="1344946">SERVER-48060</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>5.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_12450" key="com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes">
                        <customfieldname>Backport Requested</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="22676"><![CDATA[v5.2]]></customfieldvalue>
    <customfieldvalue key="21777"><![CDATA[v5.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, 22 Nov 2021 19:43:47 +0000</customfieldvalue>

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


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_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, 5 weeks, 6 days ago
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_16465" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Linked BF Score</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>23.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>luis.osta@mongodb.com</customfieldvalue>
            <customfieldvalue>matt.boros@mongodb.com</customfieldvalue>
            <customfieldvalue>max.hirschhorn@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i05ekv:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hzux5r:</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="5227">Sharding 2021-12-13</customfieldvalue>
    <customfieldvalue id="5228">Sharding 2021-12-27</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_10555" key="com.atlassian.jira.plugin.system.customfieldtypes:float">
                        <customfieldname>Story Points</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2.0</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|i050q7:</customfieldvalue>

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