Comment 15 for bug 660307

Revision history for this message
J.P. Lacerda (jplacerda) wrote :

This has been (mostly) fixed.
I think that there are some possible improvements regarding schema upgrading / database creation.

As Seif said in #9, to replicate this:
1) Backup activity.sqlite
2) Restart the daemon
3) While "Updating sql schema" kill the daemon

The problem, however, is that this bug does not manifest in the way described above. What we are doing in the above replication is creating a new database (this is checked by new_database = not os.path.exists(file_path)), and interrupting the process half-way through. If we then apply _do_schema_upgrade on the corrupted database it will fail, as there will be column names that already exist. In short, a corrupted upgrade != a corrupted database creation, and we *cannot* mix the two together. A quick fix is to apply _do_schema_upgrade on both cases, and take a duplicate column name error as a symptom of a corrupted database creation -- this allows us to delete the database, so that the next time zeitgeist-daemon is run it is re-created.

I will be including some test cases soon :)