<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 09:02:55 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>[JAVA-4775] Internal MongoWriteConcernWithResponseException is exposed to user code</title>
                <link>https://jira.mongodb.org/browse/JAVA-4775</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;This exception is just an implementation detail, and was never supposed to be thrown from public API methods. However, as far as I can tell, I exposed this exception as a result of &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-4034&quot; title=&quot;Refactor read/write retries to accommodate for both PoolClearedError and CSOT&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-4034&quot;&gt;&lt;del&gt;JAVA-4034&lt;/del&gt;&lt;/a&gt;. Specifically, it is exposed because of the changes in &lt;tt&gt;MixedBulkWriteOperation&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=jeff.yemin%40mongodb.com&quot; class=&quot;user-hover&quot; rel=&quot;jeff.yemin@mongodb.com&quot;&gt;jeff.yemin@mongodb.com&lt;/a&gt; noticed the problem when he was reviewing &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-4701&quot; title=&quot;Propagate Original Error for Write Errors Labeled NoWritesPerformed&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-4701&quot;&gt;&lt;del&gt;JAVA-4701&lt;/del&gt;&lt;/a&gt;, so the test added there can be used to debug the problem. I spent some time debugging in both the current driver version 4.8.0-SNAPSHOT, and in 4.3.4, where there is no problem. I did discover differences, but don&apos;t have a complete picture of how to solve fix the problem, i.e., I would need to spend more time. Here are the differences and issues I noticed:&lt;/p&gt;

&lt;ol&gt;
	&lt;li&gt;When running the test in 4.3.4, the test fails when executing this &lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/blob/r4.3.4/driver-core/src/main/com/mongodb/internal/operation/MixedBulkWriteOperation.java#L319&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;line&lt;/a&gt;, because the &lt;tt&gt;writeConcernError&lt;/tt&gt; document configured in the fail point does not have the &lt;tt&gt;errmsg&lt;/tt&gt; key, which is expected by &lt;tt&gt;WriteConcernHelper.createWriteConcernError&lt;/tt&gt;. The important part here is that 4.3.4 does not expose &lt;tt&gt;MongoWriteConcernWithResponseException&lt;/tt&gt;, and instead creates &lt;tt&gt;WriteConcernError&lt;/tt&gt; from it and adds it as a result to &lt;tt&gt;BulkWriteBatch&lt;/tt&gt;.&lt;/li&gt;
	&lt;li&gt;4.8.0-SNAPSHOT (and 4.4.0) appears to not always do this as the logic was moved to this &lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/blob/master/driver-core/src/main/com/mongodb/internal/operation/MixedBulkWriteOperation.java#L279-L280&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;place&lt;/a&gt;, which is executed on each retry except for the last attempt. This last part is unintentional and is different from the code in 4.3.4, where the logic in question gets to be executed on the last attempt.&lt;/li&gt;
	&lt;li&gt;Another difference I noticed, which is irrelevant to this particular bug, but may represent a different one, is this &lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/blob/master/driver-core/src/main/com/mongodb/internal/operation/MixedBulkWriteOperation.java#L377-L381&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;code&lt;/a&gt; in 4.8.0-SNAPSHOT. It does not have a counterpart in 4.3.4, &lt;tt&gt;addRetryableWriteErrorLabel&lt;/tt&gt; is called in 4.3.4 only &lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/blob/r4.3.4/driver-core/src/main/com/mongodb/internal/operation/MixedBulkWriteOperation.java#L306&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;, which we also do in 4.8.0-SNAPSHOT &lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/blob/master/driver-core/src/main/com/mongodb/internal/operation/MixedBulkWriteOperation.java#L367&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;. This difference may be caused by the code in 4.8.0-SNAPSHOT being agnostic of the maximum number of retries (it does only 2 per each &quot;next batch&quot;, but this limit is not hardcoded anywhere in the logic, as opposed to how it was in 4.3.4), but I fail to see how. At this moment I don&apos;t understand this code (not that I understand the rest of the code).&lt;/li&gt;
	&lt;li&gt;Another interesting difference is that &lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/blob/r4.3.4/driver-core/src/main/com/mongodb/internal/operation/MixedBulkWriteOperation.java#L310-L311&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;exceptions from &lt;tt&gt;executeCommand&lt;/tt&gt; are ignored&lt;/a&gt; in 4.3.4 on a retry of a batch, while &lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/blob/master/driver-core/src/main/com/mongodb/internal/operation/MixedBulkWriteOperation.java#L377-L381&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;not being ignored&lt;/a&gt; in 4.8.0-SNAPSHOT.&lt;/li&gt;
&lt;/ol&gt;
</description>
                <environment></environment>
        <key id="2159556">JAVA-4775</key>
            <summary>Internal MongoWriteConcernWithResponseException is exposed to user code</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="valentin.kovalenko@mongodb.com">Valentin Kavalenka</assignee>
                                    <reporter username="valentin.kovalenko@mongodb.com">Valentin Kavalenka</reporter>
                        <labels>
                    </labels>
                <created>Fri, 14 Oct 2022 20:17:43 +0000</created>
                <updated>Sat, 28 Oct 2023 11:20:33 +0000</updated>
                            <resolved>Tue, 22 Nov 2022 15:06:20 +0000</resolved>
                                    <version>4.4.0</version>
                                    <fixVersion>4.9.0</fixVersion>
                                    <component>Bulk API</component>
                    <component>Error Handling</component>
                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="5000624" author="xgen-internal-githook" created="Tue, 22 Nov 2022 15:05:26 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Valentin Kovalenko&apos;, &apos;email&apos;: &apos;valentin.kovalenko@mongodb.com&apos;, &apos;username&apos;: &apos;stIncMale&apos;}
&lt;p&gt;Message: Fix `MixedBulkWriteOperation` such that it does not leak `MongoWriteConcernWithResponseException` to users (#1051)&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-4775&quot; title=&quot;Internal MongoWriteConcernWithResponseException is exposed to user code&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-4775&quot;&gt;&lt;del&gt;JAVA-4775&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/3387038056635e37001af4d551dbc9a66de38513&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/3387038056635e37001af4d551dbc9a66de38513&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                        <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_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10257" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Documentation Changes</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="11861"><![CDATA[Not Needed]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr3mmh:0400000942rcii</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>