-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
stats: fix trigger condition for auto analyze #5446
Conversation
err = h.HandleAutoAnalyze(is) | ||
c.Assert(err, IsNil) | ||
h.Update(is) | ||
stats = h.GetTableStats(tableInfo.ID) |
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.
Which assert makes sure that Analyze is not run multiple times?
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.
In line 307, we assert that the modify count is 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.
Please comment it.
@@ -298,7 +315,7 @@ func (s *testStatsUpdateSuite) TestAutoUpdate(c *C) { | |||
h.HandleAutoAnalyze(is) | |||
h.Update(is) | |||
stats = h.GetTableStats(tableInfo.ID) | |||
c.Assert(stats.Count, Equals, int64(1)) | |||
c.Assert(stats.Count, Equals, int64(2)) |
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.
Why this is changed?
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.
Another row is inserted.
LGTM |
LGTM |
/run-all-tests |
Should we cherry-pick this to release-1.0? |
@shenli Do not need to cherry-pick, because release-1.0 do not have load by need. |
Because of the load by need strategy, if we have a table with no index, we may auto analyze it multiple times.