Remove ODB transaction nesting
Object database transactions are currently defined in the bulk-checkin subsystem. A transaction is started with begin_odb_transaction()
and ended with end_odb_transaction()
. Transactions can be nested though. This means begin_odb_transaction()
can be invoked multiple times before invoking end_odb_transaction()
. In such cases, a transaction only truly commits when the outer most transaction is ended.
This can be rather confusing as it is difficult to know when a transaction is actually flushed and persisted. The only cases where transaction can become nested are in cache-tree.c:cache_tree_update()
and read-cache.c:add_files_to_cache()
. All other transaction are managed directly by the builtins. This nested transaction mechanism exists to allow for only a single transaction to span across an operation by ensuring nested transactions simply reuse the current transaction.
Instead, we should just avoid creating a transaction if one already exists. This ensures that invoking end_odb_transaction()
always commits the transaction.