dain / leveldb

Port of LevelDB to Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: Are all files static when compaction is suspended?

lwhite1 opened this issue · comments

Hi, I'm looking to back-up a running database after ensuring that the storage and log files have ceased changing. To do this I first stop processing writes, and then call suspendCompaction(). Is this sufficient to ensure that the files have 'stopped moving'?

Related question, is it guaranteed that the compactions have stopped completely when suspendCompaction() returns?

thank you.

IIRC LevelDB doesn't "move" files, and instead creates new files by merging existing files. Once the merge is recorded, and open reads are complete, the files are removed. Looking at the code, I believe that all you need to do is call suspendCompaction and that will assure the compaction thread has stopped before returning.