Example #1
0
 def abort_transaction(self, transaction: Transaction, reason):
     assert not transaction.is_read_only
     assert isinstance(transaction, UMVTransaction)
     self._locks_manager.release_all_locks(transaction.transaction_id)
     self.mark_transaction_to_remove(transaction)
     # Notice: The call to `transaction.abort(..)` invokes the user-callback that might
     # add a new transaction with the same transaction id as of the aborted transaction.
     # It is ok because we already marked the aborted transaction to remove, and by side
     # effect it has been removed from the ongoing_transactions_mapping.
     # Additionally, note that the potentially new added transaction (with the same
     # transaction id) has been added before the aborted transaction in the transactions
     # list sorted by transaction_id. So that the iteration in `run(..)` won't encounter
     # this transaction again until next loop (in RR scheduling scheme).
     transaction.abort(self, reason)