Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Transactions created with TxContext don't rollback (at least using the mysql driver) #731

Open
@acwest

Description

I am creating a transaction with:

session.TxContext(ctx, func(txSession db.Session) error {
 err := DoSomething(txSession)
 return err
}, nil)
DoSomething internally uses InsertReturning to insert a number of rows into a table.
If I cancel the transaction while it is running, an InsertReturning call returns an error: "context canceled", so DoSomething returns the same error. The TxContext call then returns an error: "context canceled: context canceled", which is somewhat expected behaviour, but the transaction is not rolled back and all of the rows added to the table are still there.
The expected behaviour would be for the transaction to roll back and the rows to not be commited to the table.

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

        AltStyle によって変換されたページ (->オリジナル) /