<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:55:04 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-40473] Using readPreference: secondary in multi-statement transaction returns NotMaster error with TransientTransactionError label</title>
                <link>https://jira.mongodb.org/browse/SERVER-40473</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;I just ran into the following scenario:&lt;br/&gt;
1) Start a transaction&lt;br/&gt;
2) Do an update. This targets shard A.&lt;br/&gt;
3) Send a find command with readPreference: secondary. This targets the &lt;b&gt;secondary&lt;/b&gt; of shard B.&lt;br/&gt;
4) NotMaster is returned with a TransientTransactionError.&lt;br/&gt;
5) The transaction gets retried over and over again with the same behavior.&lt;/p&gt;

&lt;p&gt;Our docs for readPreference say &quot;Multi-document transactions that contain read operations must use read preference primary.&quot; (&lt;a href=&quot;https://docs.mongodb.com/manual/core/read-preference/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://docs.mongodb.com/manual/core/read-preference/&lt;/a&gt;) but given the above scenario, I&apos;m wondering if we should do better and instead have the router throw some different, non-transient error if it notices that a statement in a multi-shard transaction is sent with readConcern: secondary. Alternatively the router could always upgrade the readPreference to be primary for commands running in a transaction.&lt;/p&gt;</description>
                <environment></environment>
        <key id="729701">SERVER-40473</key>
            <summary>Using readPreference: secondary in multi-statement transaction returns NotMaster error with TransientTransactionError label</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="12300">Won&apos;t Do</resolution>
                                        <assignee username="backlog-server-devplatform">[DO NOT ASSIGN] Backlog - Server Development Platform Team (SDP)</assignee>
                                    <reporter username="matthew.saltz@mongodb.com">Matthew Saltz</reporter>
                        <labels>
                            <label>sdp-backlog-purge</label>
                    </labels>
                <created>Thu, 4 Apr 2019 15:53:39 +0000</created>
                <updated>Mon, 19 Jun 2023 18:34:49 +0000</updated>
                            <resolved>Mon, 19 Jun 2023 18:34:48 +0000</resolved>
                                                                    <component>Sharding</component>
                                        <votes>0</votes>
                                    <watches>6</watches>
                                                                                                                <comments>
                            <comment id="5509946" author="JIRAUSER1268551" created="Mon, 19 Jun 2023 18:34:49 +0000"  >&lt;p&gt;This has been identified as work that the SDP team won&apos;t do in the near term. Please reopen with a comment if you feel this work should be reprioritized and explain why.&lt;/p&gt;</comment>
                            <comment id="4539789" author="steven.vannelli" created="Tue, 10 May 2022 21:24:04 +0000"  >&lt;p&gt;Moving this ticket to the Backlog and removing the &quot;Backlog&quot; fixVersion as per our latest policy for using fixVersions. &lt;/p&gt;</comment>
                            <comment id="2876454" author="jason.carey" created="Thu, 13 Feb 2020 14:30:47 +0000"  >&lt;p&gt;We believe this to be a bug in the driver in the shell that was added when the shell gained transaction support&lt;/p&gt;</comment>
                            <comment id="2215571" author="greg.mckeon" created="Tue, 16 Apr 2019 18:59:28 +0000"  >&lt;p&gt;Re-triaging, since we now know this is a shell bug.&lt;/p&gt;</comment>
                            <comment id="2215392" author="shane.harvey" created="Tue, 16 Apr 2019 17:56:18 +0000"  >&lt;p&gt;Looks like a bug in the shell. The transaction spec only allows primary read preference in a transaction:&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;transactions may only read from the primary. If a read is attempted and the transaction&#8217;s read preference is not Primary drivers MUST raise an error containing the string &quot;read preference in a transaction must be primary&quot;&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/specifications/blob/master/source/transactions/transactions.rst#readpreference&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/specifications/blob/master/source/transactions/transactions.rst#readpreference&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This behavior is &lt;a href=&quot;https://github.com/mongodb/specifications/blob/master/source/transactions/tests/read-pref.yml#L136-L168&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;tested here&lt;/a&gt; so we know that all drivers raise a client side error when attempting to read with a non-primary read preference.&lt;/p&gt;

&lt;p&gt;Please don&apos;t change the server to reject non-primary read preferences as that would repeat the regression fixed in &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-34557&quot; title=&quot;Allow running transactions against primaries with readPreferences other than &amp;#39;primary&amp;#39;&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-34557&quot;&gt;&lt;del&gt;SERVER-34557&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="2215342" author="matthew.saltz" created="Tue, 16 Apr 2019 17:33:39 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=shane.harvey&quot; class=&quot;user-hover&quot; rel=&quot;shane.harvey&quot;&gt;shane.harvey&lt;/a&gt; I was discussing this today with Andy and Aly and they thought that this may actually be a bug with the shell (which was being used when I encountered this issue), and that drivers normally handle this scenario already in a way that&apos;s reasonable. Do you know what the ordinary driver behavior is when a user sends readPreference: secondary for a command within a multi-statement transaction?&lt;/p&gt;</comment>
                            <comment id="2207455" author="matthew.saltz" created="Tue, 9 Apr 2019 22:47:56 +0000"  >&lt;p&gt;I believe the actual assert is coming from &lt;a href=&quot;https://github.com/mongodb/mongo/blob/408888993045ebf65e05f3fe6070d58580b774f8/src/mongo/db/service_entry_point_common.cpp#L687&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;, in service_entry_point_common, due to &lt;a href=&quot;https://github.com/mongodb/mongo/blob/408888993045ebf65e05f3fe6070d58580b774f8/src/mongo/db/command_can_run_here.cpp#L50&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;this check&lt;/a&gt; that makes sure multi-document transactions can&apos;t run on secondaries. The TransientTransactionError label then is attached &lt;a href=&quot;https://github.com/mongodb/mongo/blob/408888993045ebf65e05f3fe6070d58580b774f8/src/mongo/db/service_entry_point_common.cpp#L850&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt; when the aforementioned assert fails. getErrorLabels &lt;a href=&quot;https://github.com/mongodb/mongo/blob/408888993045ebf65e05f3fe6070d58580b774f8/src/mongo/db/handle_request_response.cpp#L47&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;calls into isTransientTransactionError&lt;/a&gt; which determines that a NotMaster error is indeed a TransientTransactionError.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="530642">SERVER-34557</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>7.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25130"><![CDATA[Server Development Platform]]></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>Thu, 4 Apr 2019 20:45:29 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        33 weeks, 2 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_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>DEVPROD-276</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>alex.neben@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            33 weeks, 2 days 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>backlog-server-devplatform</customfieldvalue>
            <customfieldvalue>alex.neben@mongodb.com</customfieldvalue>
            <customfieldvalue>greg.mckeon@mongodb.com</customfieldvalue>
            <customfieldvalue>matthew.saltz@mongodb.com</customfieldvalue>
            <customfieldvalue>mira.carey@mongodb.com</customfieldvalue>
            <customfieldvalue>shane.harvey@mongodb.com</customfieldvalue>
            <customfieldvalue>steven.vannelli@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hut0ev:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|huik3b:</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_10750" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Steps To Reproduce</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue></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|husmo7:</customfieldvalue>

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