<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:22:09 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-10058] Possible race condition with ensureIndex (text only?)</title>
                <link>https://jira.mongodb.org/browse/SERVER-10058</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Today I encountered a situation where a brand new (test) database had become corrupted. I realized too late that I should have saved the state for analysis. Here&apos;s roughly what happened:&lt;/p&gt;

&lt;p&gt;Configured the mongod to enableTextSearch.&lt;br/&gt;
Used mongorestore to populate the database with data from another database (1546 docs with 19MB of data).&lt;br/&gt;
Used an application deployment system similar to Heroku (Velociraptor) to deploy two instances of the app against this database. During startup, this app runs the following:&lt;/p&gt;

&lt;p&gt;coll.ensure_index(&lt;span class=&quot;error&quot;&gt;&amp;#91;(&amp;#39;qsl&amp;#39;, &amp;#39;text&amp;#39;)&amp;#93;&lt;/span&gt;, background=True)&lt;/p&gt;

&lt;p&gt;On a collection in that restored db.&lt;/p&gt;

&lt;p&gt;When I tried to query the text index, I got an error indicating a problem because there was &quot;more than one text index&quot; (I&apos;m unsure about the wording).&lt;/p&gt;

&lt;p&gt;I thought, &quot;how weird,&quot; queried the collection for its indexes and sure enough, it had two copies of the /exact same index/ (name, type, etc).&lt;/p&gt;

&lt;p&gt;So I removed it, and the remove operation succeeded. Just one remove and both manifestations were gone. Great, I thought, problem solved, but I was wrong.&lt;/p&gt;

&lt;p&gt;Subsequently, whenever I tried to start the app (which would recreate the index), I got the same error reported here (&lt;a href=&quot;https://groups.google.com/forum/#!topic/mongodb-user/5xNYJVJdp5c&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://groups.google.com/forum/#!topic/mongodb-user/5xNYJVJdp5c&lt;/a&gt;). Basically, it seems my database was corrupted.&lt;/p&gt;

&lt;p&gt;That&apos;s when I dropped the database and started again. This time, instead of starting the two apps in parallel, I only started one locally (so ensureIndex would have been called once first), and everything seems to be running swimmingly.&lt;/p&gt;

&lt;p&gt;Here&apos;s what I suspect happened:&lt;br/&gt;
1. When the two app instances started up, they each invoked ensure_index at roughly the same time.&lt;br/&gt;
2. MongoD performed the test for the existence on each request and failed on both.&lt;br/&gt;
3. MongoD created the identical index in duplicate.&lt;br/&gt;
4. MongoD corrupted the database when removing the index.&lt;/p&gt;

&lt;p&gt;Alternatively, I am using pymongo 2.4.2, which is somewhat dated, and could be implicated.&lt;/p&gt;

&lt;p&gt;In any case, mongod is almost certainly implicated here.&lt;/p&gt;

&lt;p&gt;I would be shocked if this issue existed for standard indexes. I&apos;m guessing that text indexes are somehow implicated (perhaps bypassing checks that standard indexes using).&lt;/p&gt;

&lt;p&gt;I&apos;m reporting this here because I wanted to capture the issue while I still remember the details. I invite others to investigate further.&lt;/p&gt;</description>
                <environment>mongodb 2.4.4; pymongo 2.4.2</environment>
        <key id="80732">SERVER-10058</key>
            <summary>Possible race condition with ensureIndex (text only?)</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="3">Duplicate</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="jason.coombs@yougov.com">Jason R. Coombs</reporter>
                        <labels>
                    </labels>
                <created>Fri, 28 Jun 2013 18:35:11 +0000</created>
                <updated>Wed, 10 Dec 2014 23:04:41 +0000</updated>
                            <resolved>Fri, 28 Jun 2013 18:56:51 +0000</resolved>
                                    <version>2.4.4</version>
                                                    <component>Index Maintenance</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="370254" author="jason.coombs@yougov.com" created="Fri, 28 Jun 2013 19:03:35 +0000"  >&lt;p&gt;Awesome. Thanks for the follow-up and workaround suggestions.&lt;/p&gt;</comment>
                            <comment id="370242" author="rassi@10gen.com" created="Fri, 28 Jun 2013 18:55:18 +0000"  >&lt;p&gt;This is a known issue (&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-9856&quot; title=&quot;No check for building identical background indexes concurrently&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-9856&quot;&gt;&lt;del&gt;SERVER-9856&lt;/del&gt;&lt;/a&gt;) that has been fixed in 2.4.5.  It&apos;s relevant to background indexing, not text indexes specifically.  Sorry that you ran into it.  I&apos;d suggest the following:&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;run db.repairDatabase() to fix the affected database&lt;/li&gt;
	&lt;li&gt;remove &quot;background=true&quot; from the ensure_index() call in your app, to prevent this from occurring again&lt;/li&gt;
	&lt;li&gt;upgrade to &lt;a href=&quot;http://www.mongodb.org/downloads&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;2.4.5-rc0&lt;/a&gt; (which contains a fix for this issue), or upgrade when 2.4.5 is released&lt;/li&gt;
&lt;/ul&gt;
</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="77758">SERVER-9856</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="80733">SERVER-10059</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>2.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 28 Jun 2013 18:55:18 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        10 years, 33 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>
                            10 years, 33 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>jason.coombs@yougov.com</customfieldvalue>
            <customfieldvalue>rassi</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrmorj:</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>73795</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_10750" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Steps To Reproduce</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>&lt;p&gt;I haven&apos;t yet tried to reproduce the issue, but here&apos;s a proposed technique:&lt;/p&gt;

&lt;p&gt;1. Deploy mongod 2.4.4 with textSearchEnabled.&lt;br/&gt;
2. Create a database with a non-trivial amount of text to be searched.&lt;br/&gt;
3. In two threads or processes, invoke ensureIndex on that text.&lt;/p&gt;</customfieldvalue>

                        </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|hs6ya7:</customfieldvalue>

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