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

*: add system variable to turn on/off the large transaction feature #13299

Closed
wants to merge 8 commits into from

Conversation

tiancaiamao
Copy link
Contributor

What problem does this PR solve?

Before the new feature is stable, we must be able to turn on/off it.

What is changed and how it works?

Add two global/session system variables:

  • tidb_enable_large_txn
  • tidb_large_txn_size

Check List

Tests

  • Unit test

Code changes

  • Has persistent data change

Add two global/session system variables:
- tidb_enable_large_txn
- tidb_large_txn_size
@tiancaiamao
Copy link
Contributor Author

PTAL @coocood @jackysp

@codecov
Copy link

codecov bot commented Nov 8, 2019

Codecov Report

Merging #13299 into master will decrease coverage by 0.2899%.
The diff coverage is 90%.

@@              Coverage Diff               @@
##             master     #13299      +/-   ##
==============================================
- Coverage   80.4271%   80.1371%   -0.29%     
==============================================
  Files           469        469              
  Lines        113182     112179    -1003     
==============================================
- Hits          91029      89897    -1132     
- Misses        15207      15314     +107     
- Partials       6946       6968      +22

@tiancaiamao
Copy link
Contributor Author

/run-all-tests

@tiancaiamao
Copy link
Contributor Author

/rebuild

@tiancaiamao
Copy link
Contributor Author

PTAL @coocood @jackysp @cfzjywxk

case TiDBEnableLargeTxn:
s.EnableLargeTxn = TiDBOptOn(val)
case TiDBLargeTxnSize:
s.LargeTxnSize = tidbOptInt64(val, DefTiDBLargeTxnSize)
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we need to add TiDBLargeTxnSize set value check in ValidateSetSystemVar

req := c.buildPrewriteRequest(batch, txnSize)

if x := bo.ctx.Value("checkLargeTxnEnable"); x != nil {
Copy link
Member

Choose a reason for hiding this comment

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

This has some extra cost, can we avoid it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried failpoint but the concurrent test is a problem.

Copy link
Member

Choose a reason for hiding this comment

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

The test doesn't make much sense.

@@ -702,6 +702,8 @@ var defaultSysVars = []*SysVar{
{ScopeGlobal | ScopeSession, TiDBEnableVectorizedExpression, BoolToIntStr(DefEnableVectorizedExpression)},
{ScopeGlobal | ScopeSession, TiDBEnableFastAnalyze, BoolToIntStr(DefTiDBUseFastAnalyze)},
{ScopeGlobal | ScopeSession, TiDBSkipIsolationLevelCheck, BoolToIntStr(DefTiDBSkipIsolationLevelCheck)},
{ScopeGlobal | ScopeSession, TiDBEnableLargeTxn, BoolToIntStr(DefTiDBEnableLargeTxn)},
{ScopeGlobal | ScopeSession, TiDBLargeTxnSize, strconv.Itoa(DefTiDBLargeTxnSize)},
Copy link
Member

Choose a reason for hiding this comment

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

I think we can use a constant for it instead of a session variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Constant for TiDBEnableLargeTxn and TiDBLargeTxnSize ? or for DefTiDBXXX

@@ -702,6 +702,8 @@ var defaultSysVars = []*SysVar{
{ScopeGlobal | ScopeSession, TiDBEnableVectorizedExpression, BoolToIntStr(DefEnableVectorizedExpression)},
{ScopeGlobal | ScopeSession, TiDBEnableFastAnalyze, BoolToIntStr(DefTiDBUseFastAnalyze)},
{ScopeGlobal | ScopeSession, TiDBSkipIsolationLevelCheck, BoolToIntStr(DefTiDBSkipIsolationLevelCheck)},
{ScopeGlobal | ScopeSession, TiDBEnableLargeTxn, BoolToIntStr(DefTiDBEnableLargeTxn)},
Copy link
Member

Choose a reason for hiding this comment

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

I think we can use a config file option, so we can deprecate it later.

@tiancaiamao
Copy link
Contributor Author

@coocood disagree with adding session variables to turn on this new feature.

@tiancaiamao tiancaiamao deleted the enable-large-txn branch May 26, 2020 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants