pkg/planner: remove redundant visited table state in stats usage collector#68166
Conversation
state in stats usage collector
|
@pinkbit256 I've received your pull request and will start the review. I'll conduct a thorough review covering code quality, potential issues, and implementation details. ⏳ This process typically takes 10-30 minutes depending on the complexity of the changes. ℹ️ Learn more details on Pantheon AI. |
|
Hi @pinkbit256. Thanks for your PR. I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
Hi @pinkbit256. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe collector now always records visited table logical IDs in ChangesColumn Statistics Usage Collector Refactoring
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.1)Command failed Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
/ok-to-test |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #68166 +/- ##
================================================
- Coverage 77.7466% 76.8659% -0.8808%
================================================
Files 1990 1973 -17
Lines 551792 555255 +3463
================================================
- Hits 429000 426802 -2198
- Misses 121872 128321 +6449
+ Partials 920 132 -788
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
/retest |
There was a problem hiding this comment.
Pull request overview
Refactors the column stats usage collector in the planner to remove redundant “visited table” state while preserving existing behavior for both stats-load logic and plan replayer capture.
Changes:
- Removed
collectVisitedTable/visitedtblsand associated conditional tracking logic. - Renamed
visitedPhysTblIDstovisitedLogicalTblIDsto reflect that it storesDataSource.TableInfo.ID(logical/meta table ID), notDataSource.PhysicalTableID. - Reused the
FastIntSetof visited table IDs for plan replayer capture by materializing it into themap[int64]struct{}required byrecordTableRuntimeStats.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| visitedtbls map[int64]struct{} | ||
|
|
||
| // visitedLogicalTblIDs is always collected for stats-load logic and reused by plan replayer capture. | ||
| // it currently stores logical table ID (DataSource.TableInfo.ID), not ds.PhysicalTableID. |
| // Second return value: visited logical table IDs. For partitioned tables, we only record logical table IDs; | ||
| // each partition's physical table ID is recorded in tblID2PartitionIDs. | ||
| // Third return value: the visited partition IDs. Used for static partition pruning. | ||
| // Forth return value: the number of operators in the logical plan. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: 0xPoe, terry1purcell The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
What problem does this PR solve?
Issue Number: close #67912
Problem Summary:
collect_column_stats_usagemaintained redundant visited-table states for plan replayer capture.What changed and how does it work?
collectVisitedTableandvisitedtblsfrom the collector.visitedPhysTblIDsfor plan replayer table-stats recording.visitedPhysTblIDscurrently stores table meta IDs (DataSource.TableInfo.ID), notDataSource.PhysicalTableID.Check List
Tests
Unit tests:
./tools/check/failpoint-go-test.sh pkg/planner/core/rule -run 'TestSkipSystemTables|TestCollectPredicateColumns|TestCollectHistNeededColumns'./tools/check/failpoint-go-test.sh pkg/planner/core -run TestPlanReplayerCaptureRecordJsonStatsmake lintSide effects
Documentation
Release note
Summary by CodeRabbit