-
Type: Improvement
-
Resolution: Won't Fix
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Storage
-
None
-
v4.0, v3.6
-
Storage NYC 2018-12-31
-
(copied to CRM)
KVStorageEngine::listDatabases() will skip databases that don't have any collections:
kv_storage_engine.cpp
void KVStorageEngine::listDatabases(std::vector<std::string>* out) const { stdx::lock_guard<stdx::mutex> lk(_dbsLock); for (DBMap::const_iterator it = _dbs.begin(); it != _dbs.end(); ++it) { if (it->second->isEmpty()) continue; out->push_back(it->first); } }
I'm unsure of why this is, but there is a legitimate use case for listing empty databases. Consider the following sequence of user operations – the user is misled into thinking the database "bloop" doesn't exist because it is totally omitted from the listDatabases output even though the database does, in fact, exist:
> use bloop switched to db bloop > db.coll.insert({x: 1}); WriteResult({ "nInserted" : 1 }) > show dbs admin 0.000GB bloop 0.000GB config 0.000GB local 0.000GB > assert(db.coll.drop()); true > show dbs admin 0.000GB config 0.000GB local 0.000GB > use BLOOP switched to db BLOOP > db.coll.insert({x: 1}) WriteResult({ "nInserted" : 0, "writeError" : { "code" : 13297, "errmsg" : "db already exists with different case already have: [bloop] trying to create [BLOOP]" } })
- depends on
-
SERVER-33272 The DatabaseHolder::close() function no longer requires a global write lock and neither does the dropDatabase command.
- Closed