<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:35:10 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-54997] Potential issue when building an index and running renameCollection</title>
                <link>https://jira.mongodb.org/browse/SERVER-54997</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;In &lt;tt&gt;renameCollection&lt;/tt&gt;, we &lt;a href=&quot;https://github.com/mongodb/mongo/blob/867e27da7713f864a867d8b0cb7ef5fd03ae01cd/src/mongo/db/catalog/rename_collection.cpp#L358&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;obtain the db lock in X mode&lt;/a&gt;. Then, we &lt;a href=&quot;https://github.com/mongodb/mongo/blob/867e27da7713f864a867d8b0cb7ef5fd03ae01cd/src/mongo/db/catalog/rename_collection.cpp#L129&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;assert that there are no in-progress index builds&lt;/a&gt;. However, according to the logs in the linked BF, an index build was in-progress while we were running &lt;tt&gt;renameCollection&lt;/tt&gt;. In the index build code path, it seems that we don&apos;t always hold on to collection and DB level locks. Specifically, while we are waiting for a next action, we &lt;a href=&quot;https://github.com/mongodb/mongo/blob/08290a1e766326d83f6c2cbafe43b146a69969ae/src/mongo/db/index_builds_coordinator_mongod.cpp#L675-L679&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;assert that we are not holding any locks&lt;/a&gt;. As a result, it seems possible for the following sequence to occur:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;A node starts initial sync&lt;/li&gt;
	&lt;li&gt;Index build starts&lt;/li&gt;
	&lt;li&gt;Index build releases collection/db level locks while waiting for next action but before committing&lt;/li&gt;
	&lt;li&gt;&lt;tt&gt;renameCollection&lt;/tt&gt; command begins and obtains DB lock&lt;/li&gt;
	&lt;li&gt;&lt;tt&gt;renameCollection&lt;/tt&gt; tries to assert that there are no index builds in progress, finds that there are, and &lt;a href=&quot;https://github.com/mongodb/mongo/blob/08290a1e766326d83f6c2cbafe43b146a69969ae/src/mongo/db/repl/oplog.cpp#L1670-L1682&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;aborts in progress index builds &lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;It seems the initial sync node managed to complete initial sync successfully, even after the index build was aborted. I filed &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-55008&quot; title=&quot;Only abort two-phase index builds when BackgroundOperationInProg error in initial sync&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-55008&quot;&gt;&lt;del&gt;SERVER-55008&lt;/del&gt;&lt;/a&gt; to resolve that issue on the Replication side. Open question for Execution: is the above situation considered a bug in the system? If not, I think we can resolve this by not running the JS test while nodes are going through initial sync.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="1641140">SERVER-54997</key>
            <summary>Potential issue when building an index and running renameCollection</summary>
                <type id="6" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14720&amp;avatarType=issuetype">Question</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="louis.williams@mongodb.com">Louis Williams</assignee>
                                    <reporter username="xuerui.fa@mongodb.com">Xuerui Fa</reporter>
                        <labels>
                    </labels>
                <created>Fri, 5 Mar 2021 18:23:03 +0000</created>
                <updated>Wed, 31 Mar 2021 16:00:29 +0000</updated>
                            <resolved>Wed, 31 Mar 2021 16:00:21 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>7</watches>
                                                                                                                <comments>
                            <comment id="3694198" author="dianna.hohensee" created="Wed, 31 Mar 2021 15:59:56 +0000"  >&lt;p&gt;Alright, happy to close without doing any work &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&#160;Thanks for looking into it more. Reassigning to Louis, since he looked into it.&lt;/p&gt;</comment>
                            <comment id="3694183" author="xuerui.fa" created="Wed, 31 Mar 2021 15:53:05 +0000"  >&lt;p&gt;After discussing with &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=louis.williams&quot; class=&quot;user-hover&quot; rel=&quot;louis.williams&quot;&gt;louis.williams&lt;/a&gt;, we think the root bug is that the node &lt;a href=&quot;https://github.com/mongodb/mongo/blob/08290a1e766326d83f6c2cbafe43b146a69969ae/src/mongo/db/repl/oplog.cpp#L1671-L1681&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;aborts all index builds&lt;/a&gt;&#160;when it is in initial sync. It should only be safe to abort two phase index builds &amp;#8211; the node should &lt;a href=&quot;https://github.com/mongodb/mongo/blob/08290a1e766326d83f6c2cbafe43b146a69969ae/src/mongo/db/repl/oplog.cpp#L1685-L1687&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;wait for single phase index builds to complete&lt;/a&gt; instead of aborting them.&lt;/p&gt;

&lt;p&gt;We will change the code to only abort two phase index builds in &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-55008&quot; title=&quot;Only abort two-phase index builds when BackgroundOperationInProg error in initial sync&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-55008&quot;&gt;&lt;del&gt;SERVER-55008&lt;/del&gt;&lt;/a&gt;, and this ticket can likely be closed. Thanks to Louis for talking this through with us!&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                                        </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="1641335">SERVER-55008</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_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</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>Wed, 31 Mar 2021 15:59:56 +0000</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            2 years, 45 weeks ago
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_16465" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Linked BF Score</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>128.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>dianna.hohensee@mongodb.com</customfieldvalue>
            <customfieldvalue>louis.williams@mongodb.com</customfieldvalue>
            <customfieldvalue>xuerui.fa@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hyy5an:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hyjg1z:</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>
                                                                                            <customfield id="customfield_23361" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Requested By</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="4570">Execution Team 2021-04-05</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|hyxrjr:</customfieldvalue>

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