]> git.notmuchmail.org Git - notmuch/commit
lib: Simplify upgrade code using a transaction
authorAustin Clements <amdragon@mit.edu>
Mon, 25 Aug 2014 17:26:03 +0000 (13:26 -0400)
committerDavid Bremner <david@tethera.net>
Sat, 30 Aug 2014 17:45:36 +0000 (10:45 -0700)
commit4a38588488ac10a8385760089912747783b767db
tree06edb67068f46626a538bd0f4e6d9933b3fe8079
parent7876bd72af95ca79542fe6560b0726f88f09ecf2
lib: Simplify upgrade code using a transaction

Previously, the upgrade was organized as two passes -- an upgrade
pass, and a separate cleanup pass -- so the database was always in a
valid state.  This change substantially simplifies this code by
performing the upgrade in a transaction and combining both passes in
to one.  This 1) eliminates a lot of duplicate code between the
passes, 2) speeds up the upgrade process, 3) makes progress reporting
more accurate, 4) eliminates the potential for stale data if the
upgrade is interrupted during the cleanup pass, and 5) makes it easier
to reason about the safety of the upgrade code.
lib/database.cc