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

*: move config file option tidb_txn_total_size_limit and tidb_txn_entry_size_limit to sysvar #34448

Open
wants to merge 23 commits into
base: master
Choose a base branch
from

Conversation

Alkaagr81
Copy link
Collaborator

What problem does this PR solve?

Issue Number: ref #33769

Problem Summary:

The option tidb_txn_total_size_limit and tidb_txn_entry_size_limit has historically been a config option. But based on requirements from cloud & PM it should instead be a sysvar scope Global.

What is changed and how it works?

Remove them from the config list and add them to global sysvars.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

The option `tidb_txn_total_size_limit` and `tidb_txn_entry_size_limit`  has historically been a config option. But based on requirements from cloud & PM it should instead be a sysvar scope Global.

@Alkaagr81 Alkaagr81 requested a review from a team as a code owner May 7, 2022 08:56
@ti-chi-bot
Copy link
Member

ti-chi-bot commented May 7, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • morgo
  • you06

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 7, 2022
@morgo morgo self-requested a review May 10, 2022 16:47
config/config.toml.example Outdated Show resolved Hide resolved
config/config.toml.example Outdated Show resolved Hide resolved
config/config.go Outdated Show resolved Hide resolved
executor/seqtest/seq_executor_test.go Outdated Show resolved Hide resolved
server/server_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@you06 you06 left a comment

Choose a reason for hiding this comment

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

rest LGTM

sessionctx/variable/sysvar.go Outdated Show resolved Hide resolved
sessionctx/variable/sysvar.go Outdated Show resolved Hide resolved
@Alkaagr81 Alkaagr81 requested a review from morgo May 12, 2022 18:38
@morgo
Copy link
Contributor

morgo commented May 12, 2022

/run-unit-test

config/config_test.go Outdated Show resolved Hide resolved
@morgo
Copy link
Contributor

morgo commented May 13, 2022

/run-all-tests

@ti-chi-bot ti-chi-bot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels May 13, 2022
@morgo morgo requested a review from you06 May 16, 2022 15:52
@morgo
Copy link
Contributor

morgo commented May 16, 2022

For this one, we can add upgrade (import values from config) in a followup PR. We have some PRs that have already merged that we need to followup with a bootstrap task to upgrade.

Nevermind, upgrade task has been added

session/bootstrap.go Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels May 17, 2022
kv/kv.go Outdated
@@ -46,9 +46,9 @@ const UnCommitIndexKVFlag byte = '1'
// Those limits is enforced to make sure the transaction can be well handled by TiKV.
var (
// TxnEntrySizeLimit is limit of single entry size (len(key) + len(value)).
TxnEntrySizeLimit uint64 = config.DefTxnEntrySizeLimit
TxnEntrySizeLimit = atomic.NewUint64(10485760) //DefTiDBTxnEntrySizeLimit
Copy link
Member

Choose a reason for hiding this comment

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

Why not using DefTiDBTxnEntrySizeLimit directly? BTW 10485760 is not equal to DefTiDBTxnEntrySizeLimit((6 * 1024 * 1024))

Copy link
Contributor

Choose a reason for hiding this comment

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

Afaik this is due to circular dependencies since sessionctx/variable imports kv. But I agree we can change the starting value to 6M. It will be overwritten in the startup procedure though, as the sysvar cache is populated.

// TxnTotalSizeLimit is limit of the sum of all entry size.
TxnTotalSizeLimit uint64 = config.DefTxnTotalSizeLimit
TxnTotalSizeLimit = atomic.NewUint64(100 * 1024 * 1024) //DefTiDBTxnTotalSizeLimit
Copy link
Member

Choose a reason for hiding this comment

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

Ditto

@@ -2522,7 +2522,7 @@ func (b *PlanBuilder) buildAnalyzeAllIndex(as *ast.AnalyzeTableStmt, opts map[as
}

// CMSketchSizeLimit indicates the size limit of CMSketch.
var CMSketchSizeLimit = kv.TxnEntrySizeLimit / binary.MaxVarintLen32
var CMSketchSizeLimit = kv.TxnEntrySizeLimit.Load() / binary.MaxVarintLen32
Copy link
Member

Choose a reason for hiding this comment

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

This variable is initialized once and will not be updated with the change of TxnEntrySizeLimit, it could be a risk.

@XuHuaiyu @chrysan Do you have any idea how this should work with the new tidb_entry_size_limit variable?

@bb7133
Copy link
Member

bb7133 commented May 17, 2022

/hold

We need to verify the change related to CMSketchSizeLimit.

@ti-chi-bot ti-chi-bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels May 17, 2022
@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 31, 2022
@ti-chi-bot
Copy link
Member

@Alkaagr81: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@codecov
Copy link

codecov bot commented Jul 22, 2023

Codecov Report

Merging #34448 (1eaae25) into master (9f7813c) will decrease coverage by 0.0067%.
Report is 4944 commits behind head on master.
The diff coverage is 26.3157%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #34448        +/-   ##
================================================
- Coverage   62.8182%   62.8116%   -0.0067%     
================================================
  Files           850        850                
  Lines        276679     276686         +7     
================================================
- Hits         173805     173791        -14     
- Misses        89080      89098        +18     
- Partials      13794      13797         +3     

@ti-chi-bot ti-chi-bot bot deleted a comment from ti-chi-bot Dec 19, 2023
Copy link

ti-chi-bot bot commented Apr 10, 2024

@Alkaagr81: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
idc-jenkins-ci-tidb/build 1eaae25 link true /test build
idc-jenkins-ci-tidb/check_dev 1eaae25 link true /test check-dev
idc-jenkins-ci-tidb/mysql-test 1eaae25 link true /test mysql-test
idc-jenkins-ci-tidb/check_dev_2 1eaae25 link true /test check-dev2
pull-mysql-client-test 1eaae25 link true /test pull-mysql-client-test
pull-integration-ddl-test 1eaae25 link true /test pull-integration-ddl-test
idc-jenkins-ci-tidb/unit-test 1eaae25 link true /test unit-test
pull-br-integration-test 1eaae25 link true /test pull-br-integration-test
pull-lightning-integration-test 1eaae25 link true /test pull-lightning-integration-test

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants