<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:35:11 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-55008] Only abort two-phase index builds when BackgroundOperationInProg error in initial sync</title>
                <link>https://jira.mongodb.org/browse/SERVER-55008</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;After the index build aborts, we should probably fail initial sync. However, in the BF, we see that initial sync still managed to complete successfully. The test only failed when &lt;tt&gt;checkReplicatedDataHashes&lt;/tt&gt; discovered a DB hash mismatch between the primary and initial sync node.&lt;/p&gt;

&lt;p&gt;EDIT: We found that 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;Single phase index builds aren&apos;t safe to abort because the primary does not wait on secondaries before committing/aborting them. As a result, this could lead to a situation where the primary commits an index build that the initial sync node will abort. For two-phase index builds, I believe the primary will get notified if the index build is aborted, so it is able to abort its own index build and notify the user, thus avoiding any data inconsistency issues.&lt;/p&gt;

&lt;p&gt;Modified the ticket name to reflect this change.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1641335">SERVER-55008</key>
            <summary>Only abort two-phase index builds when BackgroundOperationInProg error in initial sync</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="13201">Fixed</resolution>
                                        <assignee username="huayu.ouyang@mongodb.com">Huayu Ouyang</assignee>
                                    <reporter username="xuerui.fa@mongodb.com">Xuerui Fa</reporter>
                        <labels>
                    </labels>
                <created>Fri, 5 Mar 2021 21:10:03 +0000</created>
                <updated>Sun, 29 Oct 2023 21:56:37 +0000</updated>
                            <resolved>Wed, 7 Apr 2021 14:53:51 +0000</resolved>
                                                    <fixVersion>4.4.6</fixVersion>
                                    <component>Replication</component>
                                        <votes>0</votes>
                                    <watches>9</watches>
                                                                                                                <comments>
                            <comment id="3708376" author="xgen-internal-githook" created="Thu, 8 Apr 2021 17:20:01 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Huayu Ouyang&apos;, &apos;email&apos;: &apos;huayu.ouyang@mongodb.com&apos;, &apos;username&apos;: &apos;huayu-ouyang&apos;}
&lt;p&gt;Message: &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;-2 Don&apos;t try to set enableTwoPhaseIndexBuild more than once&lt;br/&gt;
Branch: v4.4&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/1a5740e7a63e906117788ef939f183ab0f3318fe&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/1a5740e7a63e906117788ef939f183ab0f3318fe&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3705454" author="xgen-internal-githook" created="Wed, 7 Apr 2021 14:43:40 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Huayu Ouyang&apos;, &apos;email&apos;: &apos;huayu.ouyang@mongodb.com&apos;, &apos;username&apos;: &apos;huayu-ouyang&apos;}
&lt;p&gt;Message: &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; Only abort two-phase index builds when BackgroundOperationInProg error in initial sync&lt;br/&gt;
Branch: v4.4&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/3de4ca147e62d806bfc73852a8e1cd1fa65359d0&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/3de4ca147e62d806bfc73852a8e1cd1fa65359d0&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3694543" author="xuerui.fa" created="Wed, 31 Mar 2021 17:56:45 +0000"  >&lt;p&gt;Declining the 4.4 backport since the bug only occurs on 4.4, so it will be fixed directly. This can&apos;t happen on master because we only use two-phase index builds in replica sets on master, so initial sync can&apos;t abort single phase index builds.&lt;/p&gt;
</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10420">
                    <name>Backports</name>
                                            <outwardlinks description="backported by">
                                                        </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                                        </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10520">
                    <name>Problem/Incident</name>
                                            <outwardlinks description="causes">
                                                        </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="1809329">SERVER-58280</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="1641140">SERVER-54997</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>3.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_12450" key="com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes">
                        <customfieldname>Backport Requested</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="18953"><![CDATA[v4.4]]></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, 1 Apr 2021 21:10:25 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        2 years, 43 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_17050" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Downstream Team Attention</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="16941"><![CDATA[Not Needed]]></customfieldvalue>

                        </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>luke.bonanomi@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            2 years, 43 weeks, 6 days 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_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>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>huayu.ouyang@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|hyy6hz:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hyjh67:</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="4798">Repl 2021-04-05</customfieldvalue>
    <customfieldvalue id="4853">Repl 2021-04-19</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|hyxsr3:</customfieldvalue>

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