Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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_enable_auto_analyze to sysvar #34643
*: move config file option tidb_enable_auto_analyze to sysvar #34643
Changes from 4 commits
0c50bed
c29fef8
8a93079
b70f443
fbf4ae2
642f1b8
59febfc
e80eb8d
ebb9112
c3b6d1a
0dea10f
70d5032
113b961
45f814d
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing the code here does not take effect actually, because
UpdateTableStatsLoop
is only called on the bootstrap stage of TiDB if you check the code inBootstrapSession()
.This is fine before because when it is changed in the configuration file, TiDB always needs to restart and the
BootstrapSession()
is called, but making it a sysvar means it the value can be changed dynamically, so:FALSE
and set toTRUE
, the auto-analyze worker will not be invoked.TRUE
and set toFALSE
, the auto-analyze worker will still be there.You can easily verify it by, for example, adding a log in
HandleAutoAnalyze()
.So my suggestion is removing the
if
here:And moving
if
to here like:So that the sysvar takes effect really.
@chrysan Please let me know if you have any comment on it, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the default value of
RunAutoAnalyze
istrue
, I think simply removing it may cause some trouble. @chrysan PTAL.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's false in the test suite. See the change in session/bootstrap.go:2012.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer to keep the variable set in ut or at least an assertion to make the ut safe no matter what has been changed in variable module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, an explicit update for UT is more solid. @Alkaagr81 could you update this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem with setting it in the test is:
This is why it uses the bootstrap to disable auto-analyze instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can however add an assertion that runautoanalyze is false. Reading the atomic value is no problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, an alternative way is to create it as another 'enhancement' issue as a backlog, then we could make this PR delivered with the next version(v6.1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forked to #34792