<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:40:42 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-16337] WriteBatchExecutor&apos;s WriteConflictException not caught</title>
                <link>https://jira.mongodb.org/browse/SERVER-16337</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Steps to repro:&lt;br/&gt;
1. throw WriteConflictException() in IndexBulkBuilder::addKey()&lt;br/&gt;
2. run jstests/parallel/fsm_all.js (it breaks on indexed_insert_ordered_bulk.js)&lt;/p&gt;</description>
                <environment></environment>
        <key id="171469">SERVER-16337</key>
            <summary>WriteBatchExecutor&apos;s WriteConflictException not caught</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="9">Done</resolution>
                                        <assignee username="eliot">Eliot Horowitz</assignee>
                                    <reporter username="igor">Igor Canadi</reporter>
                        <labels>
                    </labels>
                <created>Wed, 26 Nov 2014 19:55:53 +0000</created>
                <updated>Mon, 2 Feb 2015 15:09:44 +0000</updated>
                            <resolved>Thu, 22 Jan 2015 17:18:02 +0000</resolved>
                                                    <fixVersion>3.0.0-rc6</fixVersion>
                                    <component>Storage</component>
                                        <votes>0</votes>
                                    <watches>12</watches>
                                                                                                                <comments>
                            <comment id="810736" author="xgen-internal-githook" created="Thu, 22 Jan 2015 17:17:45 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;erh&apos;, u&apos;name&apos;: u&apos;Eliot Horowitz&apos;, u&apos;email&apos;: u&apos;eliot@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-16337&quot; title=&quot;WriteBatchExecutor&amp;#39;s WriteConflictException not caught&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-16337&quot;&gt;&lt;del&gt;SERVER-16337&lt;/del&gt;&lt;/a&gt;: retry WriteConflictException on insert path&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/ab9ac2126075fec83c579113bc0c81ec08b797de&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/ab9ac2126075fec83c579113bc0c81ec08b797de&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="810561" author="eliot" created="Thu, 22 Jan 2015 15:25:08 +0000"  >&lt;p&gt;going to do this to make some things easier at various layers&lt;/p&gt;</comment>
                            <comment id="779773" author="leifwalsh" created="Fri, 5 Dec 2014 19:31:45 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=igor&quot; class=&quot;user-hover&quot; rel=&quot;igor&quot;&gt;igor&lt;/a&gt; yep, us too: &lt;a href=&quot;https://github.com/leifwalsh/mongo/commit/44fee88&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/leifwalsh/mongo/commit/44fee88&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="779288" author="igor" created="Fri, 5 Dec 2014 06:03:47 +0000"  >&lt;p&gt;Rocks implementation is currently fixing that by not throwing false-positive WCE and returning dupKeyError when we detect write-write conflict in Index insert (both with committed and uncommitted transactions). Patch is here: &lt;a href=&quot;https://github.com/mongodb-partners/mongo/commit/543e5d812fe1ba396ce5db127686808e2f25ff60&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb-partners/mongo/commit/543e5d812fe1ba396ce5db127686808e2f25ff60&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We&apos;re trying to do &apos;whatever wiredtiger does&apos; for our storage engine behavior to avoid being blocked on waiting for mongo&apos;s higher level code changes. We might rethink our design if the conditions change.&lt;/p&gt;</comment>
                            <comment id="779227" author="leifwalsh" created="Fri, 5 Dec 2014 03:44:15 +0000"  >&lt;p&gt;What&apos;s the resolution on this?  If it really is the case that inserts never conflict, such a retry loop would be free, and it makes it easier to reason about the storage engine if we don&apos;t have to worry about when it is or isn&apos;t safe to throw a WriteConflictException.  Plus, it prevents false positive duplicate key errors.  Seems like a tie-win-win.  I&apos;m not sure what towel-throwing is involved here.&lt;/p&gt;</comment>
                            <comment id="775275" author="sdong" created="Mon, 1 Dec 2014 18:13:48 +0000"  >&lt;p&gt;Eliot, can we throw dupKeyError when there is not duplicated key as a false positive case? Currently we implement in a way to hash keys to fixed number of shared buckets to detect conflicts. If we can throw dupKeyError in those false conflicts, it will be more convenient for us.&lt;/p&gt;</comment>
                            <comment id="775121" author="igor" created="Mon, 1 Dec 2014 16:25:23 +0000"  >&lt;p&gt;Ok, we can return DuplicateKey when there is a conflict with uncommitted transaction. I found this in the WiredTiger code:&lt;/p&gt;

&lt;p&gt;         if ( ret == WT_ROLLBACK &amp;amp;&amp;amp; !dupsAllowed ) &lt;/p&gt;
{
            // if there is a conflict on a unique key, it means there is a dup key
            // even if someone else is deleting at the same time, its ok to fail this
            // insert as a dup key as it a race
            return dupKeyError(key);
        }


&lt;p&gt;Since this seems to be the only correct behavior at this point, would it make sense to write a unit test for this? It&apos;s much easier to debug a small unit test failure rather than integration test with 30 concurrent threads. We would also greatly appreciate unit tests for other tricky behaviors that are not clearly documented.&lt;/p&gt;</comment>
                            <comment id="774538" author="eliot" created="Sat, 29 Nov 2014 02:42:40 +0000"  >&lt;p&gt;I&apos;m not sure it makes sense.&lt;br/&gt;
We&apos;ve gone to some great lengths to make sure inserts don&apos;t conflict and that has some really nice properties.&lt;br/&gt;
Not ready to just throw in the towel on that, certainly not at this moment.&lt;/p&gt;</comment>
                            <comment id="774420" author="igor" created="Fri, 28 Nov 2014 16:10:01 +0000"  >&lt;p&gt;I think we would still like to throw WriteConflictException() in Index::insert (for unique indexes). There are few reasons:&lt;br/&gt;
1. Our current implementation isn&apos;t exact when throwing WriteConflictException. We shard the written keys and we throw if there&apos;s a conflict in shards. While DuplicateKey error needs to be correct, WriteConflictException just means re-try again, which impacts performance instead of correctness, right?&lt;br/&gt;
2. Returning DuplicateKey for a conflict in uncommitted transaction also doesn&apos;t feel right. I would much rather throw WriteConflictException in that case.&lt;/p&gt;

&lt;p&gt;Does this make sense?&lt;/p&gt;</comment>
                            <comment id="774245" author="igor" created="Fri, 28 Nov 2014 02:39:44 +0000"  >&lt;p&gt;Should index insert return duplicate key exception even when the duplicate&lt;br/&gt;
key is in uncommitted transaction?&lt;br/&gt;
On Thu, Nov 27, 2014 at 9:30 PM Eliot Horowitz (JIRA) &amp;lt;jira@mongodb.org&amp;gt;&lt;/p&gt;
</comment>
                            <comment id="774243" author="eliot" created="Fri, 28 Nov 2014 02:29:20 +0000"  >&lt;p&gt;I don&apos;t believe that catching WriteConflictException in insert should be needed.&lt;br/&gt;
The only case where anything should touch the same keys is unique keys, and those need to return a duplicate key exception, not a write conflict exception.&lt;/p&gt;</comment>
                            <comment id="774238" author="igor" created="Fri, 28 Nov 2014 02:15:59 +0000"  >&lt;p&gt;Eliot &amp;#8211; I originally misattributed the error to IndexBulkBuilder, but the actual error was in BulkExecutor. I fixed the problem by adding `catch(WriteConflictException)` here: &lt;a href=&quot;https://github.com/mongodb/mongo/blob/16a8ef7ad60d498b69bdc0ad5cbca44757d16fd8/src/mongo/db/commands/write_commands/batch_executor.cpp#L1060&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/blob/16a8ef7ad60d498b69bdc0ad5cbca44757d16fd8/src/mongo/db/commands/write_commands/batch_executor.cpp#L1060&lt;/a&gt;, but not sure if that&apos;s the right solution. I&apos;m wondering how wiredtiger doesn&apos;t fail this.&lt;/p&gt;</comment>
                            <comment id="773842" author="eliot" created="Thu, 27 Nov 2014 01:46:03 +0000"  >&lt;p&gt;why would there even be a conflict in bulk building?&lt;br/&gt;
The only case that i&apos;ve seen is duplicate keys, and those should throw duplicate key exceptions, not WriteConflictExceptions&lt;/p&gt;</comment>
                            <comment id="773776" author="igor" created="Wed, 26 Nov 2014 22:20:59 +0000"  >&lt;p&gt;I think `catch WriteConflictException()` needs to be added here: &lt;a href=&quot;https://github.com/mongodb/mongo/blob/16a8ef7ad60d498b69bdc0ad5cbca44757d16fd8/src/mongo/db/commands/write_commands/batch_executor.cpp#L1060&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/blob/16a8ef7ad60d498b69bdc0ad5cbca44757d16fd8/src/mongo/db/commands/write_commands/batch_executor.cpp#L1060&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="773724" author="igor" created="Wed, 26 Nov 2014 21:40:30 +0000"  >&lt;p&gt;Sorry, this seems to be WriteBatchExecutor&apos;s code path rather than IndexBulkBuilder::addKey(). More specifically, I think this is the trace:&lt;/p&gt;

