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

stats: fix trigger condition for auto analyze #5446

Merged
merged 4 commits into from
Dec 20, 2017
Merged

Conversation

alivxxx
Copy link
Contributor

@alivxxx alivxxx commented Dec 19, 2017

Because of the load by need strategy, if we have a table with no index, we may auto analyze it multiple times.

err = h.HandleAutoAnalyze(is)
c.Assert(err, IsNil)
h.Update(is)
stats = h.GetTableStats(tableInfo.ID)
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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))
Copy link
Member

Choose a reason for hiding this comment

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

Why this is changed?

Copy link
Member

Choose a reason for hiding this comment

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

Another row is inserted.

@coocood
Copy link
Member

coocood commented Dec 20, 2017

LGTM

@shenli
Copy link
Member

shenli commented Dec 20, 2017

LGTM

@shenli
Copy link
Member

shenli commented Dec 20, 2017

/run-all-tests

@shenli
Copy link
Member

shenli commented Dec 20, 2017

Should we cherry-pick this to release-1.0?

@alivxxx
Copy link
Contributor Author

alivxxx commented Dec 20, 2017

@shenli Do not need to cherry-pick, because release-1.0 do not have load by need.

@alivxxx alivxxx merged commit 55dfb67 into pingcap:master Dec 20, 2017
@alivxxx alivxxx deleted the analyze branch December 20, 2017 05:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants