<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:24:35 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-10995] Elapsed time for $maxTimeMS queries includes time to acquire db lock</title>
                <link>https://jira.mongodb.org/browse/SERVER-10995</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;If a query needs to wait to acquire a database read lock, its reported elapsed time will be higher if it uses $maxTimeMS than if it does not.  This is due to the fact that the $maxTimeMS implementation queries the operation for its start time at the beginning of runQuery(), but the act of doing so has the side effect of actually setting the start time for the operation.&lt;/p&gt;

&lt;p&gt;Since operations generally don&apos;t set their start time until right after they acquire a database lock for the first time, operations that specify $maxTimeMS will appear in logs to take longer to execute, even though they haven&apos;t.&lt;/p&gt;

&lt;p&gt;A fix would fall under either of:&lt;/p&gt;

&lt;p&gt;1) all queries should include time to acquire first lock: call CurOp::ensureStarted() in assembleResponse() or receivedQuery().&lt;br/&gt;
2) all queries should not include time to acquire first lock: make CurOp::startTime() take an optional bool &quot;reset&quot;, add logic to MaxTimeTracker to handle case where the currently-tracked operation &quot;has not started yet&quot;.&lt;/p&gt;

&lt;p&gt;&amp;#8212;&lt;/p&gt;

&lt;p&gt;Reproduce with:&lt;/p&gt;

&lt;p&gt;$ mongo --eval &apos;db.adminCommand({sleep:1,secs:2}).ok&apos; &amp;amp; sleep 1 &amp;amp;&amp;amp; mongo --eval &apos;db.runCommand({dbStats:1,maxTimeMS:0})&apos;&lt;br/&gt;
$ mongo --eval &apos;db.adminCommand({sleep:1,secs:2}).ok&apos; &amp;amp; sleep 1 &amp;amp;&amp;amp; mongo --eval &apos;db.runCommand({dbStats:1,maxTimeMS:60*1000})&apos;&lt;/p&gt;

&lt;p&gt;The above generates two dbStats commands, each of which wait 1 second for a lock and then run in 0ms, but have completely different reported elapsed times:&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;2013-11-13T02:27:06.577-0500 [conn12] command test.$cmd command: { dbStats: 1.0, maxTimeMS: 0.0 } ntoreturn:1 keyUpdates:0 locks(micros) r:345 reslen:247 0ms&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;2013-11-13T02:27:10.191-0500 [conn14] command test.$cmd command: { dbStats: 1.0, maxTimeMS: 60000.0 } ntoreturn:1 keyUpdates:0 locks(micros) r:354 reslen:247 1000ms&lt;/tt&gt;&lt;/p&gt;</description>
                <environment></environment>
        <key id="92339">SERVER-10995</key>
            <summary>Elapsed time for $maxTimeMS queries includes time to acquire db lock</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="9">Done</resolution>
                                        <assignee username="rassi">J Rassi</assignee>
                                    <reporter username="rassi">J Rassi</reporter>
                        <labels>
                    </labels>
                <created>Tue, 1 Oct 2013 23:24:15 +0000</created>
                <updated>Mon, 11 Jul 2016 17:40:33 +0000</updated>
                            <resolved>Thu, 14 Nov 2013 00:21:12 +0000</resolved>
                                    <version>2.5.2</version>
                                    <fixVersion>2.5.4</fixVersion>
                                    <component>Diagnostics</component>
                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="455946" author="xgen-internal-githook" created="Thu, 14 Nov 2013 00:20:12 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;jrassi&apos;, u&apos;name&apos;: u&apos;Jason Rassi&apos;, u&apos;email&apos;: u&apos;rassi@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-10995&quot; title=&quot;Elapsed time for $maxTimeMS queries includes time to acquire db lock&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-10995&quot;&gt;&lt;del&gt;SERVER-10995&lt;/del&gt;&lt;/a&gt; Leave CurOp::_start untouched when setting maxTimeMS&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/a87e0ed4ec30725e3ffd7de75c0f204ca0f42b45&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/a87e0ed4ec30725e3ffd7de75c0f204ca0f42b45&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="13949">SERVER-2212</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>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, 2 Oct 2013 01:01:32 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        10 years, 14 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>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, 14 weeks 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>xgen-internal-githook</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|hrme07:</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>84508</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_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|hs1jnj:</customfieldvalue>

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