Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-16711

Do not create empty database while checking for collections

    XMLWordPrintable

    Details

    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL

      Description

      This affects various commands, like createIndexes, collMod, compact and leads to errors like this since the empty database is incomplete.
      This invariant failure started appearing with commit 8bedd077 (from SERVER-16502).

      2015-01-03T20:08:31.312-0500 I -        [conn1] Invariant failure i != _collections.end() src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.cpp 841
       
      #0  0x00007ffff7bcc20b in raise (sig=5) at ../nptl/sysdeps/unix/sysv/linux/pt-raise.c:37
      #1  0x00000000018a6003 in mongo::mongo_breakpoint () at src/mongo/util/debug_util.cpp:58
      #2  0x000000000189c7f8 in mongo::breakpoint () at src/mongo/util/debug_util.h:73
      #3  0x000000000189b5b8 in mongo::invariantFailed (expr=0x1fed027 "i != _collections.end()", file=0x1fecce8 "src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.cpp", line=841)
          at src/mongo/util/assert_util.cpp:146
      #4  0x00000000016eaef0 in mongo::MMAPV1DatabaseCatalogEntry::_getNamespaceRecordStore_inlock (this=0x6d88000) at src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.cpp:841
      #5  0x00000000016eb114 in mongo::MMAPV1DatabaseCatalogEntry::_addNamespaceToNamespaceCollection_inlock (this=0x6d88000, txn=0x7ffff7fcb7b0, ns=..., options=0x7ffff7fc8440)
          at src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.cpp:866
      #6  0x00000000016eaf8d in mongo::MMAPV1DatabaseCatalogEntry::_addNamespaceToNamespaceCollection (this=0x6d88000, txn=0x7ffff7fcb7b0, ns=..., options=0x7ffff7fc8440)
          at src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.cpp:849
      #7  0x00000000016e98aa in mongo::MMAPV1DatabaseCatalogEntry::createCollection (this=0x6d88000, txn=0x7ffff7fcb7b0, ns=..., options=..., allocateDefaultSpace=true)
          at src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.cpp:631
      #8  0x0000000001261518 in mongo::Database::createCollection (this=0x33c4230, txn=0x7ffff7fcb7b0, ns=..., options=..., allocateDefaultSpace=true, createIdIndex=true) at src/mongo/db/catalog/database.cpp:509
      #9  0x000000000130146b in mongo::WriteBatchExecutor::ExecInsertsState::_lockAndCheckImpl (this=0x7ffff7fc9e20, result=0x7ffff7fc8990, intentLock=false)
          at src/mongo/db/commands/write_commands/batch_executor.cpp:1008
      #10 0x00000000013013d6 in mongo::WriteBatchExecutor::ExecInsertsState::_lockAndCheckImpl (this=0x7ffff7fc9e20, result=0x7ffff7fc8990, intentLock=true)
          at src/mongo/db/commands/write_commands/batch_executor.cpp:1003
      #11 0x000000000130188c in mongo::WriteBatchExecutor::ExecInsertsState::lockAndCheck (this=0x7ffff7fc9e20, result=0x7ffff7fc8990) at src/mongo/db/commands/write_commands/batch_executor.cpp:1026
      #12 0x0000000001301a2b in mongo::insertOne (state=0x7ffff7fc9e20, result=0x7ffff7fc8990) at src/mongo/db/commands/write_commands/batch_executor.cpp:1054
      #13 0x0000000001301cb5 in mongo::WriteBatchExecutor::execOneInsert (this=0x7ffff7fca230, state=0x7ffff7fc9e20, error=0x7ffff7fc9df8) at src/mongo/db/commands/write_commands/batch_executor.cpp:1083
      #14 0x00000000013006a4 in mongo::WriteBatchExecutor::execInserts (this=0x7ffff7fca230, request=..., errors=0x7ffff7fca0b0) at src/mongo/db/commands/write_commands/batch_executor.cpp:874
      #15 0x0000000001300117 in mongo::WriteBatchExecutor::bulkExecute (this=0x7ffff7fca230, request=..., upsertedIds=0x7ffff7fca0d0, errors=0x7ffff7fca0b0)
          at src/mongo/db/commands/write_commands/batch_executor.cpp:756
      #16 0x00000000012fe11b in mongo::WriteBatchExecutor::executeBatch (this=0x7ffff7fca230, request=..., response=0x7ffff7fca270) at src/mongo/db/commands/write_commands/batch_executor.cpp:265
      #17 0x0000000001307eb4 in mongo::WriteCmd::run (this=0x30f9410, txn=0x7ffff7fcb7b0, dbName=..., cmdObj=..., options=0, errMsg=..., result=..., fromRepl=false)
          at src/mongo/db/commands/write_commands/write_commands.cpp:144
      #18 0x0000000001323415 in mongo::_execCommand (txn=0x7ffff7fcb7b0, c=0x30f9410, dbname=..., cmdObj=..., queryOptions=0, errmsg=..., result=..., fromRepl=false) at src/mongo/db/dbcommands.cpp:1256
      #19 0x0000000001324392 in mongo::Command::execCommand (txn=0x7ffff7fcb7b0, c=0x30f9410, queryOptions=0, cmdns=0x33ba414 "test.$cmd", cmdObj=..., result=..., fromRepl=false)
          at src/mongo/db/dbcommands.cpp:1472
      #20 0x0000000001324c74 in mongo::_runCommands (txn=0x7ffff7fcb7b0, ns=0x33ba414 "test.$cmd", _cmdobj=..., b=..., anObjBuilder=..., fromRepl=false, queryOptions=0) at src/mongo/db/dbcommands.cpp:1547
      #21 0x00000000015272b4 in mongo::runCommands (txn=0x7ffff7fcb7b0, ns=0x33ba414 "test.$cmd", jsobj=..., curop=..., b=..., anObjBuilder=..., fromRepl=false, queryOptions=0) at src/mongo/db/query/find.cpp:131
      #22 0x0000000001529040 in mongo::runQuery (txn=0x7ffff7fcb7b0, m=..., q=..., curop=..., result=..., fromDBDirectClient=false) at src/mongo/db/query/find.cpp:565
      #23 0x000000000142f0ed in mongo::receivedQuery (txn=0x7ffff7fcb7b0, c=..., dbresponse=..., m=..., fromDBDirectClient=false) at src/mongo/db/instance.cpp:224
      #24 0x00000000014301ff in mongo::assembleResponse (txn=0x7ffff7fcb7b0, m=..., dbresponse=..., remote=..., fromDBDirectClient=false) at src/mongo/db/instance.cpp:394
      #25 0x000000000113310a in mongo::MyMessageHandler::process (this=0x307c1e8, m=..., port=0x30aa5d0, le=0x33c41e0) at src/mongo/db/db.cpp:195
      #26 0x00000000018c3949 in mongo::PortMessageServer::handleIncomingMsg (arg=0x30942b0) at src/mongo/util/net/message_server_port.cpp:234
      #27 0x00007ffff7bc4182 in start_thread (arg=0x7ffff7fcc700) at pthread_create.c:312
      #28 0x00007ffff6cc4efd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111


      Version: 53d7bce974d18fc4a

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              scotthernandez Scott Hernandez
              Reporter:
              kamran.khan Kamran K.
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: