<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:19:25 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-28916] Make mongos automatically retry failed retryable writes</title>
                <link>https://jira.mongodb.org/browse/SERVER-28916</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;This task should be done once all the other machinery is in place and is to make mongos automatically retry writes on network or other retryable errors.&lt;/p&gt;</description>
                <environment></environment>
        <key id="376351">SERVER-28916</key>
            <summary>Make mongos automatically retry failed retryable writes</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="13201">Fixed</resolution>
                                        <assignee username="jack.mulrow@mongodb.com">Jack Mulrow</assignee>
                                    <reporter username="kaloian.manassiev@mongodb.com">Kaloian Manassiev</reporter>
                        <labels>
                    </labels>
                <created>Fri, 21 Apr 2017 19:13:52 +0000</created>
                <updated>Mon, 30 Oct 2023 23:17:17 +0000</updated>
                            <resolved>Tue, 7 Nov 2017 15:57:08 +0000</resolved>
                                                    <fixVersion>3.6.0-rc4</fixVersion>
                                    <component>Sharding</component>
                                        <votes>0</votes>
                                    <watches>7</watches>
                                                                                                                <comments>
                            <comment id="1719335" author="xgen-internal-githook" created="Tue, 7 Nov 2017 15:55:56 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Jack Mulrow&apos;, &apos;username&apos;: &apos;jsmulrow&apos;, &apos;email&apos;: &apos;jack.mulrow@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-28916&quot; title=&quot;Make mongos automatically retry failed retryable writes&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-28916&quot;&gt;&lt;del&gt;SERVER-28916&lt;/del&gt;&lt;/a&gt; Make mongos automatically retry failed retryable writes&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/3f51dc0165f5af762616185e4c219e89b886ccb4&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/3f51dc0165f5af762616185e4c219e89b886ccb4&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1715494" author="jmikola@gmail.com" created="Thu, 2 Nov 2017 15:41:57 +0000"  >&lt;blockquote&gt;&lt;p&gt;What if a new shard is 3.4, where lsid and txnNumber would merely be ignored by mongod?&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=kaloian.manassiev&quot; class=&quot;user-hover&quot; rel=&quot;kaloian.manassiev&quot;&gt;kaloian.manassiev&lt;/a&gt; clarified that a 3.6 mongos cannot communicate with a 3.4 mongod binary, so the above question is irrelevant.&lt;/p&gt;</comment>
                            <comment id="1715384" author="jmikola@gmail.com" created="Thu, 2 Nov 2017 14:31:54 +0000"  >&lt;blockquote&gt;&lt;p&gt;The driver should not be in the business of querying the cluster for whether retryable writes are supported or not. If retryWrites=true on the driver, the driver should unconditionally send the sessionId/txnNumber to the server and the server will decide what to do.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;That seems to be at odds with SPEC-980 and the goals of the product team. The driver is already deciding whether to include &lt;tt&gt;lsid&lt;/tt&gt; and &lt;tt&gt;txnNumber&lt;/tt&gt; and allow for retryable behavior based on the wire protocol version and presence of &lt;tt&gt;logicalSessionTimeoutMinutes&lt;/tt&gt; in &lt;tt&gt;isMaster&lt;/tt&gt;. Without such logic, we&apos;re prone to assuming a server before 3.6 supports retryable writes.&lt;/p&gt;

&lt;p&gt;If the driver unconditionally sends &lt;tt&gt;lsid&lt;/tt&gt; and &lt;tt&gt;txnNumber&lt;/tt&gt;, that exposes us to accidentally issuing a write twice in the event of a network error. Inferring whether the server actually supports retryable writes based on the information we have from &lt;tt&gt;isMaster&lt;/tt&gt; seems like the conservative, safe approach (no risk of executing a write twice), and also insulates applications from some errors.&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;For the scenario you described, in the absence of failing for FCV 3.4, the write will return a batch of responses, where some will be successful and some will have a ErrorCodes::NotSupported error code.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Given that &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-31777&quot; title=&quot;Explicitly deactivate logical sessions under FCV34&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-31777&quot;&gt;&lt;del&gt;SERVER-31777&lt;/del&gt;&lt;/a&gt; will ensure 3.6 servers in FCV 3.4 &lt;em&gt;do&lt;/em&gt; fail if they see &lt;tt&gt;lsid&lt;/tt&gt; and &lt;tt&gt;txnNumber&lt;/tt&gt;, I assume this is a non-issue if all servers are 3.6+. What if a new shard is 3.4, where &lt;tt&gt;lsid&lt;/tt&gt; and &lt;tt&gt;txnNumber&lt;/tt&gt; would merely be ignored by mongod?&lt;/p&gt;</comment>
                            <comment id="1715335" author="kaloian.manassiev" created="Thu, 2 Nov 2017 13:52:44 +0000"  >&lt;p&gt;The driver should not be in the business of querying the cluster for whether retryable writes are supported or not. If &lt;tt&gt;retryWrites=true&lt;/tt&gt; on the driver, the driver should unconditionally send the sessionId/txnNumber to the server and the server will decide what to do.&lt;/p&gt;

