<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 06:15:55 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-70340] Range deleter can cause migration lock acquisition timeouts</title>
                <link>https://jira.mongodb.org/browse/SERVER-70340</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;This ticket is to investigate the lock timeouts caused by the range deleter on v6.0. The &lt;del&gt;release&lt;/del&gt;&#160; acquisition of the critical section is timing out trying to acquire the collection lock that seems to be held by the range deleter.&lt;/p&gt;

&lt;p&gt;This is a problem on 6.0 because of &lt;a href=&quot;https://github.com/mongodb/mongo/blob/92cb95c060640f608e65b97f88129b9d1ef43753/src/mongo/db/s/range_deletion_util.cpp#L346&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;the acquisition of the ScopedRangeDeleterLock&lt;/a&gt; before running the deletion. This lock is necessary to prevent &lt;a href=&quot;https://github.com/mongodb/mongo/blob/92cb95c060640f608e65b97f88129b9d1ef43753/src/mongo/db/s/range_deletion_util.cpp#L642-L697&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;the FCV upgrade orphan counter code&lt;/a&gt; from setting incorrect counters on the range deletions. However, the problem we are running into here is that the ScopedRangeDeleterLock acquires the DBLock on the config database, which &lt;a href=&quot;https://github.com/mongodb/mongo/blob/92cb95c060640f608e65b97f88129b9d1ef43753/src/mongo/db/concurrency/d_concurrency.cpp#L219-L222&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;automatically acquires the GlobalLock&lt;/a&gt;. But we have already acquired the DBLock on the user database, which has already automatically acquired the GlobalLock. This double acquisition means that we are recursively locking the global lock, and so &lt;a href=&quot;https://github.com/mongodb/mongo/blob/92cb95c060640f608e65b97f88129b9d1ef43753/src/mongo/db/query/plan_yield_policy_impl.cpp#L42-L44&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;the yield policy is replaced with NO_YIELD&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We also cannot change the ScopedRangeDeleterLock to never acquire the global lock, because some usages of the &lt;a href=&quot;https://github.com/mongodb/mongo/blob/92cb95c060640f608e65b97f88129b9d1ef43753/src/mongo/db/s/migration_util.cpp#L711-L736&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;persistUpdatedNumOrphans&lt;/a&gt; function during migrations are not holding the global lock already.&lt;/p&gt;

&lt;p&gt;One option would be to change the ScopedRangeDeleterLock to acquire the GlobalLock conditionally based on whether we already hold it, something like replacing &lt;a href=&quot;https://github.com/mongodb/mongo/blob/92cb95c060640f608e65b97f88129b9d1ef43753/src/mongo/db/s/balancer_stats_registry.cpp#L69&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;this line&lt;/a&gt; with the code below.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;_configLock(opCtx, NamespaceString::kConfigDb, MODE_IX, Date_t::max(), opCtx-&amp;gt;lockState()-&amp;gt;isLocked())&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;But it may be better to find a more general solution that also considers the general problem of the ScopedRangeDeleterLock in &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-70322&quot; title=&quot;BalancerStatsRegistry inappropriately constructs ResourceId outside ResourceIdFactory&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-70322&quot;&gt;&lt;del&gt;SERVER-70322&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="2154283">SERVER-70340</key>
            <summary>Range deleter can cause migration lock acquisition timeouts</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="tommaso.tocci@mongodb.com">Tommaso Tocci</assignee>
                                    <reporter username="allison.easton@mongodb.com">Allison Easton</reporter>
                        <labels>
                    </labels>
                <created>Fri, 7 Oct 2022 14:06:40 +0000</created>
                <updated>Wed, 30 Nov 2022 17:52:35 +0000</updated>
                            <resolved>Tue, 1 Nov 2022 02:19:40 +0000</resolved>
                                    <version>6.0.2</version>
                                                                        <votes>0</votes>
                                    <watches>14</watches>
                                                                                                                <comments>
                            <comment id="4942893" author="tommaso.tocci" created="Tue, 1 Nov 2022 02:19:53 +0000"  >&lt;p&gt;Fixed by &#160; &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-70864&quot; title=&quot;Get rid of fine grained scoped range deleter lock&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-70864&quot;&gt;&lt;del&gt;SERVER-70864&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="4909257" author="allison.easton" created="Tue, 18 Oct 2022 10:13:26 +0000"  >&lt;p&gt;Some complications came up with the solution of acquiring the global lock conditionally. We found that to migrate the chunks in config.system.sessions, we would also need to make the db lock acquisition optional. And to keep the ordering of locking for collections, we would need to put special handling for the config.system.sessions collection in v6.0.&lt;/p&gt;

