Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.3] dont rollback to savepoints on deadlock #15932

Merged

Conversation

halaei
Copy link
Contributor

@halaei halaei commented Oct 15, 2016

This fix only applies to calls to DB::transaction() inside another transaction. e.g.:

\DB::transaction(function(){
    ...
    //directly or indirectly call another transaction:
    \DB::transaction(function() {
        ...
        //dead lock!
        ...
    }, 2);//attempt twice
}, 2);//attempt twice

Deadlock in the inner transaction() function means the DBMS has rolled back the outer transaction as well. So the inner transaction function should not attempt again. It only should decrement Connection::transactions before throwing exception, so that the outer transaction() function attempts again.

Here is a quote from MySQL Reference Manual:

A transaction deadlock causes InnoDB to roll back the entire transaction. Retry the whole transaction when this happens.

@taylorotwell
Copy link
Member

Needs a full description of what this fixes, etc.

@taylorotwell taylorotwell merged commit 5e34cd1 into laravel:5.3 Oct 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants