[SERVER-23621] mapReduce with output collection writes incorrect 'ns' to profiler Created: 08/Apr/16  Updated: 23/May/16  Resolved: 23/May/16

Status: Closed
Project: Core Server
Component/s: Diagnostics, Querying
Affects Version/s: 3.3.4
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: James Wahlin Assignee: David Storch
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-24196 mapReduce command can unpin a ClientC... Closed
Related
related to SERVER-23256 Refactor and expand system.profile me... Closed
Operating System: ALL
Steps To Reproduce:

var testDB = db.getSiblingDB("mr_db");
assert.commandWorked(testDB.dropDatabase());
var coll = testDB.getCollection("source_col");
 
function getLatestProfilerEntry(inputDb) {
    var cursor = inputDb.system.profile.find();
    return cursor.sort({$natural: -1}).next();
}
 
testDB.setProfilingLevel(2);
 
var mapFunction = function() {
    emit(this.a, this.b);
};
 
var reduceFunction = function(a, b) {
    return Array.sum(b);
};
 
coll.drop();
for (var i = 0; i < 3; i++) {
    assert.writeOK(coll.insert({a: i, b: i}));
}
 
coll.mapReduce(mapFunction, reduceFunction, {query: {a: {$gte: 0}}, out: "out_col"});
 
var profileObj = getLatestProfilerEntry(testDB);
assert.eq(profileObj.ns, coll.getFullName(), tojson(profileObj));

Participants:

 Description   

When mapReduce is run with an output collection (and profiling enabled), the system.profile record written will have a 'ns' field reflecting the output collection namespace. The value for 'ns' should instead be the source collection namespace.



 Comments   
Comment by David Storch [ 23/May/16 ]

This was fixed under SERVER-24196 by https://github.com/mongodb/mongo/commit/ff5bdd3321d525dd9d56595330b2ea6b98a2b87f. Resolving as Duplicate.

Generated at Thu Feb 08 04:03:57 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.