&lt;p&gt;For the scenario you described, in the absence of failing for FCV 3.4, the write will return a batch of responses, where some will be successful and some will have a &lt;tt&gt;ErrorCodes::NotSupported&lt;/tt&gt; error code.&lt;/p&gt;</comment>
                            <comment id="1715328" author="jmikola@gmail.com" created="Thu, 2 Nov 2017 13:39:45 +0000"  >&lt;p&gt;In SPEC-980, &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; proposed that we relax the driver behavior if &lt;tt&gt;retryWrites=true&lt;/tt&gt; and the cluster does not support sessions and retryable writes. Instead of raising an error to the user, we will simply leave the transaction ID out of a write command and forgo any retry logic (i.e. behave as if &lt;tt&gt;retryWrites=false&lt;/tt&gt;).&lt;/p&gt;

&lt;p&gt;Hypothetically, how will mongos operate when distributing a write across three shards, where two shards support retryable writes and the third does not? Will it pass on a transaction ID to the supported shards (and enable retry behavior for those) and omit the transaction ID and retry behavior for the third shard?&lt;/p&gt;

&lt;p&gt;I understand that sessions are intended to be cluster-wide and persist across all shards, but is it possible for the above topology to come about? Perhaps by:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Downgrading the feature compatibility mode of a replica set shard.&lt;/li&gt;
	&lt;li&gt;Adding a new shard to the cluster, which does not have 3.6 feature compatibility enabled.&lt;/li&gt;
&lt;/ul&gt;
</comment>
                            <comment id="1715102" author="kaloian.manassiev" created="Wed, 1 Nov 2017 23:25:57 +0000"  >&lt;p&gt;Based on a discussion with the drivers team, it appears that the SDAM retry spec only looks at the error message and does not peek inside the status of the individual batch entries. Because of this, an network error between mongos and a shard during the execution of a write batch will not be retried by the driver, because it will result in a response with an OK status, but an error batch entry.&lt;/p&gt;

&lt;p&gt;Because of this we should make the ARS &lt;a href=&quot;https://github.com/mongodb/mongo/blob/411df166ebc9d8883dc918b2550099ef8a678006/src/mongo/s/write_ops/batch_write_exec.cpp#L216&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt; use a &lt;tt&gt;kIdempotent&lt;/tt&gt; policy in case the request is retryable (i.e. contains a &lt;tt&gt;txnNumber&lt;/tt&gt;).&lt;/p&gt;

&lt;p&gt;As part of the implementation, we need to also write a unit-test &lt;a href=&quot;https://github.com/mongodb/mongo/blob/411df166ebc9d8883dc918b2550099ef8a678006/src/mongo/s/write_ops/batch_write_exec_test.cpp&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt; in order to ensure this works as expected.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <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="456311">SERVER-31873</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="453898">SERVER-31789</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>6.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>Thu, 2 Nov 2017 13:39:45 +0000</customfieldvalue>

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


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_14262" key="com.atlassian.jira.plugin.system.customfieldtypes:datepicker">
                        <customfieldname>End date</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Wed, 1 Nov 2017 00:00:00 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PM-257</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>false</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>
                            6 years, 14 weeks, 1 day ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>jack.mulrow@mongodb.com</customfieldvalue>
            <customfieldvalue>jmikola@mongodb.com</customfieldvalue>
            <customfieldvalue>kaloian.manassiev@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|ht676v:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hsygr3:</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="1956">Sharding 2017-11-13</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_14261" key="com.atlassian.jira.plugin.system.customfieldtypes:datepicker">
                        <customfieldname>Start date</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 21 Apr 2017 00:00:00 +0000</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|hs4a8v:</customfieldvalue>

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