<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:14:49 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-27312] Mapreduce does not run on Secondary in sharded clusters even with out: inline</title>
                <link>https://jira.mongodb.org/browse/SERVER-27312</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;0. Nature of the job:&lt;br/&gt;
Fairly routine Map Reduce job:&lt;br/&gt;
Map:&lt;br/&gt;
Reduce:&lt;br/&gt;
    public static final String mapfunction = &quot;function() &lt;/p&gt;
{ emit(this.custid, this.txnval); }&quot;;&lt;br/&gt;
    public static final String reducefunction = &quot;function(key, values) { return Array.sum(values); }&quot;;&lt;br/&gt;
&lt;br/&gt;
(Code is attached)&lt;br/&gt;
&lt;br/&gt;
When executed on a Replica Set, following log can be seen on the Slave:&lt;br/&gt;
&lt;br/&gt;
2016-11-23T15:05:26.735+0000 I COMMAND  &lt;span class=&quot;error&quot;&gt;&amp;#91;conn671&amp;#93;&lt;/span&gt; command test.txns command: mapReduce { mapreduce: &quot;txns&quot;, map: function() { emit(this.custid, this.txnval); }
&lt;p&gt;, reduce: function(key, values) &lt;/p&gt;
{ return Array.sum(values); }, out: { inline: 1 }, query: null, sort: null, finalize: null, scope: null, verbose: true } planSummary: COUNT keyUpdates:0 writeConflicts:0 numYields:7 reslen:4331 locks:{ Global: { acquireCount: { r: 44 } }, Database: { acquireCount: { r: 3, R: 19 } }, Collection: { acquireCount: { r: 3 } } } protocol:op_query 124ms&lt;br/&gt;
&lt;br/&gt;
The out : {inline : 1} ensure that it hits the slave.&lt;br/&gt;
&lt;br/&gt;
When executed on a shard:&lt;br/&gt;
&lt;br/&gt;
mongos&amp;gt; db.txns.getShardDistribution()&lt;br/&gt;
&lt;br/&gt;
Shard Shard-0 at Shard-0/SG-shard3-281.devservers.mongodirector.com:27017,SG-shard3-282.devservers.mongodirector.com:27017&lt;br/&gt;
 data : 498KiB docs : 9474 chunks : 3&lt;br/&gt;
 estimated data per chunk : 166KiB&lt;br/&gt;
 estimated docs per chunk : 3158&lt;br/&gt;
&lt;br/&gt;
Shard Shard-1 at Shard-1/SG-shard3-284.devservers.mongodirector.com:27017,SG-shard3-285.devservers.mongodirector.com:27017&lt;br/&gt;
 data : 80KiB docs : 1526 chunks : 3&lt;br/&gt;
 estimated data per chunk : 26KiB&lt;br/&gt;
 estimated docs per chunk : 508&lt;br/&gt;
&lt;br/&gt;
Totals&lt;br/&gt;
 data : 579KiB docs : 11000 chunks : 6&lt;br/&gt;
 Shard Shard-0 contains 86.12% data, 86.12% docs in cluster, avg obj size on shard : 53B&lt;br/&gt;
 Shard Shard-1 contains 13.87% data, 13.87% docs in cluster, avg obj size on shard : 53B&lt;br/&gt;
&lt;br/&gt;
&lt;br/&gt;
Shard 0&lt;br/&gt;
Mongos doesn&apos;t log the MapReduce job at all&lt;br/&gt;
Slave only logs the deletion of the tmp collection.&lt;br/&gt;
&lt;br/&gt;
Primary:&lt;br/&gt;
&lt;br/&gt;
2016-11-24T08:46:30.828+0000 I COMMAND  &lt;span class=&quot;error&quot;&gt;&amp;#91;conn357&amp;#93;&lt;/span&gt; command test.$cmd command: mapreduce.shardedfinish { mapreduce.shardedfinish: { mapreduce: &quot;txns&quot;, map: function() { emit(this.custid, this.txnval); }, reduce: function(key, values) { return Array.sum(values); }
&lt;p&gt;, out: &lt;/p&gt;
{ in
line: 1 }
&lt;p&gt;, query: null, sort: null, finalize: null, scope: null, verbose: true, $queryOptions: { $readPreference: &lt;/p&gt;
{ mode: &quot;secondary&quot; }
&lt;p&gt; } }, inputDB: &quot;test&quot;, shardedOutputCollection: &quot;tmp.mrs.txns_1479977190_0&quot;, shards: { Shard-0/SG-shard3-281.devservers.mongodirector.com&lt;br/&gt;
:27017,SG-shard3-282.devservers.mongodirector.com:27017: { result: &quot;tmp.mrs.txns_1479977190_0&quot;, timeMillis: 123, timing: &lt;/p&gt;
{ mapTime: 51, emitLoop: 116, reduceTime: 9, mode: &quot;mixed&quot;, total: 123 }
&lt;p&gt;, counts: &lt;/p&gt;
{ input: 9474, emit: 9474, reduce: 909, output: 101 }
&lt;p&gt;, ok: 1.0, $gleS&lt;br/&gt;
tats: &lt;/p&gt;
{ lastOpTime: Timestamp 1479977190000|103, electionId: ObjectId(&apos;7fffffff0000000000000001&apos;) }
&lt;p&gt; }, Shard-1/SG-shard3-284.devservers.mongodirector.com:27017,SG-shard3-285.devservers.mongodirector.com:27017: { result: &quot;tmp.mrs.txns_1479977190_0&quot;, timeMillis: 71, timing:&lt;br/&gt;
 &lt;/p&gt;
{ mapTime: 8, emitLoop: 63, reduceTime: 4, mode: &quot;mixed&quot;, total: 71 }
&lt;p&gt;, counts: &lt;/p&gt;
{ input: 1526, emit: 1526, reduce: 197, output: 101 }
&lt;p&gt;, ok: 1.0, $gleStats: &lt;/p&gt;
{ lastOpTime: Timestamp 1479977190000|103, electionId: ObjectId(&apos;7fffffff0000000000000001&apos;) }
&lt;p&gt; } }, shardCounts: { Sha&lt;br/&gt;
rd-0/SG-shard3-281.devservers.mongodirector.com:27017,SG-shard3-282.devservers.mongodirector.com:27017: &lt;/p&gt;
{ input: 9474, emit: 9474, reduce: 909, output: 101 }
&lt;p&gt;, Shard-1/SG-shard3-284.devservers.mongodirector.com:27017,SG-shard3-285.devservers.mongodirector.com:27017: &lt;/p&gt;
{ inpu
t: 1526, emit: 1526, reduce: 197, output: 101 }
&lt;p&gt; }, counts: &lt;/p&gt;
{ emit: 11000, input: 11000, output: 202, reduce: 1106 }
&lt;p&gt; } keyUpdates:0 writeConflicts:0 numYields:0 reslen:4368 locks:{ Global: { acquireCount: &lt;/p&gt;
{ r: 2 }
&lt;p&gt; }, Database: { acquireCount: &lt;/p&gt;
{ r: 1 }
&lt;p&gt; }, Collection: { acqu&lt;br/&gt;
ireCount: &lt;/p&gt;
{ r: 1 }
&lt;p&gt; } } protocol:op_command 115ms&lt;br/&gt;
2016-11-24T08:46:30.830+0000 I COMMAND  &lt;span class=&quot;error&quot;&gt;&amp;#91;conn46&amp;#93;&lt;/span&gt; CMD: drop test.tmp.mrs.txns_1479977190_0&lt;/p&gt;

