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

session: do not keep history when the transaction retry is disabled #11192

Merged
merged 8 commits into from Jul 12, 2019

Conversation

jackysp
Copy link
Member

@jackysp jackysp commented Jul 11, 2019

Signed-off-by: Shuaipeng Yu jackysp@gmail.com

What problem does this PR solve?

If the transaction retry is disabled, it is not necessary to add history.

What is changed and how it works?

Do not keep history when the transaction retry is disabled.

Check List

Tests

  • Unit test
  • Manual test
    Make many statements in one transaction, the memory of statement context released in this PR.

屏幕快照 2019-07-11 下午12 31 43

屏幕快照 2019-07-11 下午2 28 00

Code changes

  • Has exported function/method change

Side effects

  • Increased code complexity
  • Breaking backward compatibility
    If we don't keep history, the stmt-count-limit is useless.

Related changes

  • Need to update the documentation

Signed-off-by: Shuaipeng Yu <jackysp@gmail.com>
@jackysp jackysp added the sig/transaction SIG:Transaction label Jul 11, 2019
lonng and others added 2 commits July 11, 2019 12:48
Signed-off-by: Shuaipeng Yu <jackysp@gmail.com>
@codecov
Copy link

codecov bot commented Jul 11, 2019

Codecov Report

Merging #11192 into master will not change coverage.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             master     #11192   +/-   ##
===========================================
  Coverage   81.3852%   81.3852%           
===========================================
  Files           423        423           
  Lines         90584      90584           
===========================================
  Hits          73722      73722           
  Misses        11555      11555           
  Partials       5307       5307

session/session.go Outdated Show resolved Hide resolved
Signed-off-by: Shuaipeng Yu <jackysp@gmail.com>
}

// If retry limit is 0, the transaction could not retry.
couldRetry := sessVars.RetryLimit != 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be better.

if sessVars.RetryLimit == 0 {
   return false
}
if ... {
   return true
}
if ... {
   return true
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Signed-off-by: Shuaipeng Yu <jackysp@gmail.com>
tk.MustExec("create table history (a int)")
tk.MustExec("insert history values (1)")

// Firstly, disable retry.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Firstly enable retry?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Signed-off-by: Shuaipeng Yu <jackysp@gmail.com>
@coocood
Copy link
Member

coocood commented Jul 11, 2019

LGTM

@coocood coocood added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 11, 2019
@jackysp
Copy link
Member Author

jackysp commented Jul 11, 2019

/run-all-tests

@cfzjywxk
Copy link
Contributor

LGTM

Copy link
Contributor

@winkyao winkyao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@coocood coocood merged commit 7f3bff8 into pingcap:master Jul 12, 2019
@jackysp jackysp deleted the no_hist branch February 27, 2020 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/transaction SIG:Transaction status/LGT1 Indicates that a PR has LGTM 1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants