<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:06:34 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-4639] update yielding with upsert can duplicate a document</title>
                <link>https://jira.mongodb.org/browse/SERVER-4639</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;if 2 threads are accessing the same document, and 1 thread moves the document &quot;back&quot; the 2nd thread can miss it&lt;/p&gt;</description>
                <environment></environment>
        <key id="27855">SERVER-4639</key>
            <summary>update yielding with upsert can duplicate a document</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="eliot">Eliot Horowitz</reporter>
                        <labels>
                    </labels>
                <created>Fri, 6 Jan 2012 17:39:20 +0000</created>
                <updated>Mon, 11 Jul 2016 18:33:41 +0000</updated>
                            <resolved>Wed, 18 Jan 2012 16:32:00 +0000</resolved>
                                                    <fixVersion>2.1.0</fixVersion>
                                    <component>Concurrency</component>
                    <component>Write Ops</component>
                                        <votes>0</votes>
                                    <watches>5</watches>
                                                                                                                <comments>
                            <comment id="166720" author="ian@10gen.com" created="Fri, 21 Sep 2012 14:42:15 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=litaopier&quot; class=&quot;user-hover&quot; rel=&quot;litaopier&quot;&gt;litaopier&lt;/a&gt; as this ticket is closed, can you please open up a separate SERVER ticket so that we can debug with you and see if the problem is still outstanding?&lt;/p&gt;</comment>
                            <comment id="166616" author="litaopier" created="Fri, 21 Sep 2012 06:27:58 +0000"  >&lt;p&gt;db version v2.0.5&lt;/p&gt;

&lt;p&gt;using strom, the threads(also in different process) run code : myDB(&quot;mytable&quot;).update(DBObject(&quot;key1&quot; -&amp;gt; new ObjectId(myKey), &quot;key2&quot; -&amp;gt; coKey), myUpdates, true, false, WriteConcern.SAFE)&lt;/p&gt;

&lt;p&gt;although the possibility is quite low, say, I use storm to &lt;font color=&quot;red&quot;&gt; upsert around 60k records, and 4 duplicated appeared&lt;/font&gt;, most of their behavior is as what we expected.&lt;br/&gt;
I run my code several times, and each time the duplicated record is random both in content or number, say (2-10)&lt;/p&gt;

&lt;p&gt;I checked this issue, it seems that what we described is probably the same thing.&lt;br/&gt;
So I &lt;font color=&quot;red&quot;&gt;DO upgrade to v2.2, and restart my DB,&lt;/font&gt; run my case, still I get 1-3 duplicated record.&lt;/p&gt;

&lt;p&gt;the following is the related DB log:&lt;br/&gt;
Fri Sep 21 13:18:57 &lt;span class=&quot;error&quot;&gt;&amp;#91;initandlisten&amp;#93;&lt;/span&gt; MongoDB starting : pid=32671 port=27017 dbpath=/home/myuser/mydb 64-bit host=mymachine&lt;br/&gt;
Fri Sep 21 13:18:57 &lt;span class=&quot;error&quot;&gt;&amp;#91;initandlisten&amp;#93;&lt;/span&gt;&lt;font color=&quot;red&quot;&gt;  db version v2.2.0&lt;/font&gt;, pdfile version 4.5&lt;/p&gt;

&lt;p&gt;....&lt;br/&gt;
 Fri Sep 21 13:35:29 &lt;span class=&quot;error&quot;&gt;&amp;#91;conn196&amp;#93;&lt;/span&gt; update mydb.mytable query: &lt;/p&gt;
{ key1: &quot;k12306&quot;, key2: &quot;k86&quot; }
&lt;p&gt; update: &lt;/p&gt;
{ field1: &quot;f1&quot;, field2: &quot;f2&quot; }
&lt;p&gt; nscanned:3341 nupdated:1 upsert:1 keyUpdates:0 numYields: 26 locks(micros) w:7033 333ms&lt;br/&gt;
...&lt;br/&gt;
 Fri Sep 21 13:35:29 &lt;span class=&quot;error&quot;&gt;&amp;#91;conn192&amp;#93;&lt;/span&gt; update mydb.mytable query: &lt;/p&gt;
{ key1: &quot;k12306&quot;, key2: &quot;k86&quot; }
&lt;p&gt; update: &lt;/p&gt;
{ field1: &quot;f1&quot;, field2: &quot;f2&quot; }
&lt;p&gt; nscanned:3343 nupdated:1 upsert:1 keyUpdates:0 numYields: 26 locks(micros) w:6906 335ms&lt;br/&gt;
....&lt;/p&gt;

&lt;p&gt;we can see that the commands which cause duplicated records is shown above.&lt;/p&gt;

&lt;p&gt;other conditions are:&lt;br/&gt;
a) when mytable is with index on db.mytable.ensureIndex(&lt;/p&gt;
{&quot;key1&quot;:1, &quot;key2&quot;:1}
&lt;p&gt;), it works ok, no duplicated record generated.&lt;br/&gt;
b) when mytable is without any index, which will cause every mongo command cost much longer time, bang~, the duplicated records appeared..&lt;/p&gt;

&lt;p&gt;any idea?&lt;/p&gt;

&lt;p&gt;I&apos;m wondering whether this bug is fixed thoroughly.&lt;/p&gt;</comment>
                            <comment id="78275" author="auto" created="Fri, 6 Jan 2012 22:29:33 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;login&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: using PageFaultException in various places in update &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-4639&quot; title=&quot;update yielding with upsert can duplicate a document&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-4639&quot;&gt;&lt;del&gt;SERVER-4639&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/e39d2a7372460e3cdbf7e8e4601531bc73ccb712&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/e39d2a7372460e3cdbf7e8e4601531bc73ccb712&lt;/a&gt;&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="51516">SERVER-7170</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="18948">SERVER-3357</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>3.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 6 Jan 2012 22:29:33 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        11 years, 21 weeks, 5 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>ramon.fernandez@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            11 years, 21 weeks, 5 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Old_Backport</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10000"><![CDATA[No]]></customfieldvalue>

                        </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>auto</customfieldvalue>
            <customfieldvalue>eliot</customfieldvalue>
            <customfieldvalue>ian@mongodb.com</customfieldvalue>
            <customfieldvalue>litaopier</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrohhb:</customfieldvalue>

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

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

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