[SERVER-16711] Do not create empty database while checking for collections Created: 04/Jan/15  Updated: 15/Jan/15  Resolved: 05/Jan/15

Status: Closed
Project: Core Server
Component/s: Index Maintenance, Storage
Affects Version/s: None
Fix Version/s: 2.8.0-rc5

Type: Bug Priority: Major - P3
Reporter: Kamran K. Assignee: Scott Hernandez (Inactive)
Resolution: Done Votes: 0
Labels: 28qa, mmapv1
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-16502 CollectionInfoCache being written wit... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 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



 Comments   
Comment by Githook User [ 07/Jan/15 ]

Author:

{u'username': u'kaloianm', u'name': u'Kaloian Manassiev', u'email': u'kaloian.manassiev@mongodb.com'}

Message: SERVER-16711 Fix failing disk/diskfull.js suite
Branch: master
https://github.com/mongodb/mongo/commit/47b931ab41098de23c967f0add30ef7b1a4bdda2

Comment by Githook User [ 07/Jan/15 ]

Author:

{u'username': u'kaloianm', u'name': u'Kaloian Manassiev', u'email': u'kaloian.manassiev@mongodb.com'}

Message: SERVER-16711 Do not require a non-empty intent set

This allows us to not have to write a bogus write intent just so we can
keep the journaling system happy.

The change in namespace_index.cpp is preparation for splitting the
database creation work into two parts - file creation and on disk
structure initialization.
Branch: master
https://github.com/mongodb/mongo/commit/67c550459e416a9ec7eabe35e38c1fed9aeccb8f

Comment by Githook User [ 05/Jan/15 ]

Author:

{u'username': u'scotthernandez', u'name': u'Scott Hernandez', u'email': u'scotthernandez@gmail.com'}

Message: SERVER-16711: no_db_created test
Branch: master
https://github.com/mongodb/mongo/commit/f6abd4665a04ac54df8b0c92302d4a1b2f9579f1

Comment by Githook User [ 05/Jan/15 ]

Author:

{u'username': u'scotthernandez', u'name': u'Scott Hernandez', u'email': u'scotthernandez@gmail.com'}

Message: SERVER-16711: do not create db for collmod if missing db/collection
Branch: master
https://github.com/mongodb/mongo/commit/d6aca8833cce3c7f23c6da5f170ee24b7ea5f24b

Comment by Githook User [ 05/Jan/15 ]

Author:

{u'username': u'scotthernandez', u'name': u'Scott Hernandez', u'email': u'scotthernandez@gmail.com'}

Message: SERVER-16711: do not create db for compact if missing db/collection
Branch: master
https://github.com/mongodb/mongo/commit/3753b0810391b237b543fdc16705d7ba90add3ce

Comment by Githook User [ 05/Jan/15 ]

Author:

{u'username': u'scotthernandez', u'name': u'Scott Hernandez', u'email': u'scotthernandez@gmail.com'}

Message: SERVER-16711: do not create db on dropIndexes if no db/collection
Branch: master
https://github.com/mongodb/mongo/commit/89d03890991e173d0b773dfe98d7bfb944bc5205

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