Skip to content

topsql: support detailed IO dimensions (#355) - #361

Open
ti-chi-bot wants to merge 1 commit into
pingcap:release-8.5from
ti-chi-bot:cherry-pick-355-to-release-8.5
Open

topsql: support detailed IO dimensions (#355)#361
ti-chi-bot wants to merge 1 commit into
pingcap:release-8.5from
ti-chi-bot:cherry-pick-355-to-release-8.5

Conversation

@ti-chi-bot

Copy link
Copy Markdown
Member

This is an automated cherry-pick of #355

What problem does this PR solve?

Issue Number: ref #356

The Dashboard OP changes for detailed TopSQL IO dimensions need ng-monitoring to carry the new TiKV resource-usage data through storage and the /topsql/v1/summary API. Without this change, requests ordered by logical reads, logical writes, or RocksDB block reads cannot return the corresponding data.

Related changes:

What is changed and how it works?

  • Upgrade kvproto to consume rocksdb_block_read_count from TiKV resource-usage records.
  • Store RocksDB block-read counts for SQL/plan and Region dimensions.
  • Skip the block-read metric when every sample in a GroupTag or Region batch is zero. This prevents old TiKV nodes, where the absent protobuf field decodes to zero, from creating zero-only time series and index entries.
  • Add logical_read, logical_write, and block_read summary order modes.
  • Return logical-read bytes, logical-write bytes, and RocksDB block-read counts at SQL, plan, and grouped-summary levels.
  • Preserve the existing logical_io mode and both order_by and legacy orderBy request parameters.
  • Add query-construction, HTTP compatibility, SQL aggregation, Region aggregation, and zero-only-series tests.

Dependency compatibility

The merged kvproto revision is source-incompatible with the previous PD client and client-go revisions because those clients still reference removed keyspace fields. An isolated module-resolution check showed that upgrading kvproto, PD client, and client-go together reproduces the current go.mod exactly. The matching clients require gRPC 1.82.1, x/net 0.56.0, and the related transitive versions. lumberjack is a direct dependency because utils/logutil/rotate.go imports it.

Storage impact

  • Old TiKV nodes and supported nodes with an all-zero batch do not create the new metric series.
  • A batch containing a nonzero block-read sample stores one additional series while preserving all timestamps in that batch. The worst-case active-write increase remains one series per GroupTag or Region record.

Tests

  • GOTOOLCHAIN=go1.25.12 go test -mod=readonly ./component/topsql/store ./component/topsql/query ./component/topsql/service ./component/topsql/codec/plan ./component/topsql/subscriber ./component/topsql
  • GOTOOLCHAIN=go1.25.12 make test (all TopSQL and other packages passed; two existing config tests fail on this macOS host because its local IPv6 address is formatted without brackets)
  • GitHub CI on Go 1.25.12: format, lint, and full test suite passed.

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot ti-chi-bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR. labels Aug 28, 2026
@ti-chi-bot

ti-chi-bot Bot commented Aug 28, 2026

Copy link
Copy Markdown

This cherry pick PR is for a release branch and has not yet been approved by triage owners.
Adding the do-not-merge/cherry-pick-not-approved label.

To merge this cherry pick:

  1. It must be LGTMed and approved by the reviewers firstly.
  2. For pull requests to TiDB-x branches, it must have no failed tests.
  3. AFTER it has lgtm and approved labels, please wait for the cherry-pick merging approval from triage owners.
Details

Instructions 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.

@ti-chi-bot

ti-chi-bot Bot commented Aug 28, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign c4pt0r for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@jiong-nba

Copy link
Copy Markdown
Contributor

Superseded by #362. The automated branch contains dependency conflict markers and is not writable by the author, so the resolved release-8.5 backport was opened from the jiong-nba fork.

@jiong-nba

Copy link
Copy Markdown
Contributor

/close

@ti-chi-bot

ti-chi-bot Bot commented Aug 28, 2026

Copy link
Copy Markdown

@jiong-nba: You can't close an active issue/PR unless you authored it or you are a collaborator.

Details

In response to this:

/close

Instructions 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/cherry-pick-not-approved do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants