[SERVER-4266] Need to support --repairpath outside of --dbpath with journaling on Created: 11/Nov/11  Updated: 06/Dec/22  Resolved: 21/Jun/16

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

Type: Bug Priority: Critical - P2
Reporter: Sridhar Nanjundeswaran Assignee: Backlog - Storage Execution Team
Resolution: Done Votes: 13
Labels: needs-prioritization
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

2.0.1 binaries (64 bit) on Windows 7 x64


Issue Links:
Depends
Related
related to DOCS-4196 Document that --repairpath needs to b... Closed
is related to SERVER-1379 dropdb with directoryperdb should rem... Closed
Assigned Teams:
Storage Execution
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:
Case:

 Description   

Start a new database, insert 1 document in it. Now shutdown the database and run mongod --repair --repairpath <>. This immediately crashes with
c:\mongo\mongodb-win32-x86_64-2.0.1\bin>mongod.exe --repair --repairpath c:\data\repair
Fri Nov 11 13:28:10 [initandlisten] MongoDB starting : pid=7752 port=27017 dbpath=/data/db 64-bit host=Sridhar-PC
Fri Nov 11 13:28:10 [initandlisten] db version v2.0.1, pdfile version 4.5
Fri Nov 11 13:28:10 [initandlisten] git version: 3a5cf0e2134a830d38d2d1aae7e88cac31bdd684
Fri Nov 11 13:28:10 [initandlisten] build info: windows (6, 1, 7601, 2, 'Service Pack 1') BOOST_LIB_VERSION=1_42
Fri Nov 11 13:28:10 [initandlisten] options:

{ repair: true, repairpath: "c:\data\repair" }

Fri Nov 11 13:28:10 [initandlisten] journal dir=/data/db/journal
Fri Nov 11 13:28:10 [initandlisten] recover : no journal files present, no recovery needed
Fri Nov 11 13:28:11 [initandlisten] ****
Fri Nov 11 13:28:11 [initandlisten] ****
Fri Nov 11 13:28:11 [initandlisten] need to upgrade database test with pdfile version 4.5, new version: 4.5
Fri Nov 11 13:28:11 [initandlisten] starting upgrade
Fri Nov 11 13:28:11 [initandlisten] test repairDatabase test
Fri Nov 11 13:28:11 [initandlisten] removeJournalFiles
Fri Nov 11 13:28:11 [initandlisten] warning file is not under db path? c:/data/repair/$tmp_repairDatabase_3/test /data/d
b
Fri Nov 11 13:28:11 [initandlisten] warning file is not under db path? c:/data/repair/$tmp_repairDatabase_3/test.ns /dat
a/db
Fri Nov 11 13:28:11 [initandlisten] warning file is not under db path? c:/data/repair/$tmp_repairDatabase_3/test /data/d
b
Fri Nov 11 13:28:11 [initandlisten] warning file is not under db path? c:/data/repair/$tmp_repairDatabase_3/test.0 /data
/db
Fri Nov 11 13:28:11 [initandlisten] build index test.foo

{ _id: 1 }

Fri Nov 11 13:28:11 [initandlisten] build index done 1 records 0.005 secs
Fri Nov 11 13:28:11 [initandlisten] Assertion failure _recovering db\dur_recover.cpp 235
Fri Nov 11 13:28:11 [initandlisten] dbexception in groupCommit causing immediate shutdown: 0 assertion db\dur_recover.cp
p:235
Fri Nov 11 13:28:11 gc1

Note: If you run mongod --repair --repairpath --nojournal this does not occur



 Comments   
Comment by Asya Kamsky [ 21/Jun/16 ]

This works without error with 3.2.7 both with WiredTiger and MMAPV1 storage engines.

Comment by Ernie Hershey [ 21/Nov/13 ]

We just hit this today working on MCI data. We're using the symlink workaround.

Our use case is exactly that - we're running low on space, added a new drive to use for the repair, and can't use it without symlinking into the data directory.

Comment by Ian Daniel [ 20/Aug/12 ]

A use case that this bug disallows is when the user is low on disk space and wants to repair, and brings in temporary disk for the repairpath.

Comment by Mathias Stearn [ 30/Jan/12 ]

I have reproduced this. It looks like journaling doesn't work well with files outside of --dbpath, which --repairpath is likely to use. A quick-fix would be to disallow --repairpath when using --journaling. A proper fix would likely take a day or two to get right.

Edit: to be clear, as a workaround, you can mount (or symlink to) your --repairpath volume in a subdirectory under --dbpath. For example: mongod --dbpath /data/db --repairpath /data/db/_repairPath

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