statistics: ignore system tables in stats cache#64097
statistics: ignore system tables in stats cache#64097ti-chi-bot[bot] merged 5 commits intopingcap:masterfrom
Conversation
657ec9b to
491112f
Compare
93b7a77 to
2c31275
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #64097 +/- ##
================================================
+ Coverage 72.6962% 74.7222% +2.0259%
================================================
Files 1865 1889 +24
Lines 506195 523002 +16807
================================================
+ Hits 367985 390799 +22814
+ Misses 115838 108211 -7627
- Partials 22372 23992 +1620
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
This PR prevents system tables from being cached in the statistics cache to avoid memory overhead and unnecessary cache pollution. The change addresses issues where commands like show stats_meta and show stats_healthy would cause system tables to be added to the stats cache.
Key Changes:
- Added logic to detect and skip caching pseudo table statistics for system tables
- Refactored stats healthy metrics calculation with improved code structure
- Added test coverage to verify system tables are not cached
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/statistics/handle/handle.go | Core logic to filter out system tables from stats cache using schema detection |
| pkg/statistics/handle/handletest/handle_test.go | Test case verifying system tables don't pollute the cache after show commands |
| pkg/statistics/handle/cache/statscache.go | Refactored healthy metrics calculation with cleaner bucket indexing logic |
| pkg/statistics/handle/cache/statscache_test.go | New test for UpdateStatsHealthyMetrics with mock infrastructure |
| pkg/statistics/handle/handletest/BUILD.bazel | Incremented shard count for additional test |
| pkg/statistics/handle/cache/BUILD.bazel | Added dependencies for new test utilities |
| pkg/statistics/handle/BUILD.bazel | Added filter package dependency |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
7a5d152 to
61ab8e0
Compare
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
0xPoe
left a comment
There was a problem hiding this comment.
🔢 Self-check (PR reviewed by myself and ready for feedback)
-
Code compiles successfully
-
Unit tests added
-
All tests pass
-
Bazel files updated
-
Comments added where necessary
-
PR title and description updated
-
Documentation PR created (or confirmed not needed)
-
PR size is reasonable
|
/test all |
test: fix borken tests test: fix broken tests fix: update bazel fix fix: update fix test: fix broken tests fix: bazel update fix: rename fix: better code refatcor: better code fix: better code test: assert the labels fix: remove useless file fix: make lint happy fix: correct the failpoint name fix: update comments feat: add isMemSchemaID function feat: add system schema cache refator: use IsMemSchemaID fix: make lint happy fix: move to the right place fix: remove fix doc: add comments test: assert the cache fix: make lint happy
c6a13a8 to
05db961
Compare
|
Just rebased. Nothing changed. |
|
/test all |
|
/retest |
1 similar comment
|
/retest |
|
/test all |
|
/retest |
2 similar comments
|
/retest |
|
/retest |
|
/test all |
|
/retest |
2 similar comments
|
/retest |
|
/retest |
fix: no need to assert type fix: check if the pool is nil fix
fd54cdf to
cf127b0
Compare
|
/retest |
1 similar comment
|
/retest |
|
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
|
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
What problem does this PR solve?
Issue Number: close #64080, close #57176
Problem Summary:
What changed and how does it work?
After these changes: total tables = pseudo tables + unneeded analyze tables + tables in healthy buckets.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.