forestdb "unlinks" the old file after compaction. When the old file has no references, it will be removed. This causes an issue when the compacted file is renamed to the old file.
The following sequence of steps causes the compacted file to be deleted.
- compact a file.
- rename the new compacted file to the old file name.
- copy the file to a new location
- open the file in the new location
This will cause the file in the old location to get deleted.