<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:13:13 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-6957] Replication Issues with Indexes</title>
                <link>https://jira.mongodb.org/browse/SERVER-6957</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;System:&lt;/p&gt;

&lt;p&gt;The system in place includes a Rails based application using MongoMapper as the interface to the db. The mongo instances include a Primary and Secondary with an arbiter on small VM.&lt;/p&gt;

&lt;p&gt;Background:&lt;/p&gt;

&lt;p&gt;We are using mongo to maintain a two lists of people that is the base of a checkout system. One collection named &quot;campaign_ID&quot; is the source of people the comprises the list of people who are available for a checkout. A second collection named &quot;available_ID&quot; maintains the same list of people but this collection is actually modified using a findAndRemove() call to remove the person who has been checked out.&lt;/p&gt;

&lt;p&gt;We were experiencing &quot;double checkouts&quot; caused by the same person being placed into the available_ID collection multiple times. The solution executed was to change the index on the collection to include :unique and :dropDups on the person_id attribute of the document. &lt;/p&gt;

&lt;p&gt;The solution appears to work properly has the count() and length of a distinct() match on both the available_ID and campaign_ID collections. &lt;br/&gt;
However, at some point during replication we are receiving a duplicate key error on the person_id index. The current work around we have employed is to reIndex() the collections on the Secondary, which results in dropping all indexes. Not an ideal situation for fail-over but it does allow the replication to begin working again and will eventually complete it&apos;s sync. &lt;/p&gt;

&lt;p&gt;A second situation that may have a part in producing the error may occur when these collections are &quot;refreshed&quot; on a nightly basis. This refresh happens through a rake task kicked off by a request to the Rails application. This task creates a temp_ID collection and then uses mongo_import to to fill the collection with fresh data. Indexes are created on this temp collection. The current collections are then renamed campaign_old_ID and available_old_ID and the temp are renamed the standard campaign_ID and available_ID.&lt;/p&gt;

&lt;p&gt;The Question: &lt;/p&gt;

&lt;p&gt;How can we eliminate the duplicate key error when replicating to the Secondary? What could cause an index to exist but not be respected on the Secondary server?&lt;/p&gt;


&lt;p&gt;The error message:&lt;/p&gt;

&lt;p&gt;syncThread: 11000 E11000 duplicate key error index: vcs.available_NV2301.$person_id_1  dup key: { : &quot;28FCCB8F-E05A-4B2A-9418-66F8194BBC2A&quot; }&lt;br/&gt;
syncThread: 11000 E11000 duplicate key error index: vcs.available_MD1898.$person_id_1  dup key: { : &quot;2A0F7EC6-B6EB-4A0B-AC56-F9BFC261EF40&quot; }&lt;/p&gt;

&lt;p&gt;The indexes on the collections:&lt;/p&gt;

&lt;p&gt;vcsrep:PRIMARY&amp;gt; db.available_NV2301.getIndexes();&lt;br/&gt;
[&lt;br/&gt;
    {&lt;br/&gt;
        &quot;name&quot; : &quot;&lt;em&gt;id&lt;/em&gt;&quot;,&lt;br/&gt;
        &quot;ns&quot; : &quot;vcs.available_NV2301&quot;,&lt;br/&gt;
        &quot;key&quot; : &lt;/p&gt;
{
            &quot;_id&quot; : 1
        }
&lt;p&gt;,&lt;br/&gt;
        &quot;v&quot; : 0&lt;br/&gt;
    },&lt;br/&gt;
    {&lt;br/&gt;
        &quot;name&quot; : &quot;loc_2d_after_-1&quot;,&lt;br/&gt;
        &quot;ns&quot; : &quot;vcs.available_NV2301&quot;,&lt;br/&gt;
        &quot;key&quot; : &lt;/p&gt;
{
            &quot;loc&quot; : &quot;2d&quot;,
            &quot;after&quot; : -1
        }
&lt;p&gt;    },&lt;br/&gt;
    {&lt;br/&gt;
        &quot;name&quot; : &quot;&lt;em&gt;id_1_after&lt;/em&gt;-1&quot;,&lt;br/&gt;
        &quot;ns&quot; : &quot;vcs.available_NV2301&quot;,&lt;br/&gt;
        &quot;key&quot; : &lt;/p&gt;
{
            &quot;_id&quot; : 1,
            &quot;after&quot; : -1
        }
&lt;p&gt;,&lt;br/&gt;
        &quot;v&quot; : 0&lt;br/&gt;
    },&lt;br/&gt;
    {&lt;br/&gt;
        &quot;name&quot; : &quot;person_id_1&quot;,&lt;br/&gt;
        &quot;ns&quot; : &quot;vcs.available_NV2301&quot;,&lt;br/&gt;
        &quot;key&quot; : &lt;/p&gt;
{
            &quot;person_id&quot; : 1
        }
&lt;p&gt;,&lt;br/&gt;
        &quot;unique&quot; : true,&lt;br/&gt;
        &quot;drop_dups&quot; : true,&lt;br/&gt;
        &quot;dropDups&quot; : true,&lt;br/&gt;
        &quot;v&quot; : 0&lt;br/&gt;
    }&lt;br/&gt;
]&lt;/p&gt;</description>
                <environment>CentOS 5.8</environment>
        <key id="49616">SERVER-6957</key>
            <summary>Replication Issues with Indexes</summary>
                <type id="6" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14720&amp;avatarType=issuetype">Question</type>
                                            <priority id="1" iconUrl="https://jira.mongodb.org/images/icons/priorities/blocker.svg">Blocker - P1</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="3">Duplicate</resolution>
                                        <assignee username="kristina">Kristina Chodorow</assignee>
                                    <reporter username="lzhadanovsky">Leo Zhadanovsky</reporter>
                        <labels>
                    </labels>
                <created>Thu, 6 Sep 2012 18:30:01 +0000</created>
                <updated>Fri, 15 Feb 2013 15:06:27 +0000</updated>
                            <resolved>Tue, 9 Oct 2012 13:48:07 +0000</resolved>
                                    <version>1.8.1</version>
                                                    <component>Index Maintenance</component>
                    <component>Replication</component>
                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="161758" author="kristina" created="Fri, 7 Sep 2012 19:54:33 +0000"  >&lt;p&gt;It sounds like you&apos;re probably hitting this: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-1086&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/SERVER-1086&lt;/a&gt;.  Is there any chance you can upgrade or not depend on dropDups?&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="11895">SERVER-1086</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 7 Sep 2012 19:54:33 +0000</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            11 years, 23 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_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>kristina</customfieldvalue>
            <customfieldvalue>lzhadanovsky</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrnpnb:</customfieldvalue>

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

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

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