This project has moved and is read-only. For the latest updates, please go here.

Cleanup PersistentDictionary

Mar 6, 2015 at 12:45 PM

is there a possibility to make the PersistentDictionary clean up the underlying database?
I want to zip the database folder (together with other files) to make a backup/export my current project. As far as I see, most of the files will not be needed when loading the persistent dictionary again.

Additionally, it would be nice if these files could be cleaned up as soon as I exit my application. Is there any way to achieve this?

Apr 16, 2015 at 6:40 PM
As long as the database was cleanly shut down, then all you need is the database file.
The transaction log files (*.log) are needed to bring the database file to a 'clean' state.
Then there is the 'next log file' (edbtmp.log) that is pre-created, for whenever the current log file (edb.log) gets filled up.
Then there are 'reserved' log files (something like edbres01.log) so that when we run out of disk space, we'll still have some room to do some operations.
The checkpoint file (*.chk) helps to locate the databases and log files (the system was designed to have 7 databases attached to a single log stream. It is not a 1:1 mapping).
Cleaning up those 'extra' files is a fair bit of work, and can introduce some subtle problems. It's very convenient to keep the same log stream going, starting from edb00001.log, and gradually increasing. If you reset the log file stream back to generation 1, then you change the log file signature (a random number), and the signature helps match the transaction log files to the correct database.