&lt;p&gt; mongod(_ZN5mongo19RocksSortedDataImpl6insertEPNS_16OperationContextERKNS_7BSONObjERKNS_7DiskLocEb+0x538) &lt;span class=&quot;error&quot;&gt;&amp;#91;0xd77278&amp;#93;&lt;/span&gt;&lt;br/&gt;
 mongod(_ZN5mongo22BtreeBasedAccessMethod6insertEPNS_16OperationContextERKNS_7BSONObjERKNS_7DiskLocERKNS_19InsertDeleteOptionsEPl+0x193) &lt;span class=&quot;error&quot;&gt;&amp;#91;0xab54f3&amp;#93;&lt;/span&gt;&lt;br/&gt;
 mongod(_ZN5mongo12IndexCatalog12_indexRecordEPNS_16OperationContextEPNS_17IndexCatalogEntryERKNS_7BSONObjERKNS_7DiskLocE+0x6E) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x96269e&amp;#93;&lt;/span&gt;&lt;br/&gt;
 mongod(_ZN5mongo12IndexCatalog11indexRecordEPNS_16OperationContextERKNS_7BSONObjERKNS_7DiskLocE+0x56) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x9629b6&amp;#93;&lt;/span&gt;&lt;br/&gt;
 mongod(_ZN5mongo10Collection15_insertDocumentEPNS_16OperationContextERKNS_7BSONObjEb+0xB3) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x950843&amp;#93;&lt;/span&gt;&lt;br/&gt;
 mongod(_ZN5mongo10Collection14insertDocumentEPNS_16OperationContextERKNS_7BSONObjEb+0x70) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x951e30&amp;#93;&lt;/span&gt;&lt;br/&gt;
 mongod(_ZN5mongo18WriteBatchExecutor13execOneInsertEPNS0_16ExecInsertsStateEPPNS_16WriteErrorDetailE+0x28F) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x9ebc6f&amp;#93;&lt;/span&gt;&lt;br/&gt;
 mongod(_ZN5mongo18WriteBatchExecutor11execInsertsERKNS_21BatchedCommandRequestEPSt6vectorIPNS_16WriteErrorDetailESaIS6_EE+0x250) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x9ec180&amp;#93;&lt;/span&gt;&lt;br/&gt;
 mongod(_ZN5mongo18WriteBatchExecutor11bulkExecuteERKNS_21BatchedCommandRequestEPSt6vectorIPNS_19BatchedUpsertDetailESaIS6_EEPS4_IPNS_16WriteErrorDetailESaISB_EE+0x34) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x9ed544&amp;#93;&lt;/span&gt;&lt;br/&gt;
 mongod(_ZN5mongo18WriteBatchExecutor12executeBatchERKNS_21BatchedCommandRequestEPNS_22BatchedCommandResponseE+0x3A5) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x9edc55&amp;#93;&lt;/span&gt;&lt;br/&gt;
 mongod(_ZN5mongo8WriteCmd3runEPNS_16OperationContextERKSsRNS_7BSONObjEiRSsRNS_14BSONObjBuilderEb+0x169) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x9efdb9&amp;#93;&lt;/span&gt;&lt;br/&gt;
 mongod(_ZN5mongo12_execCommandEPNS_16OperationContextEPNS_7CommandERKSsRNS_7BSONObjEiRSsRNS_14BSONObjBuilderEb+0x34) &lt;span class=&quot;error&quot;&gt;&amp;#91;0xa09d04&amp;#93;&lt;/span&gt;&lt;br/&gt;
 mongod(_ZN5mongo7Command11execCommandEPNS_16OperationContextEPS0_iPKcRNS_7BSONObjERNS_14BSONObjBuilderEb+0xC25) &lt;span class=&quot;error&quot;&gt;&amp;#91;0xa0ab65&amp;#93;&lt;/span&gt;&lt;br/&gt;
 mongod(_ZN5mongo12_runCommandsEPNS_16OperationContextEPKcRNS_7BSONObjERNS_11_BufBuilderINS_16TrivialAllocatorEEERNS_14BSONObjBuilderEbi+0x2A2) &lt;span class=&quot;error&quot;&gt;&amp;#91;0xa0b6d2&amp;#93;&lt;/span&gt;&lt;br/&gt;
 mongod(_ZN5mongo11newRunQueryEPNS_16OperationContextERNS_7MessageERNS_12QueryMessageERNS_5CurOpES3_b+0x75A) &lt;span class=&quot;error&quot;&gt;&amp;#91;0xbec07a&amp;#93;&lt;/span&gt;&lt;br/&gt;
 mongod(_ZN5mongo16assembleResponseEPNS_16OperationContextERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortEb+0xB15) &lt;span class=&quot;error&quot;&gt;&amp;#91;0xae24a5&amp;#93;&lt;/span&gt;&lt;br/&gt;
 mongod(_ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE+0xE0) &lt;span class=&quot;error&quot;&gt;&amp;#91;0x84c260&amp;#93;&lt;/span&gt;&lt;br/&gt;
 mongod(_ZN5mongo17PortMessageServer17handleIncomingMsgEPv+0x411) &lt;span class=&quot;error&quot;&gt;&amp;#91;0xf14dd1&amp;#93;&lt;/span&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10220">
                    <name>Tested</name>
                                            <outwardlinks description="tested by">
                                                        </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>15.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, 27 Nov 2014 01:46:03 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        9 years, 3 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_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>atul.kachru</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            9 years, 3 weeks, 6 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>eliot</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>igor</customfieldvalue>
            <customfieldvalue>leifwalsh</customfieldvalue>
            <customfieldvalue>sdong</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrlhu7:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hs4bfj:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>150130</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_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|hrq9vj:</customfieldvalue>

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