Skip to content

Still possible to join aborted and doomed transactions #85

@jamadden

Description

@jamadden

Somewhat related to #64. Transaction.join functions the same whether a transaction is aborted or doomed or fully active. Should it allow that? What's the point of adding a resource manager to a transaction that can only be, or already has been, aborted?

On first glance this seems somewhat counterintuitive. I would have expected join to raise an exception like DoomedTransaction and AbortedTransaction instead of just allowing it. Maybe resource managers have already acquired resources before they make the call to join so it's important to be able to abort them later? But you can't currently abort transactions more than once, so that seems like an opportunity for bad behivour and leaks. join could automatically abort resource managers to cover that case.

def join(self, resource):
    if self.isAborted() or self.isDoomed():
        resource.abort()
        raise AbortedTransaction if self.isAborted() else DoomedTransaction
    # As before
    ...

The doom() documentation says the transaction is otherwise like normal, so for backwards compatibility this might be best limited to aborted transactions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions