-
Type: Task
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
TBH, I'm not sure if the following is by design, but at minimum, it needs some warning/clarification in the documentation. Mixing databases created without '--directoryperdb' and databases created with '--directoryperdb' does not work.
If a user has an existing mongod running w/o '--directoryperdb' but restarts w/ it enabled, old databases will no longer be addressable. For example, before enabling '--directoryperdb', my dbpath looks something like:
drwxr-xr-x 2 slee wheel 68 May 8 09:41 journal -rwxr-xr-x 1 slee wheel 5 May 8 09:41 mongod.lock -rw------- 1 slee wheel 67108864 May 7 13:47 test.0 -rw------- 1 slee wheel 134217728 May 7 13:26 test.1 -rw------- 1 slee wheel 16777216 May 7 13:44 test.ns
Subsequently, I enable '--directoryperdb' but when I query for anything inside of the test database, mongod expects to find test's data files organized in the following fashion.
drwxr-xr-x 2 slee wheel 68 May 8 09:41 journal -rwxr-xr-x 1 slee wheel 5 May 8 09:41 mongod.lock -rw------- 1 slee wheel 67108864 May 7 13:47 test/test.0 -rw------- 1 slee wheel 134217728 May 7 13:26 test/test.1 -rw------- 1 slee wheel 16777216 May 7 13:44 test/test.ns
Stopping mongod, moving the test data files into a 'test' subdirectory of the dbpath root, and starting mongod --directoryperdb seems to work (w/o any deeper testing...); I can address the test database again.
This is an important distinction because a user could want to use '--directoryperdb' to take advantage of a dbpath spanning multiple disks, but the user should be aware of having to potentially migrate existing databases before enabling '--directoryperdb'.