<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:24:38 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>[DRIVERS-2063] Handle write errors differently depending on whether the outcome is known</title>
                <link>https://jira.mongodb.org/browse/DRIVERS-2063</link>
                <project id="10980" key="DRIVERS">Drivers</project>
                    <description>&lt;p&gt;When a driver attempts to send a write command to the server, there are circumstances in which it is always safe to retry, e.g. a server selection error, a DNS error, a network error while writing to the socket, or a server error such as NotMaster or InterruptedDueToShutdown. In other cases the write can only be retried if the write satisfies the criteria in the Retryable Writes Spec, e.g. a network error while awaiting the server reply.&lt;/p&gt;

&lt;p&gt;Consider improvements to driver error handling that accounts for the difference between these two categories of error.&lt;/p&gt;</description>
                <environment></environment>
        <key id="744153">DRIVERS-2063</key>
            <summary>Handle write errors differently depending on whether the outcome is known</summary>
                <type id="14901" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14700&amp;avatarType=issuetype">Spec Change</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="10038" iconUrl="https://jira.mongodb.org/images/icons/subtask.gif" description="">Backlog</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="jesse@mongodb.com">A. Jesse Jiryu Davis</reporter>
                        <labels>
                    </labels>
                <created>Wed, 24 Apr 2019 02:25:25 +0000</created>
                <updated>Tue, 25 Oct 2022 16:37:44 +0000</updated>
                                                                <component>Retryability</component>
                                        <votes>0</votes>
                                    <watches>6</watches>
                                                                                                                <comments>
                            <comment id="4926044" author="JIRAUSER1268808" created="Tue, 25 Oct 2022 16:37:39 +0000"  >&lt;p&gt;Leads Triage: Analysis looks good, but sending to the backlog since this doesn&apos;t seem urgent.&lt;/p&gt;</comment>
                            <comment id="4898406" author="JIRAUSER1258163" created="Wed, 12 Oct 2022 16:05:23 +0000"  >&lt;p&gt;Now that we have the &lt;tt&gt;NoWritesPerformed&lt;/tt&gt; error label added by the server (see &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-66116&quot; title=&quot;Aborted Read with MongoNotPrimaryException&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-66116&quot;&gt;SERVER-66116&lt;/a&gt;, &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-66479&quot; title=&quot;Create an error label indicating if a retryable error is &amp;quot;definite&amp;quot;.&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-66479&quot;&gt;&lt;del&gt;SERVER-66479&lt;/del&gt;&lt;/a&gt;, &lt;a href=&quot;https://jira.mongodb.org/browse/DRIVERS-2327&quot; title=&quot;Propagate Original Error for Write Errors Labeled NoWritesPerformed&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DRIVERS-2327&quot;&gt;DRIVERS-2327&lt;/a&gt;), we have a clear way of distinguishing definite (definitely not modified the data) and indefinite (might have modified the data) errors:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;any client error that happened before a client started sending bytes of a request to a server is a definite one&lt;sup&gt;1&lt;/sup&gt;;&lt;/li&gt;
	&lt;li&gt;any server error labeled with &lt;tt&gt;NoWritesPerformed&lt;/tt&gt; is a definite one&lt;sup&gt;2&lt;/sup&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Users may need to know when an error is definite, whether for the purpose of retrying in user code&lt;sup&gt;3&lt;/sup&gt; or for forming an expectation for reads, as in &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-66116&quot; title=&quot;Aborted Read with MongoNotPrimaryException&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-66116&quot;&gt;SERVER-66116&lt;/a&gt;, is irrelevant. We acknowledged both that users may need that info, and that we expect the info to be obtained by analyzing errors when we accepted &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-66116&quot; title=&quot;Aborted Read with MongoNotPrimaryException&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-66116&quot;&gt;SERVER-66116&lt;/a&gt; as a bug. Currently, there is no straightforward and robust way for users to decide whether errors are definite. Users have to analyze each error, possibly in a context of what the application is doing, to make a decision. Each application that does this, does this differently and likely introduces its own bugs in the process.&lt;/p&gt;

&lt;p&gt;We can relief users from this burden by documenting and exposing the &lt;tt&gt;NoWritesPerformed&lt;/tt&gt; label to them for server errors, and by providing a clear way to see if a client error is a definite one. One of the ways to do the latter is to add the &lt;tt&gt;NoWritesPerformed&lt;/tt&gt; label on definite client errors in the driver&lt;sup&gt;4&lt;/sup&gt;, this way users will have a single criterium for deciding whether an error is definite. It is possible, but not necessary the case, that some drivers expose client errors that are not specific to the driver. If there are such errors, then it is likely that a driver cannot attach to it information on whether it is a definite one without wrapping it in / replacing it with a driver-specific exception. The latter is likely a breaking change, which means that such exceptions will likely have to be left as is. Hopefully, this is not a common case.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;&lt;sup&gt;1&lt;/sup&gt; Care must be taken when dealing with retries: a client error happening after the first attempt and before sending a retry to the server can be considered definite only if the first attempt failed with a definite error.&lt;/p&gt;

&lt;p&gt;&lt;sup&gt;2&lt;/sup&gt; Note that &lt;a href=&quot;https://github.com/mongodb/mongo/commit/612dc47958777d5ca69216359cfe34c06bc66c64#diff-311e49fb621973d50c674e4b8f2a9dcf8899be8aa08681f810d48fc1c22d9241R159&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;currently&lt;/a&gt; &lt;tt&gt;NoWritesPerformed&lt;/tt&gt; is added by the server only to errors that are also labeled with &lt;tt&gt;RetryableWriteError&lt;/tt&gt; (thanks, &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=shane.harvey%40mongodb.com&quot; class=&quot;user-hover&quot; rel=&quot;shane.harvey@mongodb.com&quot;&gt;shane.harvey@mongodb.com&lt;/a&gt;, for finding this out). I don&apos;t think this will need to change if we decide to proceed with the idea expressed in this comment, as if there are currently definite server errors that are not labeled with &lt;tt&gt;RetryableWriteError&lt;/tt&gt;, then it is a bug, as they are trivially retryable.&lt;/p&gt;

&lt;p&gt;&lt;sup&gt;3&lt;/sup&gt; It is worth noting that driver retries that we currently have as well as user code retries that rely on the driver-provided information on whether errors are definite, are there not for safety reasons, but for performance reasons and better user experience. Users that have business operations that must eventually be done no matter what, will have to find ways to retry those business operations in user code regardless of whether drivers retry commands for them or whether errors are definite.&lt;/p&gt;

&lt;p&gt;&lt;sup&gt;4&lt;/sup&gt; Some client exceptions, e.g., &lt;a href=&quot;https://mongodb.github.io/mongo-java-driver/4.7/apidocs/mongodb-driver-core/com/mongodb/MongoConnectionPoolClearedException.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;MongoConnectionPoolClearedException&lt;/tt&gt;&lt;/a&gt;, &lt;a href=&quot;https://mongodb.github.io/mongo-java-driver/4.7/apidocs/mongodb-driver-core/com/mongodb/MongoTimeoutException.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;MongoTimeoutException&lt;/tt&gt;&lt;/a&gt; are always definite, others may be definite depending on the situation. This requires doing an analysis on the driver-side, but the benefit is that it is done once for all users, saving them from doing the same while having access to less info.&lt;/p&gt;</comment>
                            <comment id="2222840" author="jesse" created="Wed, 24 Apr 2019 03:01:11 +0000"  >&lt;p&gt;This idea was spun off from WRITING-3721 - we considered the possibility of changing which writes are retryable in that project, but it&apos;s not in scope there. Hence, make a new ticket.&lt;/p&gt;</comment>
                            <comment id="2222832" author="behackett" created="Wed, 24 Apr 2019 02:39:26 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=jesse&quot; class=&quot;user-hover&quot; rel=&quot;jesse&quot;&gt;jesse&lt;/a&gt;, can you provide some context for this ticket?&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                                        </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                                        </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                            <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_10951" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Driver Changes</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10748"><![CDATA[Needed]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hukvdj:</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>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        </customfields>
    </item>
</channel>
</rss>