util: expose IA scan detail fields#2015
Conversation
Signed-off-by: Connor1996 <zbk602423539@gmail.com>
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
📝 WalkthroughWalkthroughThis PR adds IA (remote read segment) statistics tracking to ChangesScanDetail IA metrics
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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.
🧹 Nitpick comments (1)
util/execdetails.go (1)
544-570: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueIa formatting logic is correct but duplicates the trailing-comma-trim pattern.
The new
iablock reuses the same trim-trailing-comma idiom already present in therocksdb/blocksections. Since this pattern now appears three times inString(), consider extracting a small helper (e.g.trimTrailingComma(buf *bytes.Buffer)) to reduce repetition. Not blocking, purely a maintainability nit.♻️ Optional helper extraction
+func trimTrailingComma(buf *bytes.Buffer) { + if buf.Len() >= 2 && buf.Bytes()[buf.Len()-2] == ',' { + buf.Truncate(buf.Len() - 2) + } +}Then replace each inline
if buf.Bytes()[buf.Len()-2] == ',' { buf.Truncate(buf.Len() - 2) }occurrence withtrimTrailingComma(buf).🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@util/execdetails.go` around lines 544 - 570, The String() formatting in execdetails.go repeats the same trailing-comma trimming logic across the rocksdb, block, and new ia sections. Extract that repeated buf truncation pattern into a small helper such as trimTrailingComma used by String() to keep the formatting code maintainable. Update the existing inline comma-trim checks in the relevant sections to call the helper instead of duplicating the same logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@util/execdetails.go`:
- Around line 544-570: The String() formatting in execdetails.go repeats the
same trailing-comma trimming logic across the rocksdb, block, and new ia
sections. Extract that repeated buf truncation pattern into a small helper such
as trimTrailingComma used by String() to keep the formatting code maintainable.
Update the existing inline comma-trim checks in the relevant sections to call
the helper instead of duplicating the same logic.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6df27cc6-64eb-4c2f-891f-b9ab087ea821
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (3)
go.modutil/execdetails.goutil/execdetails_test.go
|
@Connor1996: The following test failed, say
Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
What changed
This exposes IA scan detail counters from
kvrpcpb.ScanDetailV2throughutil.ScanDetailand includes them in merge and string formatting. It also bumpsgithub.com/pingcap/kvprototo a version that already contains the IA fields from pingcap/kvproto#1438.Validation
The util package tests pass. Full-tree tests are currently blocked by an existing
tikvmockstore panic that reproduces on upstream/master.Summary by CodeRabbit
New Features
Bug Fixes