&lt;p&gt;Looks like temp collections are created when it is a sharded database/collection. Couldn&apos;t find anything specific about the behavior in the documentation (&lt;a href=&quot;https://docs.mongodb.com/v3.2/core/map-reduce-sharded-collections/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://docs.mongodb.com/v3.2/core/map-reduce-sharded-collections/&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Shard 1, Primary:&lt;br/&gt;
2016-11-24T08:46:30.597+0000 I COMMAND  &lt;span class=&quot;error&quot;&gt;&amp;#91;conn351&amp;#93;&lt;/span&gt; CMD: drop test.tmp.mr.txns_0&lt;br/&gt;
2016-11-24T08:46:30.651+0000 I COMMAND  &lt;span class=&quot;error&quot;&gt;&amp;#91;conn351&amp;#93;&lt;/span&gt; CMD: drop test.tmp.mrs.txns_1479977190_0&lt;br/&gt;
2016-11-24T08:46:30.654+0000 I COMMAND  &lt;span class=&quot;error&quot;&gt;&amp;#91;conn351&amp;#93;&lt;/span&gt; CMD: drop test.tmp.mr.txns_0&lt;br/&gt;
2016-11-24T08:46:30.654+0000 I COMMAND  &lt;span class=&quot;error&quot;&gt;&amp;#91;conn351&amp;#93;&lt;/span&gt; CMD: drop test.tmp.mr.txns_0&lt;br/&gt;
2016-11-24T08:46:30.654+0000 I COMMAND  &lt;span class=&quot;error&quot;&gt;&amp;#91;conn351&amp;#93;&lt;/span&gt; CMD: drop test.tmp.mr.txns_0&lt;/p&gt;

&lt;p&gt;Secondary:&lt;br/&gt;
2016-11-24T08:46:30.838+0000 I COMMAND  &lt;span class=&quot;error&quot;&gt;&amp;#91;repl writer worker 3&amp;#93;&lt;/span&gt; CMD: drop test.tmp.mrs.txns_1479977190_0&lt;/p&gt;</description>
                <environment></environment>
        <key id="336902">SERVER-27312</key>
            <summary>Mapreduce does not run on Secondary in sharded clusters even with out: inline</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="-1">Unassigned</assignee>
                                    <reporter username="dharshanr@scalegrid.net">Dharshan Rangegowda</reporter>
                        <labels>
                    </labels>
                <created>Wed, 7 Dec 2016 06:11:27 +0000</created>
                <updated>Wed, 7 Dec 2016 06:34:50 +0000</updated>
                            <resolved>Wed, 7 Dec 2016 06:34:50 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="1451040" author="stennie" created="Wed, 7 Dec 2016 06:34:32 +0000"  >&lt;p&gt;Hi Dharshan,&lt;/p&gt;

&lt;p&gt;This is currently expected behaviour for Map/Reduce via &lt;tt&gt;mongos&lt;/tt&gt;; please watch/upvote &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-5525&quot; title=&quot;mongos should send inline mapreduce with slaveOk to secondaries&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-5525&quot;&gt;&lt;del&gt;SERVER-5525&lt;/del&gt;&lt;/a&gt; for updates.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Stephen&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="35585">SERVER-5525</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, 7 Dec 2016 06:34:32 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        7 years, 10 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>stephen.steneker@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            7 years, 10 weeks 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>dharshanr@scalegrid.net</customfieldvalue>
            <customfieldvalue>stephen.steneker@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrjp7z:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hssm7b:</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_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|hs4mtj:</customfieldvalue>

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