<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 02:54:52 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-685] Indexes on local.oplog.$main</title>
                <link>https://jira.mongodb.org/browse/SERVER-685</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Hello,&lt;/p&gt;

&lt;p&gt;Last night I saw the following query running on our one of our MongoDB client&apos;s masters:&lt;/p&gt;

&lt;p&gt;&amp;gt; db.currentOp();&lt;br/&gt;
{ &lt;br/&gt;
        &quot;inprog&quot; : [&lt;br/&gt;
                {&lt;br/&gt;
                        &quot;opid&quot; : 3,&lt;br/&gt;
                        &quot;active&quot; : 1,&lt;br/&gt;
                        &quot;secs_running&quot; : 34,&lt;br/&gt;
                        &quot;op&quot; : &quot;query&quot;,&lt;br/&gt;
                        &quot;ns&quot; : &quot;local.oplog.$main&quot;,&lt;br/&gt;
                        &quot;query&quot; : &quot;{ query: {}, orderby: &lt;/p&gt;
{ ts: -1 }
&lt;p&gt; }&quot;,&lt;br/&gt;
                        &quot;inLock&quot; : 1,&lt;br/&gt;
                        &quot;client&quot; : &quot;10.6.126.130:39718&quot;&lt;br/&gt;
                }&lt;br/&gt;
        ]&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;That&apos;s actually from the Nagios replication check plugin that we implemented (based on the quick and dirty replication check script you Eliot wrote with Tim and I watching while we were in NYC last Decmber) and what concerns me is how long it took to run.  The whole script is attached but here&apos;s the relevant line:&lt;/p&gt;

&lt;p&gt;master_oplog = master_local&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;oplog.$main&amp;quot;&amp;#93;&lt;/span&gt;.find.sort([&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;ts&amp;quot;, -1&amp;#93;&lt;/span&gt;]).limit(1).to_a.first&lt;/p&gt;

&lt;p&gt;So, my questions:&lt;/p&gt;

&lt;p&gt;1. Is there a better way to get the master&apos;s current oplog timestamp?&lt;/p&gt;

&lt;p&gt;2. Are there indexes on the local.oplog.$main collection?  &apos;db.system.indexes.find();&apos; run on the local db only shows in index on the name field of the users collection, but then &apos;show collections&apos; doesn&apos;t show the oplog collection.&lt;/p&gt;

&lt;p&gt;3. Can an index be added to help that query?&lt;/p&gt;</description>
                <environment></environment>
        <key id="11397">SERVER-685</key>
            <summary>Indexes on local.oplog.$main</summary>
                <type id="6" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14720&amp;avatarType=issuetype">Question</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</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="eliot">Eliot Horowitz</assignee>
                                    <reporter username="ejones">Erik Jones</reporter>
                        <labels>
                    </labels>
                <created>Mon, 1 Mar 2010 12:20:34 +0000</created>
                <updated>Tue, 2 Mar 2010 12:52:16 +0000</updated>
                            <resolved>Mon, 1 Mar 2010 17:26:12 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>0</watches>
                                                                                                                <comments>
                            <comment id="12641" author="eliot" created="Mon, 1 Mar 2010 17:26:12 +0000"  >&lt;p&gt;The queries you want are:&lt;/p&gt;

&lt;p&gt;    var firstc = db.oplog.$main.find().sort({$natural:1}).limit(1);&lt;br/&gt;
    var lastc = db.oplog.$main.find().sort({$natural:-1}).limit(1);&lt;/p&gt;

&lt;p&gt;you can always take a look at getReplicationInfo in shell/db.js&lt;/p&gt;</comment>
                            <comment id="12620" author="ejones" created="Mon, 1 Mar 2010 12:27:39 +0000"  >&lt;p&gt;I believe I may have put this in the wrong category.  Sorry about that.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="10157" name="check_mongodb.rb" size="3912" author="ejones" created="Mon, 1 Mar 2010 12:20:34 +0000"/>
                    </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_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Mon, 1 Mar 2010 17:26:12 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        13 years, 51 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_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>ian@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            13 years, 51 weeks, 2 days 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_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>eliot</customfieldvalue>
            <customfieldvalue>ejones</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrprbr:</customfieldvalue>

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

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

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