[SERVER-9100] add ability to repair or compact individual databases Created: 23/Mar/13  Updated: 10/Dec/14  Resolved: 23/Mar/13

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

Type: New Feature Priority: Major - P3
Reporter: charity majors Assignee: J Rassi
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

We have the ability to compact individual collections, or all the databases, but we don't have the ability to compact individual databases.

It takes us about a week and a half to repair all the databases; this is more time than we have available on our oplog. As a workaround, we've been compacting all of the collections individually.

Unfortunately, we've found that for databases where lots of collections have been deleted, performance can actually degrade when we compact all of the collections because it opens up a lot of holes. We start to get warnings in the mongodb.log like:

Sat Mar 23 01:24:30 [repl writer worker 16] warning: newExtent 179497 scanned

... and a query will grab the write lock for up to 2 minutes.

As a workaround, we have been taking a secondary offline and doing a mongodump and mongorestore of individual databases in order to compact them. This is really cumbersome though, and it would be much better if we could simply tell it to compact one database at a time.



 Comments   
Comment by charity majors [ 23/Mar/13 ]

ah! yep, that does it. I've read that doc many times, but somehow missed the "limited to only the current database" part of it. Thanks!

Comment by J Rassi [ 23/Mar/13 ]

This is the function of the db.repairDatabase() shell helper – perhaps you haven't come across it.

http://docs.mongodb.org/manual/reference/method/db.repairDatabase/

Does it fit your use?

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