&lt;p&gt;Since there have also been some complications with &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-70322&quot; title=&quot;BalancerStatsRegistry inappropriately constructs ResourceId outside ResourceIdFactory&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-70322&quot;&gt;&lt;del&gt;SERVER-70322&lt;/del&gt;&lt;/a&gt; which may change the locking of the range deleter fundamentally, I am going to put this back to open until we choose a path for fixing &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-70322&quot; title=&quot;BalancerStatsRegistry inappropriately constructs ResourceId outside ResourceIdFactory&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-70322&quot;&gt;&lt;del&gt;SERVER-70322&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="4895210" author="JIRAUSER1253381" created="Tue, 11 Oct 2022 17:32:19 +0000"  >&lt;p&gt;Yes I am!&#160; Thank you for sending that.&lt;/p&gt;</comment>
                            <comment id="4895179" author="garaudy.etienne" created="Tue, 11 Oct 2022 17:25:37 +0000"  >&lt;p&gt;You&apos;re saying that we need PM-1699?&lt;/p&gt;</comment>
                            <comment id="4894366" author="JIRAUSER1253381" created="Tue, 11 Oct 2022 14:32:24 +0000"  >&lt;p&gt;I want to mention that even after we fix this, the lock contention between the range deleter and chunk migration will continue to be a performance issue.&#160;&#160;&lt;/p&gt;

&lt;p&gt;Anytime we have an unsharded collection that we then decide to shard, there will be lots of writes on the source shard because of the range deleter (which acquires an IX lock on the collection), and also lots of reads because of the actual chunk migrations (each chunk migration critical section gets an S lock on the collection).&#160;&#160;&lt;/p&gt;

&lt;p&gt;The problem is that we don&apos;t have a granular critical section for chunk migrations. We acquire an S lock on the entire collection, even though a chunk comprises only a small fraction of the collection.&#160;&#160;&lt;/p&gt;

&lt;p&gt;I don&apos;t see why the range deleter should ever contend with chunk migrations.&#160; (We can only delete a range after it has been succesfully migrated.)&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                                        </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="2167346">SERVER-70864</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10020">
                    <name>Gantt Dependency</name>
                                            <outwardlinks description="has to be done before">
                                                        </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>5.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>3.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_13552" key="com.go2group.jira.plugin.crm:crm_generic_field">
                        <customfieldname>Case</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[[5006R00001pKDcNQAW]]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Tue, 11 Oct 2022 14:32:24 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        1 year, 14 weeks, 2 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_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            1 year, 14 weeks, 2 days ago
                        </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>allison.easton@mongodb.com</customfieldvalue>
            <customfieldvalue>andrew.witten@mongodb.com</customfieldvalue>
            <customfieldvalue>garaudy.etienne@mongodb.com</customfieldvalue>
            <customfieldvalue>tommaso.tocci@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i1d8t3:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|i0vx2w:</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="6551">Sharding EMEA 2022-10-17</customfieldvalue>
    <customfieldvalue id="6552">Sharding EMEA 2022-10-31</customfieldvalue>
    <customfieldvalue id="6553">Sharding EMEA 2022-11-14</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10750" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Steps To Reproduce</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>&lt;p&gt;Create a two shard cluster. Add all the data while collection is unsharded and create 10 indexes and then shard the collection.&lt;/p&gt;

&lt;p&gt;The data will be migrated from one shard to the other and after the 15 minute range deletion timeout, we will start seeing critical section releases fail on the donor shard because of failing to acquire the critical section.&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|i1cuyf:</customfieldvalue>

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