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

session: add a `doNotCommit` flag to transaction when `StmtCommit` fail #8918

Merged
merged 4 commits into from Jan 3, 2019

Conversation

Projects
None yet
4 participants
@tiancaiamao
Copy link
Contributor

tiancaiamao commented Jan 3, 2019

What problem does this PR solve?

If StmtCommit meets error, it should not leave dirty data in Txn.
When the operation is irreversible, it's better to mark the whole Txn as failed.

What is changed and how it works?

Add a doNotCommit flag.
If a Txn has this flag, it acts as a normal Txn, except that it can't Commit.

Check List

Tests

  • Unit test

Side effects

  • Increased code complexity

@winkyao


This change is Reviewable

_, err = tk.Exec("commit")
c.Assert(err, NotNil)

tk.MustQuery(`select * from t`).Check(testkit.Rows())

This comment has been minimized.

@winkyao

winkyao Jan 3, 2019

Member

Please add a test that error occurred during the partial StmtCommit to Transaction, and make sure there is no data consistent problem.

This comment has been minimized.

@tiancaiamao

tiancaiamao Jan 3, 2019

Contributor

Now, line 32 mock partial of the data fail...

@winkyao
Copy link
Member

winkyao left a comment

LGTM

@lysu
Copy link
Member

lysu left a comment

LGTM

@crazycs520
Copy link
Contributor

crazycs520 left a comment

LGTM

@crazycs520

This comment has been minimized.

Copy link
Contributor

crazycs520 commented Jan 3, 2019

/run-all-tests

@tiancaiamao

This comment has been minimized.

Copy link
Contributor

tiancaiamao commented Jan 3, 2019

/run-all-tests

@winkyao winkyao merged commit 41ad626 into pingcap:master Jan 3, 2019

4 checks passed

ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
idc-jenkins-ci-tidb/build Jenkins job succeeded.
Details
license/cla Contributor License Agreement is signed.
Details

@tiancaiamao tiancaiamao deleted the tiancaiamao:do-not-commit branch Jan 3, 2019

tiancaiamao added a commit to tiancaiamao/tidb that referenced this pull request Jan 3, 2019

tiancaiamao added a commit to tiancaiamao/tidb that referenced this pull request Jan 3, 2019

tiancaiamao added a commit to tiancaiamao/tidb that referenced this pull request Jan 3, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment