[SERVER-19019] Fatal assertion when failing to create temporary mapReduce collection on secondary Created: 17/Jun/15  Updated: 06/Dec/22  Resolved: 09/Mar/20

Status: Closed
Project: Core Server
Component/s: MapReduce
Affects Version/s: 3.1.2
Fix Version/s: 4.4.0

Type: Bug Priority: Major - P3
Reporter: Kamran K. Assignee: Backlog - Query Team (Inactive)
Resolution: Done Votes: 1
Labels: 32qa, fuzzer-blacklist, neweng, query-44-grooming
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-19435 mapreduce cause Secondary assert Closed
Related
is related to SERVER-28074 Overly eager check for .system. in co... Closed
is related to SERVER-15207 Return errors from commands during re... Closed
Assigned Teams:
Query
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

var rst = new ReplSetTest({nodes: 2});
rst.startSet();
rst.initiate();
rst.awaitReplication();
 
var adminDB = rst.getPrimary().getDB('admin');
 
// Ensure the namespace exists
adminDB.system.roles.insert({});
 
// merge or replace can be used as the out type
adminDB.system.roles.mapReduce(Function.prototype, Function.prototype, {out: {merge: 'mrOutput'}});
rst.awaitReplication();

Sprint: Query 2017-03-27, Query 2017-04-17
Participants:

 Description   

This bug is non-fatal in versions earlier than 3.1.2 (i.e., prior to the changes in SERVER-15207).

It requires the mapReduce to be performed on a special collection like "admin.system.roles" or "admin.system.users".

3.1.2+:

 W ACCESS   [repl writer worker 15] Skipping bad update to roles collection in oplog. NoSuchKey Missing expected field "role" Oplog entry: i
 W ACCESS   [repl writer worker 15] Skipping bad update to roles collection in oplog. NoSuchKey Missing expected field "role" Oplog entry: i
 E REPL     [repl writer worker 15] Failed command { create: "tmp.mr.system.roles_0", temp: true } on admin with status BadValue cannot write to 'admin.tmp.mr.system.roles_0' during oplog application
 I -        [repl writer worker 15] Fatal Assertion 16359

3.1.1 and 3.0.4:

W ACCESS   [repl writer worker 15] Skipping bad update to roles collection in oplog. NoSuchKey Missing expected field "role" Oplog entry: i
W REPL     [repl writer worker 15] Failed command { create: "tmp.mr.system.roles_0", temp: true } on admin with status BadValue cannot write to 'admin.tmp.mr.system.roles_0' during oplog application
I COMMAND  [repl writer worker 15] CMD: drop admin.tmp.mr.system.roles_0
W REPL     [repl writer worker 15] Failed command { drop: "tmp.mr.system.roles_0" } on admin with status UnknownError ns not found during oplog application



 Comments   
Comment by Charlie Swanson [ 09/Mar/20 ]

This was fixed as part of a project in 4.4 to reimplement mapReduce in terms of aggregation. You can no longer output to the 'admin' database, but if you adjust the reproduction steps to point to a non-admin database I have confirmed that it works as expected.

Comment by David Storch [ 02/Aug/19 ]

james.wahlin charlie.swanson, I have confirmed that this is still an issue in the master branch. Do you want to track this alongside the other work that is currently underway for mapReduce?

Comment by Githook User [ 23/Mar/17 ]

Author:

{u'username': u'ksuarz', u'name': u'Kyle Suarez', u'email': u'kyle.suarez@mongodb.com'}

Message: Revert "SERVER-19019 prohibit mapReduce on system collections"

This reverts commits dea0ff9c2f1dd175aabce90a41c8e4d50e282401 and
e9926e58d9f533e43ea43ca3f325d3baecf61276.
Branch: master
https://github.com/mongodb/mongo/commit/65fe8e6afa7439f91458f3d80b4ef1fd32559830

Comment by Kyle Suarez [ 23/Mar/17 ]

Per an in-person conversation with asya, I've reverted the change that prohibits the mapReduce commands on system collections, as we're not sure that this is the exact fix that we want.

We'll revisit this issue after nicholas.zolnierz completes his work on SERVER-4558, and see if that change will stop secondaries from hitting the fassert.

Comment by Githook User [ 23/Mar/17 ]

Author:

{u'username': u'ksuarz', u'name': u'Kyle Suarez', u'email': u'kyle.suarez@mongodb.com'}

Message: SERVER-19019 use runCommand to avoid resharding after drop in sharded passthrough
Branch: master
https://github.com/mongodb/mongo/commit/e9926e58d9f533e43ea43ca3f325d3baecf61276

Comment by Githook User [ 23/Mar/17 ]

Author:

{u'username': u'ksuarz', u'name': u'Kyle Suarez', u'email': u'kyle.suarez@mongodb.com'}

Message: SERVER-19019 prohibit mapReduce on system collections
Branch: master
https://github.com/mongodb/mongo/commit/dea0ff9c2f1dd175aabce90a41c8e4d50e282401

Comment by Steffan Mejia [ 22/Feb/17 ]

Created SERVER-28074 to address the apparent issue referenced in 00427833

Comment by Eric Milkie [ 17/Jun/15 ]

I think we need to just prohibit map/reduce on system collections.

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