infoschema: fix information_schema.tikv_region_status for nextgen (#67444)#67509
Conversation
Signed-off-by: Yang Keao <yangkeao@chunibyo.icu>
|
This cherry pick PR is for a release branch and has not yet been approved by triage owners. To merge this cherry pick:
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. |
📝 WalkthroughWalkthroughThis PR addresses two bugs in Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 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)
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 |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
pkg/executor/memtable_reader.go (1)
919-924:⚠️ Potential issue | 🟠 MajorKeep filtered peer lookups on the same keyspace boundary.
The no-filter path is now keyspace-scoped, but the
StoreIDs/RegionIDsbranches below still use global PD lookups and never re-check the returned key range. In nextgen,WHERE store_id = ...orWHERE region_id = ...can still expose peer rows from other keyspaces, so visibility becomes filter-dependent. Filter those PD results againsttikvStore.GetCodec().EncodeRegionRange(nil, nil)before packing rows.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@pkg/executor/memtable_reader.go` around lines 919 - 924, The StoreIDs and RegionIDs branches (code paths checking e.extractor.StoreIDs and e.extractor.RegionIDs and calling tikvHelper.GetStores/GetRegions) perform global PD lookups and must be filtered to the current keyspace before calling e.packTiKVRegionPeersRows; update those branches to filter the returned stores/regions by checking each entry’s region key range against the current keyspace bounds produced by tikvStore.GetCodec().EncodeRegionRange(nil, nil) (i.e., compute the encoded start/end for the keyspace and drop any store/region whose region range falls outside those bounds) so that packTiKVRegionPeersRows only receives peers within the same keyspace.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@pkg/executor/memtable_reader.go`:
- Around line 919-924: The StoreIDs and RegionIDs branches (code paths checking
e.extractor.StoreIDs and e.extractor.RegionIDs and calling
tikvHelper.GetStores/GetRegions) perform global PD lookups and must be filtered
to the current keyspace before calling e.packTiKVRegionPeersRows; update those
branches to filter the returned stores/regions by checking each entry’s region
key range against the current keyspace bounds produced by
tikvStore.GetCodec().EncodeRegionRange(nil, nil) (i.e., compute the encoded
start/end for the keyspace and drop any store/region whose region range falls
outside those bounds) so that packTiKVRegionPeersRows only receives peers within
the same keyspace.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: d893763f-aa4c-41a1-a865-8f562333595c
📒 Files selected for processing (7)
pkg/executor/BUILD.bazelpkg/executor/infoschema_cluster_table_test.gopkg/executor/infoschema_reader.gopkg/executor/memtable_reader.gopkg/store/helper/helper.gotests/realtikvtest/sessiontest/BUILD.bazeltests/realtikvtest/sessiontest/infoschema_test.go
|
The test will pass after #67505 is merged. |
|
/hold |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: tangenta, tiancaiamao 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:
|
|
/retest |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## release-nextgen-20251011 #67509 +/- ##
=============================================================
Coverage ? 71.8513%
=============================================================
Files ? 1833
Lines ? 492923
Branches ? 0
=============================================================
Hits ? 354172
Misses ? 115415
Partials ? 23336
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
/unhold |
This is an automated cherry-pick of #67444
What problem does this PR solve?
Issue Number: close #67442, close #67441
Problem Summary:
information_schema.tikv_region_statususually includes all regions in all keyspaces.WHERE table_id = xxxcondition doesn't include indexes.What changed and how does it work?
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.
Summary by CodeRabbit
Release Notes
Tests
information_schema.tikv_region_statustest coverage for region splitting and index regions.Chores