Database Migration and Backup
Launchpad blueprint: db-migration-and-backup
There are (at least) three cases where serializing the log database to some external format would be nice:
Migration - if we change the DB schema or change storage solution entirely
Backups - Backups? Who needs backups? And note that backups are only useful if they are stored in a format you can read in the future
Debugging - Some times it is simply nice to get a human readable dump of the entire DB
Testing - we could ship small log samples that we import prior to running some test cases, this way we don't have to populate the DB inside the unit testing code
First and foremost we need to version the database in some way. There are two key factors:
- What DB-backend do we use; Storm, Querymancer, ? They are strictly not required to use the same DB layout
- What is the version number of the schema? Ie. not the version number of Zeitgeist itself, but that of the schema
Each DB backend should for each version implement some serializer class that outputs in some serialization format set in stone. I propose that we use whatever Tracker use for their backups, I believe it is Turtle or N3. Then we need a deserializer and an importer.
It would be nice with a super simple GUI tool. Really just a dialog with OK/Cancel buttons, a progress bar and some message stating that DB migration is about to be performed and that it might thrash the system while it runs.
Here follows a work break down of the tasks needed to accomplish this:
- Define a way to version the DB.
- Define serialization format
- Write framework code for choosing the right migration path given two DBs with given versions
- Write serializer for querymancer_engine.py
- Write deserializer for querymancer_engine.py
- Write importer leveraging points 3-5
- Write simple GUI