<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:53:54 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-40058] AutoStatsTracker&apos;s lock acquisition to read the profiling level should not conflict with secondary batch application</title>
                <link>https://jira.mongodb.org/browse/SERVER-40058</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;The &lt;a href=&quot;https://github.com/mongodb/mongo/blob/9a7cfb73da3a86d1c20f674140f1f908e2bae0c8/src/mongo/db/db_raii.h#L45&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;AutoStatsTracker&lt;/a&gt; is used by various code paths to record operation counters in &lt;tt&gt;Top&lt;/tt&gt; and to set the correct diagnostic information on the operation&apos;s &lt;tt&gt;CurOp&lt;/tt&gt;. Amongst its jobs is to determine the &lt;a href=&quot;https://docs.mongodb.com/manual/tutorial/manage-the-database-profiler/#profiling-levels&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;profiling level&lt;/a&gt; associated with the operation, and set it on the &lt;tt&gt;CurOp&lt;/tt&gt;. Since the profiling level can be configured on a per-database basis, and since this information is stored in-memory inside the catalog subsystem&apos;s &lt;tt&gt;Database&lt;/tt&gt; object, this involves acquiring the appropriate MODE_IS intent lock on the database:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/9a7cfb73da3a86d1c20f674140f1f908e2bae0c8/src/mongo/db/db_raii.cpp#L62-L65&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/blob/9a7cfb73da3a86d1c20f674140f1f908e2bae0c8/src/mongo/db/db_raii.cpp#L62-L65&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As implemented, it is possible for this lock acquisition to conflict with parallel oplog batch application on secondary nodes. However, the MODE_IS database lock here is used solely to protect access to &lt;a href=&quot;https://github.com/mongodb/mongo/blob/9a7cfb73da3a86d1c20f674140f1f908e2bae0c8/src/mongo/db/catalog/database_impl.h#L204&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;DatabaseImpl::_profile&lt;/a&gt;. Therefore, there is no need to conflict with batch application. Preventing such lock conflicts could increase throughput of operations that use the &lt;tt&gt;AutoStatsTracker&lt;/tt&gt;. Many operations that use the &lt;tt&gt;AutoStatsTracker&lt;/tt&gt;, such as secondary reads via the &lt;tt&gt;find&lt;/tt&gt; command, are already configured to avoid conflicting with batch application inside &lt;tt&gt;AutoGetCollectionForRead&lt;/tt&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/9a7cfb73da3a86d1c20f674140f1f908e2bae0c8/src/mongo/db/db_raii.cpp#L90-L95&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/blob/9a7cfb73da3a86d1c20f674140f1f908e2bae0c8/src/mongo/db/db_raii.cpp#L90-L95&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;However, there are code paths which use the &lt;tt&gt;AutoStatsTracker&lt;/tt&gt; but never use &lt;tt&gt;AutoGetCollectionForRead&lt;/tt&gt;, causing unnecessary blocking during batch application while attempting to set the profiling level. This was observed in our performance testing infrastructure for the OP_KILL_CURSORS code path.&lt;/p&gt;</description>
                <environment></environment>
        <key id="714136">SERVER-40058</key>
            <summary>AutoStatsTracker&apos;s lock acquisition to read the profiling level should not conflict with secondary batch application</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</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="david.storch@mongodb.com">David Storch</assignee>
                                    <reporter username="david.storch@mongodb.com">David Storch</reporter>
                        <labels>
                    </labels>
                <created>Fri, 8 Mar 2019 23:24:03 +0000</created>
                <updated>Sun, 29 Oct 2023 22:23:06 +0000</updated>
                            <resolved>Mon, 11 Mar 2019 20:59:16 +0000</resolved>
                                                    <fixVersion>4.1.9</fixVersion>
                                    <component>Concurrency</component>
                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="2177693" author="xgen-internal-githook" created="Mon, 11 Mar 2019 20:58:57 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;David Storch&apos;, &apos;username&apos;: &apos;dstorch&apos;, &apos;email&apos;: &apos;david.storch@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-40058&quot; title=&quot;AutoStatsTracker&amp;#39;s lock acquisition to read the profiling level should not conflict with secondary batch application&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-40058&quot;&gt;&lt;del&gt;SERVER-40058&lt;/del&gt;&lt;/a&gt; Prevent AutoStatsTracker&apos;s db lock from conflicting with secondary batch application.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/b69c97b4da596f1da8dea2b40cf32a7c5c657870&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/b69c97b4da596f1da8dea2b40cf32a7c5c657870&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2177644" author="david.storch" created="Mon, 11 Mar 2019 20:24:10 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=william.schultz&quot; class=&quot;user-hover&quot; rel=&quot;william.schultz&quot;&gt;william.schultz&lt;/a&gt;, while there may be other performance problems due to conflicting with secondary batch application when we don&apos;t need to, I don&apos;t intend to address those outside &lt;tt&gt;AutoStatsTracker&lt;/tt&gt; within the scope of this ticket. Feel free to file and assign any new tickets to our backlog if you come across related performance problems!&lt;/p&gt;

&lt;p&gt;In the particular case you point out above, it looks like we&apos;re maintaining a UUID -&amp;gt; &lt;tt&gt;CollatorInterface&lt;/tt&gt;&#160;cache. This means that we don&apos;t have to repeatedly determine the default collation, so it&apos;s not obvious to me that there will be a similar throughput issue for change streams on secondaries.&lt;/p&gt;</comment>
                            <comment id="2177228" author="william.schultz" created="Mon, 11 Mar 2019 16:13:40 +0000"  >&lt;p&gt;I believe that there is a similar issue with change stream post image lookup lock acquisitions. Inside &lt;tt&gt;MongoInterfaceStandalone::lookupSingleDocument&lt;/tt&gt;, we will &lt;a href=&quot;https://github.com/mongodb/mongo/blob/fcbc0c9c936c83612545ee5873b649854e4b5e57/src/mongo/db/pipeline/process_interface_standalone.cpp#L416&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;make a call&lt;/a&gt; to &lt;tt&gt;MongoInterfaceStandalone::_getCollectionDefaultCollator&lt;/tt&gt;, which &lt;a href=&quot;https://github.com/mongodb/mongo/blob/fcbc0c9c936c83612545ee5873b649854e4b5e57/src/mongo/db/pipeline/process_interface_standalone.cpp#L584&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;takes a collection lock&lt;/a&gt; via the AutoGetCollection interface. The AutoGetCollection constructor doesn&apos;t allow reads to avoid conflicting with secondary batch application. This behavior would presumably impact performance of secondary change streams that use &apos;updateLookup&apos;. &lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                                        </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="708629">SERVER-39939</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>3.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_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>Mon, 11 Mar 2019 16:13:40 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        4 years, 48 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_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PM-1081</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>
                            4 years, 48 weeks, 2 days ago
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_16465" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Linked BF Score</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>david.storch@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>william.schultz@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|huqcr3:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hug0nz:</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="2790">Query 2019-03-25</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|hupz0f:</customfieldvalue>

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