[SERVER-17215] mapReduce with 'reduce' output action fails with an massert on output collection with no _id index Created: 06/Feb/15  Updated: 06/Dec/22  Resolved: 02/Aug/19

Status: Closed
Project: Core Server
Component/s: MapReduce
Affects Version/s: 2.4.12, 2.6.7, 3.0.0-rc8
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Kamran K. Assignee: Backlog - Query Team (Inactive)
Resolution: Done Votes: 0
Labels: 28qa, neweng, query-44-grooming
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query
Operating System: ALL
Steps To Reproduce:

(function() {
    'use strict';
 
    var source = db.mr_source;
    var out = db.mr_out;
 
    source.drop();
    out.drop();
 
    // create a dummy collection for mapReduce input
    source.insert({a: 1});
 
    // create a collection with no _id index and insert a document
    db.createCollection(out.getName(), {autoIndexId: false});
    out.insert({_id: 0});
 
    var mapper  = function() {emit(1, 1);};
    var reducer = function() {return 1;};
 
    // the mapReduce will fail because of the missing _id index
    source.mapReduce(mapper, reducer, {out: {reduce: out.getName()}});
}());

Participants:

 Description   

A mapReduce command that specifies a 'reduce' output action against a collection without an _id index will fail with an massert.

The root cause is a Helpers::findOne call that requires the use of an index: https://github.com/mongodb/mongo/blob/r3.0.0-rc8/src/mongo/db/commands/mr.cpp#L644-L648


Error message:

Assertion: 17245:Could not get executor for query { _id: 1.0 }



 Comments   
Comment by David Storch [ 02/Aug/19 ]

I can no longer reproduce this massert() with the script provided. Also, note that the autoIndexID option on collection creation is no longer permitted on collections outside of the local database. For these reasons, I don't believe the Server Query Team intends to pursue this issue further. Closing as Gone Away.

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