-
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
statistics: add tests for global-stats when add and delete a single partition #23256
Conversation
@@ -304,89 +303,3 @@ func (s *testStatisticsSuite) TestCMSketchCodingTopN(c *C) { | |||
// do not panic | |||
DecodeCMSketchAndTopN([]byte{}, rows) | |||
} | |||
|
|||
func (s *testStatisticsSuite) TestMergeTopN(c *C) { |
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.
If we change here to serial test. It will cause the import cycle
.
@@ -2082,6 +2083,93 @@ func (s *testStatsSuite) TestFeedbackCounter(c *C) { | |||
c.Assert(subtraction(newNum, oldNum), Equals, 20) | |||
} | |||
|
|||
func (s *testSerialStatsSuite) TestMergeTopN(c *C) { |
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.
Just copy from the origin implementation.
@@ -318,9 +318,9 @@ func (h *Handle) MergePartitionStats2GlobalStats(sc sessionctx.Context, opts map | |||
return | |||
} | |||
globalTableInfo := globalTable.Meta() | |||
partitionNum := globalTableInfo.Partition.Num |
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 globalTableInfo.Partition.Num
do not record the added partitions. So we should use the len(globalTableInfo.Partition.Definitions)
to replace it.
@@ -506,7 +506,34 @@ func (s *testFastAnalyze) TestFastAnalyze(c *C) { | |||
c.Assert(result.Rows()[1][5], Equals, "2") | |||
c.Assert(result.Rows()[2][5], Equals, "3") | |||
*/ | |||
} | |||
|
|||
func (s *testSerialSuite2) TestFastAnalyze4GlobalStats(c *C) { |
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.
Fix the unstable test.
statistics/handle/handle_test.go
Outdated
// We did not analyze partition p1, so the value here has not changed | ||
c.Assert(globalStats.Count, Equals, int64(7)) | ||
|
||
tk.MustExec("analyze table t;") |
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 only analyze p1 here since p0 and p2 are already up-to-date, and then check if the global.count is 9.
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by writing |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 666ee02
|
/run-tics-test |
/run-all-tests |
What problem does this PR solve?
Issue Number: close #xxx
Problem Summary:
TestCMSketchCodingTopN
What is changed and how it works?
statistics/cmsketch_test.go
andstatistics/statistics_test.go
are used to avoid the race test.Related changes
pingcap/docs
/pingcap/docs-cn
:Check List
Tests
Release note