Original summary:
MapReduce with inline enabled causes sharding to create collection with empty name
Original report:
This was caught through the mapReduce*.js suite of tests, in the case of sharded collection output, when there is an assertion about the collection name not being empty in query-related commands.
This is the assertion:
m30999| 2014-10-03T12:06:23.586-0400 D SHARDING [Balancer] shard0001 has more chunks me:1 best: shard0000:0 m30999| 2014-10-03T12:06:23.586-0400 D SHARDING [Balancer] collection : mrShard.mrReduceInShardedOutSharded m30999| 2014-10-03T12:06:23.586-0400 D SHARDING [Balancer] donor : shard0001 chunks on 1 m30999| 2014-10-03T12:06:23.586-0400 D SHARDING [Balancer] receiver : shard0000 chunks on 0 m30999| 2014-10-03T12:06:23.586-0400 D SHARDING [Balancer] threshold : 2 m30999| 2014-10-03T12:06:23.586-0400 D SHARDING [Balancer] no need to move any chunk m30999| 2014-10-03T12:06:23.586-0400 D SHARDING [Balancer] about to log balancer result: { server: "kaloianmdesktop", time: new Date(1412352383586), what: "balancer.round", details: { executionTimeMillis: 225, errorOccured: false, candidateChunks: 0, chunksMoved: 0 } } m30999| 2014-10-03T12:06:23.611-0400 D SHARDING [Balancer] *** end of balancing round m30999| 2014-10-03T12:06:23.629-0400 I SHARDING [Balancer] distributed lock 'balancer/kaloianmdesktop:30999:1412352205:41' unlocked. m30999| 2014-10-03T12:06:26.184-0400 I SHARDING [LockPinger] cluster localhost:30000 pinged successfully at Fri Oct 03 12:06:26 2014 by distribute ... m30001| 2014-10-03T12:06:26.601-0400 I - [conn5] Invariant failure !_nss.coll().empty() src\mongo\db\client.cpp 221 m30001| 2014-10-03T12:06:27.351-0400 I - [conn5] mongod.exe ...\src\mongo\util\stacktrace_win.cpp(173) mongo::printStackTrace+0x5b m30001| 2014-10-03T12:06:27.352-0400 I - [conn5] mongod.exe ...\src\mongo\util\log.cpp(134) mongo::logContext+0xd8 m30001| 2014-10-03T12:06:27.352-0400 I - [conn5] mongod.exe ...\src\mongo\util\assert_util.cpp(143) mongo::invariantFailed+0xe3 m30001| 2014-10-03T12:06:27.352-0400 I - [conn5] mongod.exe ...\src\mongo\db\client.cpp(221) mongo::AutoGetCollectionForRead::_init+0xa1 m30001| 2014-10-03T12:06:27.352-0400 I - [conn5] mongod.exe ...\src\mongo\db\client.cpp(206) mongo::AutoGetCollectionForRead::AutoGetCollectionForRead+0xff m30001| 2014-10-03T12:06:27.353-0400 I - [conn5] mongod.exe ...\src\mongo\db\commands\count.cpp(108) mongo::CmdCount::run+0xfb m30001| 2014-10-03T12:06:27.353-0400 I - [conn5] mongod.exe ...\src\mongo\db\dbcommands.cpp(1150) mongo::_execCommand+0xb0 m30001| 2014-10-03T12:06:27.353-0400 I - [conn5] mongod.exe ...\src\mongo\db\dbcommands.cpp(1364) mongo::Command::execCommand+0xde3 m30001| 2014-10-03T12:06:27.353-0400 I - [conn5] mongod.exe ...\src\mongo\db\dbcommands.cpp(1442) mongo::_runCommands+0x570 m30001| 2014-10-03T12:06:27.354-0400 I - [conn5] mongod.exe ...\src\mongo\db\query\new_find.cpp(125) mongo::runCommands+0x88 m30001| 2014-10-03T12:06:27.354-0400 I - [conn5] mongod.exe ...\src\mongo\db\query\new_find.cpp(510) mongo::newRunQuery+0x490 m30001| 2014-10-03T12:06:27.354-0400 I - [conn5] mongod.exe ...\src\mongo\db\instance.cpp(271) mongo::receivedQuery+0x2ae m30001| 2014-10-03T12:06:27.354-0400 I - [conn5] mongod.exe ...\src\mongo\db\instance.cpp(444) mongo::assembleResponse+0x4e1 m30001| 2014-10-03T12:06:27.354-0400 I - [conn5] mongod.exe ...\src\mongo\db\db.cpp(186) mongo::MyMessageHandler::process+0x1af m30001| 2014-10-03T12:06:27.355-0400 I - [conn5] mongod.exe ...\src\mongo\util\net\message_server_port.cpp(228) mongo::PortMessageServer::handleIncomingMsg+0x5e4This is the command, which gets executed on MongoS and the call stack:
m30999| 2014-10-03T15:30:00.360-0400 D COMMANDS [conn1] COMMAND OBJECT: { mapreduce: "srcSharded", map: function map() { emit(this.i, 1); }, reduce: function reduce(key, values) { return Array.sum(values) }, out: { inline: 1.0, sharded: true } }Call stack:
m30999| 2014-10-03T12:06:29.351-0400 I - [conn1] mongos.exe ...\src\mongo\util\stacktrace_win.cpp(173) mongo::printStackTrace+0x5b m30999| 2014-10-03T12:06:29.352-0400 I - [conn1] mongos.exe ...\src\mongo\util\assert_util.cpp(80) mongo::DBException::traceIfNeeded+0x13c m30999| 2014-10-03T12:06:29.352-0400 I - [conn1] mongos.exe ...\src\mongo\util\assert_util.h(116) mongo::DBException::DBException+0x84 m30999| 2014-10-03T12:06:29.352-0400 I - [conn1] mongos.exe ...\src\mongo\util\net\sock.h(166) mongo::SocketException::SocketException+0x15a m30999| 2014-10-03T12:06:29.352-0400 I - [conn1] mongos.exe ...\src\mongo\util\net\sock.cpp(806) mongo::Socket::handleRecvError+0x65c m30999| 2014-10-03T12:06:29.352-0400 I - [conn1] mongos.exe ...\src\mongo\util\net\sock.cpp(749) mongo::Socket::_recv+0xd3 m30999| 2014-10-03T12:06:29.352-0400 I - [conn1] mongos.exe ...\src\mongo\util\net\sock.cpp(734) mongo::Socket::unsafe_recv+0x3c m30999| 2014-10-03T12:06:29.352-0400 I - [conn1] mongos.exe ...\src\mongo\util\net\sock.cpp(724) mongo::Socket::recv+0x8b m30999| 2014-10-03T12:06:29.352-0400 I - [conn1] mongos.exe ...\src\mongo\util\net\message_port.cpp(180) mongo::MessagingPort::recv+0x8c m30999| 2014-10-03T12:06:29.352-0400 I - [conn1] mongos.exe ...\src\mongo\util\net\message_port.cpp(272) mongo::MessagingPort::recv+0x6c m30999| 2014-10-03T12:06:29.352-0400 I - [conn1] mongos.exe ...\src\mongo\util\net\message_port.cpp(268) mongo::MessagingPort::call+0x4e m30999| 2014-10-03T12:06:29.352-0400 I - [conn1] mongos.exe ...\src\mongo\client\dbclient.cpp(1525) mongo::DBClientConnection::call+0xa3 m30999| 2014-10-03T12:06:29.352-0400 I - [conn1] mongos.exe ...\src\mongo\client\dbclientcursor.cpp(80) mongo::DBClientCursor::init+0x131 m30999| 2014-10-03T12:06:29.352-0400 I - [conn1] mongos.exe ...\src\mongo\client\dbclient.cpp(1118) mongo::DBClientBase::query+0x132 m30999| 2014-10-03T12:06:29.352-0400 I - [conn1] mongos.exe ...\src\mongo\client\dbclientinterface.h(1272) mongo::DBClientConnection::query+0xd3 m30999| 2014-10-03T12:06:29.353-0400 I - [conn1] mongos.exe ...\src\mongo\client\dbclient.cpp(959) mongo::DBClientInterface::findN+0x104 m30999| 2014-10-03T12:06:29.353-0400 I - [conn1] mongos.exe ...\src\mongo\client\dbclient.cpp(979) mongo::DBClientInterface::findOne+0xc9 m30999| 2014-10-03T12:06:29.353-0400 I - [conn1] mongos.exe ...\src\mongo\client\dbclient.cpp(447) mongo::DBClientWithCommands::runCommand+0x18b m30999| 2014-10-03T12:06:29.353-0400 I - [conn1] mongos.exe ...\src\mongo\client\dbclient.cpp(1049) mongo::DBClientConnection::runCommand+0x51 m30999| 2014-10-03T12:06:29.353-0400 I - [conn1] mongos.exe ...\src\mongo\client\dbclient.cpp(473) mongo::DBClientWithCommands::count+0x115 m30999| 2014-10-03T12:06:29.353-0400 I - [conn1] mongos.exe ...\src\mongo\s\chunk.cpp(1101) mongo::ChunkManager::calcInitSplitsAndShards+0x2b6 m30999| 2014-10-03T12:06:29.353-0400 I - [conn1] mongos.exe ...\src\mongo\s\chunk.cpp(1147) mongo::ChunkManager::createFirstChunks+0xb1 m30999| 2014-10-03T12:06:29.353-0400 I - [conn1] mongos.exe ...\src\mongo\s\config.cpp(229) mongo::DBConfig::shardCollection+0x733 m30999| 2014-10-03T12:06:29.353-0400 I - [conn1] mongos.exe ...\src\mongo\s\commands_public.cpp(2029) mongo::dbgrid_pub_cmds::MRCmd::run+0x2063 m30999| 2014-10-03T12:06:29.353-0400 I - [conn1] mongos.exe ...\src\mongo\s\commands_public.cpp(1785) mongo::dbgrid_pub_cmds::MRCmd::run+0x65 m30999| 2014-10-03T12:06:29.353-0400 I - [conn1] mongos.exe ...\src\mongo\s\s_only.cpp(145) mongo::Command::execCommandClientBasic+0x386 m30999| 2014-10-03T12:06:29.353-0400 I - [conn1] mongos.exe ...\src\mongo\s\commands_public.cpp(2683) mongo::Command::runAgainstRegistered+0x292 m30999| 2014-10-03T12:06:29.353-0400 I - [conn1] mongos.exe ...\src\mongo\s\strategy.cpp(293) mongo::Strategy::clientCommandOp+0x75c m30999| 2014-10-03T12:06:29.353-0400 I - [conn1] mongos.exe ...\src\mongo\s\request.cpp(124) mongo::Request::process+0x48a m30999| 2014-10-03T12:06:29.354-0400 I - [conn1] mongos.exe ...\src\mongo\s\server.cpp(148) mongo::ShardedMessageHandler::process+0x129 m30999| 2014-10-03T12:06:29.354-0400 I - [conn1] mongos.exe ...\src\mongo\util\net\message_server_port.cpp(228) mongo::PortMessageServer::handleIncomingMsg+0x5e4