[SERVER-3639] --repair fails if mongodb.lock file exists (and has data) if journaling on (but there are no journal files) Created: 17/Aug/11  Updated: 15/Aug/12  Resolved: 01/Jun/12

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

Type: Bug Priority: Minor - P4
Reporter: Scott Hernandez (Inactive) Assignee: Mathias Stearn
Resolution: Done Votes: 1
Labels: journal, repair
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Minor Change
Operating System: ALL
Participants:

 Description   

Since journaling is now enabled by default (1.9.2+) then a repair will fail if the lock file has data from a previous run without journaling on. A repair should run even if there are no journal files when journaling is on (now default).

FAILS:
$mongod --port 7777 --dbpath /tmp/repairme/ --repair
Wed Aug 17 16:14:08 [initandlisten] MongoDB starting : pid=17963 port=7777 dbpath=/tmp/repairme/ 64-bit host=lamest.local
Wed Aug 17 16:14:08 [initandlisten]
Wed Aug 17 16:14:08 [initandlisten] ** NOTE: This is a development version (1.9.2) of MongoDB.
Wed Aug 17 16:14:08 [initandlisten] ** Not recommended for production.
Wed Aug 17 16:14:08 [initandlisten]
Wed Aug 17 16:14:08 [initandlisten] db version v1.9.2, pdfile version 4.5
Wed Aug 17 16:14:08 [initandlisten] git version: be8931b7eee5f6efa111cd0ad8f45ccfcffca6ca
Wed Aug 17 16:14:08 [initandlisten] build info: Darwin erh2.10gen.cc 9.6.0 Darwin Kernel Version 9.6.0: Mon Nov 24 17:37:00 PST 2008; root:xnu-1228.9.59~1/RELEASE_I386 i386 BOOST_LIB_VERSION=1_40
Wed Aug 17 16:14:08 [initandlisten] options:

{ dbpath: "/tmp/repairme/", port: 7777, repair: true }

**************
old lock file: /tmp/repairme/mongod.lock. probably means unclean shutdown,
but there are no journal files to recover.
this is likely human error or filesystem corruption.
found 1 dbs.
see: http://dochub.mongodb.org/core/repair for more information
*************
Wed Aug 17 16:14:08 [initandlisten] exception in initAndListen: 12596 old lock file, terminating
Wed Aug 17 16:14:08 dbexit:
Wed Aug 17 16:14:08 [initandlisten] shutdown: going to close listening sockets...
Wed Aug 17 16:14:08 [initandlisten] shutdown: going to flush diaglog...
Wed Aug 17 16:14:08 [initandlisten] shutdown: going to close sockets...
Wed Aug 17 16:14:08 [initandlisten] shutdown: waiting for fs preallocator...
Wed Aug 17 16:14:08 [initandlisten] shutdown: lock for final commit...
Wed Aug 17 16:14:08 [initandlisten] shutdown: final commit...
Wed Aug 17 16:14:08 [initandlisten] shutdown: closing all files...
Wed Aug 17 16:14:08 [initandlisten] closeAllFiles() finished
Wed Aug 17 16:14:08 dbexit: really exiting now

SUCCEEDS:
$mongod --port 7777 --dbpath /tmp/repairme/ --repair --nojournal
....



 Comments   
Comment by auto [ 21/Jun/12 ]

Author:

{u'date': u'2012-06-21T09:02:28-07:00', u'email': u'samk@10gen.com', u'name': u'Sam Kleinman'}

Message: minor: corrections in response to feedback on SERVER-3639 changes.
Branch: master
https://github.com/mongodb/docs/commit/96586d7f5de59a0abea30d6c6bd3cc5fab0eaeaa

Comment by auto [ 07/Jun/12 ]

Author:

{u'login': u'tychoish', u'name': u'Sam Kleinman', u'email': u'samk@10gen.com'}

Message: SERVER-3639 correnting interactions between --repair and journaling
Branch: master
https://github.com/mongodb/docs/commit/d035c024b3736531e87a14e0f0c4d2a1fbbc7f48

Comment by Mathias Stearn [ 01/Jun/12 ]

See commit Message for docs changes needed.

Comment by auto [ 01/Jun/12 ]

Author:

{u'login': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: --repair should disable journaling SERVER-3639
Branch: master
https://github.com/mongodb/mongo/commit/aee30f4ebad8e4a3fd9447ee6f49773947a06a8d

Comment by Mathias Stearn [ 17/Aug/11 ]

I think current behavior is correct (although the message might need some work). There are two cases that could cause this:

1) Crashed with --nojournal (or 1.8) and tried to repair with journaling enabled

2) journal dir is on a different device that isn't mounted.

Both are user errors. 2 could cause massive uncorrectable corruption. With 1, there is no good reason to use journalling for the repair and it would just slow it down.

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