[SERVER-16785] Cannot toggle directoryperdb on mmapv1 Created: 09/Jan/15  Updated: 09/Jan/15  Resolved: 09/Jan/15

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Spencer Jackson Assignee: Benety Goh
Resolution: Won't Fix Votes: 0
Labels: 28qa, mmapv1
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-16567 extend data directory metadata to hol... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

As of SERVER-16567, inconsistent use of --directoryperdb across restarts will result in a startup error.

------

Creating databases and changing the value of directoryperdb will result in the databases disappearing on mmapv1.

Below are the cases tested. The database directory was purged between cases.

With mmapv1, going from off to on:

sajack@linux /home/sajack/mongo git CAP-1809 () % ./mongod --dbpath db1                                               :)
 
> use db1
switched to db db1
> db.col.insert({})
WriteResult({ "nInserted" : 1 })
> db.col.find()
{ "_id" : ObjectId("54aeb9204761b53949029dd8") }
> 
bye
 
sajack@linux /home/sajack/mongo git CAP-1809 () % ./mongod --dbpath db1 --directoryperdb                              :)
 
> use db1
switched to db db1
> db.col.find()
> show dbs
local  0.078GB

With mmapv1, going from on to off:

sajack@linux /home/sajack/mongo git CAP-1809 () % ./mongod --dbpath db1 --directoryperdb
 
> use db
switched to db db
> db.col.insert({})
WriteResult({ "nInserted" : 1 })
> db.col.find()
{ "_id" : ObjectId("54aeb9f222d567992071dbeb") }
> 
bye
 
> use db
switched to db db
> db.col.find()
> show dbs
local  0.078GB

For reference, WiredTiger works correctly as follows:

With wiredTiger, going from off to on:

sajack@linux /home/sajack/mongo git CAP-1809 () % ./mongod --storageEngine wiredTiger --dbpath db1
 
> use db
switched to db db
> db.col.insert({})
WriteResult({ "nInserted" : 1 })
> db.col.find()
{ "_id" : ObjectId("54aeba967c5aedfd996ccc01") }
> ^C
bye
 
sajack@linux /home/sajack/mongo git CAP-1809 () % ./mongod --storageEngine wiredTiger --dbpath db1 --directoryperdb
 
> use db
switched to db db
> db.col.find()
{ "_id" : ObjectId("54aeba967c5aedfd996ccc01") }

With wiredTiger, going from on to off:

sajack@linux /home/sajack/mongo git CAP-1809 () % ./mongod --storageEngine wiredTiger --dbpath db1 --directoryperdb
 
> use db
switched to db db
> db.col.insert({})
WriteResult({ "nInserted" : 1 })
> db.col.find()
{ "_id" : ObjectId("54aebb5bf3a2237c97e8594b") }
> ^C
bye
 
./mongod --storageEngine wiredTiger --dbpath db1
 
> use db
switched to db db
> db.col.find()
{ "_id" : ObjectId("54aebb5bf3a2237c97e8594b") }



 Comments   
Comment by Ramon Fernandez Marina [ 09/Jan/15 ]

I'd say this is expected behavior, but SERVER-16567 adds additional startup checks to prevent accidental toggling of directoryperdb settings.

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