Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drop collection or database does not free up disk space #32

Open
ysannezzz opened this issue Aug 11, 2016 · 5 comments
Open

drop collection or database does not free up disk space #32

ysannezzz opened this issue Aug 11, 2016 · 5 comments

Comments

@ysannezzz
Copy link

We have large MongoDB database (about 400GB data file each day), MongoDB 3.2.6/3.2.7, engine rocksDB, operating system redhat 6.3.
After dropping the collection or database, the disk space used on the machine was not reclaimed.
After rming sst files which i think should by dropped by rocksdb,mongodb
can still work fine.
By the way,show dbs is not corresponding to du in linux.
Best Regards

@igorcanadi
Copy link
Contributor

Hey @ysannezzz, that's a pretty big database, nice. :)

The fix for this is to return true in CompactionFilter::IgnoreSnapshots() function here: https://github.com/facebook/rocksdb/blob/master/include/rocksdb/compaction_filter.h#L107-L115. The comments do a good job of describing this.

I was waiting until couple of RocksDB release prove this function works in production. I think enough time has passed that we can implement this. I'll try to get to this soon.

@ysannezzz
Copy link
Author

Hey @igorcanadi ,thank you for this answer.
I have changed this function to return true and recompiled mongorocks.
But drop command still doesn't free up disk space.

@igorcanadi
Copy link
Contributor

It's not immediate. You have to wait for compactions to happen as you keep writing more data into the database.

@ysannezzz
Copy link
Author

How long should i wait for compaction to happen?
I find some sst files' mtime never change even if i keep writing more data into the database.

igorsol added a commit to igorsol/mongo-rocks that referenced this issue Dec 9, 2016
…descriptor-v2

SERVER-25156 Add support for building v=2 indexes
@wolfkdy
Copy link
Collaborator

wolfkdy commented Apr 26, 2017

After dropping a database. I found the actual physical size is not reduced.
I digged into the code and found that rocksdb::experimental::SuggestCompactRange is called in RocksEngine::dropIdent.
as @igorcanadi said,

It's not immediate. You have to wait for compactions to happen as you keep writing more data into the database.

Perhaps we should put each ident(index/datarecordstore) in different column family.
After dropping a table, the related column family can be removed, which is a procedure of file-deleting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants