forbid atomic transactions on writable, upgradable databases
authorSteven Allen <steven@stebalien.com>
Sun, 25 Oct 2015 21:30:39 +0000 (17:30 -0400)
committerDavid Bremner <david@tethera.net>
Mon, 23 Nov 2015 12:15:37 +0000 (08:15 -0400)
commitc946356cdc026b6d65662075487eb058f5c96c2b
treeb21c7606c28985d07a8932ba7aafea8b8b8a84c0
parenta79936cd6fe0b25da87ef28355b58b774bbd6369
forbid atomic transactions on writable, upgradable databases

We can't (but currently do) allow upgrades within transactions because
upgrades need their own transactions. We don't want to re-use the
current transaction because bailing out of an upgrade would mean loosing
all previous changes (because our "atomic" transactions don't commit
before hand). This gives us two options:

1. Fail at the beginning of upgrade (tell the user to end the
   transaction, upgrade, and start over).
2. Don't allow the user to start the transaction.

I went with the latter because:

1. There is no reason to call `begin_atomic` unless you intend to to
   write to the database and anyone intending to write to the database
   should upgrade it first.
2. This means that nothing inside an atomic transaction can ever fail
   with NOTMUCH_STATUS_UPGRADE_REQUIRED.
lib/database.cc