Fix implicit transaction not being cleared on transact() failure
"release foo" clears the implicit outer transaction, but "rollback to foo" does not.
This commit is contained in:
parent
1297beff63
commit
ac1cbaf719
@ -10,6 +10,7 @@ impl Collection {
|
|||||||
{
|
{
|
||||||
let have_op = op.is_some();
|
let have_op = op.is_some();
|
||||||
let skip_undo_queue = op == Some(Op::SkipUndo);
|
let skip_undo_queue = op == Some(Op::SkipUndo);
|
||||||
|
let autocommit = self.storage.db.is_autocommit();
|
||||||
|
|
||||||
self.storage.begin_rust_trx()?;
|
self.storage.begin_rust_trx()?;
|
||||||
self.begin_undoable_operation(op);
|
self.begin_undoable_operation(op);
|
||||||
@ -43,7 +44,11 @@ impl Collection {
|
|||||||
// roll back on error
|
// roll back on error
|
||||||
.or_else(|err| {
|
.or_else(|err| {
|
||||||
self.discard_undo_and_study_queues();
|
self.discard_undo_and_study_queues();
|
||||||
|
if autocommit {
|
||||||
|
self.storage.rollback_trx()?;
|
||||||
|
} else {
|
||||||
self.storage.rollback_rust_trx()?;
|
self.storage.rollback_rust_trx()?;
|
||||||
|
}
|
||||||
Err(err)
|
Err(err)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user