Skip to content

executor: expose read pool task details in diagnostics#69971

Merged
ti-chi-bot[bot] merged 3 commits into
pingcap:masterfrom
lcwangchao:readpooltaskdetails
Jul 25, 2026
Merged

executor: expose read pool task details in diagnostics#69971
ti-chi-bot[bot] merged 3 commits into
pingcap:masterfrom
lcwangchao:readpooltaskdetails

Conversation

@lcwangchao

@lcwangchao lcwangchao commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

What problem does this PR solve?

Issue Number: close #69970

Problem Summary:

TiDB does not expose read-pool task scheduling and execution details, making it difficult to diagnose fairness scheduling latency from SQL diagnostics.

What changed and how does it work?

  • Upgrade kvproto and use the client-go implementation from txnkv: add readPoolTaskDetails to SnapshotRuntimeStats tikv/client-go#2025.
  • Propagate read-pool task details for ordinary Cop, PointGet, and BatchPointGet requests.
  • Add READ_POOL_TASK_DETAILS to INFORMATION_SCHEMA.SLOW_QUERY.
  • Include read_pool:{...} in EXPLAIN ANALYZE runtime statistics.
  • Add an embedded-unistore response hook and end-to-end coverage for Get, BatchGet, and Cop responses.

Example outputs

The following examples were captured from actual SQL execution against embedded unistore.

EXPLAIN ANALYZE

EXPLAIN ANALYZE
SELECT /* read_pool_cop */ *
FROM t_read_pool_details
WHERE v >= 10;
id                 estRows   actRows  task       access object              execution info                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     operator info                            memory     disk
TableReader_7      3333.33   3        root                                  time:137.2µs, open:16.8µs, close:2.38µs, loops:2, RU:0.48, cop_task: {num: 1, max: 91.3µs, proc_keys: 0, copr_cache_hit_ratio: 0.00, build_task_duration: 3.13µs, max_distsql_concurrency: 1}, fetch_resp_duration: 103µs, rpc_info:{Cop:{num_rpc:1, total_time:81.8µs}}                                                                                                                                                                                                          data:Selection_6                         357 Bytes  N/A
└─Selection_6       3333.33   3        cop[tikv]                              tikv_task:{time:64.6µs, loops:0}, read_pool:{tasks:1, poll_count:{total:4, avg:4, max:4, min:4}, dispatch_count:{total:2, max:2, min:2}, task_wall_time:{total:20ms, avg:20ms, max:20ms, min:20ms}, queue_wait:{total:6ms, avg:3ms, max:4ms, min:2ms}, wake_wait:{total:4ms, avg:4ms, max:4ms, min:4ms}, fair_queue:{enabled:true, waited_task_slices:{total:6, avg:3, max:4, min:2}}, poll_cpu:{total:8ms, avg:2ms, max:3ms, min:1ms}, poll_wall:{total:12ms, avg:3ms, max:5ms, min:2ms}}  ge(test.t_read_pool_details.v, 10)     N/A        N/A
  └─TableFullScan_5 10000.00  3        cop[tikv]  table:t_read_pool_details  tikv_task:{time:64.6µs, loops:0}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    keep order:false, stats:pseudo           N/A        N/A

Slow log

# Time: 2026-07-21T19:27:00.00983+08:00
# Txn_start_ts: 467830890826039300
# Conn_ID: 1
# Query_time: 0.000165249
# Parse_time: 0.000005791
# Compile_time: 0.000058041
# Rewrite_time: 0.000013583
# Optimize_time: 0.000026084 Opt_logical: 0.000012125 Opt_physical: 0.00001275 Opt_binding_match: 0.000003 Opt_stats_sync_wait: 0 Opt_stats_derive: 0.000006167
# Wait_TS: 0.000005125
# Cop_time: 0.000055708 Request_count: 1 Read_pool_task_details: {tasks:1, poll_count:{total:4, avg:4, max:4, min:4}, dispatch_count:{total:2, max:2, min:2}, task_wall_time:{total:20ms, avg:20ms, max:20ms, min:20ms}, queue_wait:{total:6ms, avg:3ms, max:4ms, min:2ms}, wake_wait:{total:4ms, avg:4ms, max:4ms, min:4ms}, fair_queue:{enabled:true, waited_task_slices:{total:6, avg:3, max:4, min:2}}, poll_cpu:{total:8ms, avg:2ms, max:3ms, min:1ms}, poll_wall:{total:12ms, avg:3ms, max:5ms, min:2ms}}
# DB: test
# Is_internal: false
# Digest: 9303e433dd7ac532fb4bfa21f9f65a819b19267cb37e2392ecd02ecc5cb392dc
# Stats: t_read_pool_details:stats_meta_version=pseudo[realtime_count=10000;modify_count=0]
# Num_cop_tasks: 1
# Cop_proc_avg: 0 Cop_proc_addr: store1
# Cop_wait_avg: 0 Cop_wait_addr: store1
# Mem_max: 357
# Prepared: false
# Plan_from_cache: false
# Plan_from_binding: false
# Has_more_results: false
# KV_total: 0.000050041
# PD_total: 0.000000083
# Backoff_total: 0
# Unpacked_bytes_sent_tikv_total: 538
# Unpacked_bytes_received_tikv_total: 178
# Unpacked_bytes_sent_tikv_cross_zone: 0
# Unpacked_bytes_received_tikv_cross_zone: 0
# Unpacked_bytes_sent_tiflash_total: 0
# Unpacked_bytes_received_tiflash_total: 0
# Unpacked_bytes_sent_tiflash_cross_zone: 0
# Unpacked_bytes_received_tiflash_cross_zone: 0
# Write_sql_response_total: 0
# Result_rows: 3
# Succ: true
# IsExplicitTxn: false
# IsSyncStatsFailed: false
# Plan: tidb_decode_plan('wgfwqjAJMzFfNwkwCTMzMzMuMzMJZGF0YTpTZWxlY3Rpb25fNgkzCXRpbWU6NzEuMsK1cywgb3Blbjo3wrVzLCBjbG9zZTo4MzRucywgbG9vcHM6MiwgY29wX3Rhc2s6IHtudW06IDEsIG1heDogNTIuNsK1cywgcHJvY19rZXlzOiAwLCBjb3ByX2NhY2hlX2hpdF9yYXRpbzogMC4wMCwgYnVpbGRfdGFza19kdQUaGG46IDEuMjUFishtYXhfZGlzdHNxbF9jb25jdXJyZW5jeTogMX0sIGZldGNoX3Jlc3BfZHVyYXRpb246IDUJgYBycGNfaW5mbzp7Q29wOntudW1fcnBjOjEsIHRvdGFsX3QB8XQ1MMK1c319CTM1NyBCeXRlcwlOL0EKMQkxXzYJMV85MaBnZSh0ZXN0LnRfcmVhZF9wb29sX2RldGFpbHMudiwgMTApCTMJdGlrdikVAHsFXRA0Ni4xwiFDKTYMMH0sIBU+GDp7dGFza3MBjwhwb2wB2xB1bnQ6ewWbGDo0LCBhdmcBByFUPDQsIG1pbjo0fSwgZGlzcGEB8wBjLi8ABDIsBSgBBxhpbjoyfSwgAVwQX3dhbGwJ5gB7CVcMMjBtcwlaCQoBXQ0KATg4MG1zfSwgcXVldWVfd2FpFY4ANhE2ADMBCQE1ADQFCQE0BTMId2FrNjIABSAFwgUpBGF4CRIBMgA0BTIQZmFpcl8Fajw6e2VuYWJsZWQ6dHJ1ZSwgAXkEZWQlRhhfc2xpY2VzEb4ANgm7ADMJ7S0VDDJ9fSwtQQRwdREqADgBdhBhdmc6MgEJAX8JugxpbjoxBX8lciEfETIAMQUqATMJKgxheDo1BTwN5AB9QRcBBBgKMgk0M181RRwYMTAwMDAJdAG+BDp0RhgCiCwga2VlcCBvcmRlcjpmYWxzZSwgc3RhdHM6cHNldWRvCTMJgjECIAlOL0EJTi9BCg==')
# Plan_digest: ccf4940ae2b5620eee56082e864912acc1bdbc6d080e3dccf96e9fc916e14ae3
# Binary_plan: tidb_decode_binary_plan('sAiYCqsICg1UYWJsZVJlYWRlcl83EuEFCgtTZWxlY3Rpb25fNhKhAQoPBSJQRnVsbFNjYW5fNSEBAAAAOA1PQSkAAQHweYjDQDADOAJAAkodChsKBHRlc3QSE3RfcmVhZF9wb29sX2RldGFpbHNSHmtlZXAgb3JkZXI6ZmFsc2UsIHN0YXRzOnBzZXVkb2ohdGlrdl90YXNrOnt0aW1lOjQ2LjHCtXMsIGxvb3BzOjB9cP///////////wF4////CQwEASEBhjDqbVFBKauqqqqqCqpACZAQUiJnZSgBjwAuSo4AMC52LCAxMClq2wN0aWt2dgAELCAVzIg6e3Rhc2tzOjEsIHBvbGxfY291bnQ6e3RvdGFsOjQsIGF2ZwEHCG1heAUHOGluOjR9LCBkaXNwYXRjaDYvAAQyLAUoAQcYaW46Mn0sIAFcJF93YWxsX3RpbWURVwwyMG1zCVoJCgFdDQoBODgwbXN9LCBxdWV1ZV93YWkVjgA2ETYAMwEJATUANAUJATQFMwh3YWs2MgAFIAXCBSkBxAUJAcYFMhBmYWlyXwVqPDp7ZW5hYmxlZDp0cnVlLCABeQhlZF8FwRRzbGljZXMRvgA2CbsAMwntDDQsIG0BgQh9fSwtQQRwdREqADgBbRBhdmc6MgEJAX8JugxpbjoxBX8lciEfETIAMQUqATMJKgxheDo1BTwBYwhtc31uMAIIYE8UMjACJAFAAVIQZGF0YTpd/gRaLSWJEDcxLjLCQYgUb3Blbjo3BQssY2xvc2U6ODM0bnMsTaAYMmLOAWNvcCUGIDoge251bTogMQn4ECA1Mi42BTi4cHJvY19rZXlzOiAwLCBjb3ByX2NhY2hlX2hpdF9yYXRpbzogMC4wMCwgYnVpbGQFTQhfZHUFGhhuOiAxLjI1BUgkbWF4X2Rpc3RzcUGGQG5jdXJyZW5jeTogMX0sIGZlQW4McmVzcB07ADUJgTRycGNfaW5mbzp7Q29wOgGmDF9ycGNB0kXGAF8F8gw1MMK1IUA45QJ4////////////ARgB')
# Resource_group: default
# Request_unit_read: 0.476373291015625
# Storage_from_kv: true
# Storage_from_mpp: false
# Request_unit_v2: 1.26
# Request_unit_v2_detail: total_ru:1.26, tidb_ru:1.26, tikv_ru:0.00, tiflash_ru:0.00, executor_l2:{TableReaderExecutor:3}, plan_cnt:1, plan_derive_stats_paths:1, session_parser_total:1, txn_cnt:1
select /* read_pool_cop */ * from t_read_pool_details where v >= 10;

INFORMATION_SCHEMA.SLOW_QUERY

SELECT
    query,
    cop_time,
    request_count,
    read_pool_task_details
FROM information_schema.slow_query
WHERE query =
    'select /* read_pool_batch_point_get */ * from t_read_pool_details where id in (1, 2);'
ORDER BY time DESC
LIMIT 1;
query                                                                                   cop_time  request_count  read_pool_task_details
select /* read_pool_batch_point_get */ * from t_read_pool_details where id in (1, 2);   0         0              {tasks:1, poll_count:{total:4, avg:4, max:4, min:4}, dispatch_count:{total:2, max:2, min:2}, task_wall_time:{total:20ms, avg:20ms, max:20ms, min:20ms}, queue_wait:{total:6ms, avg:3ms, max:4ms, min:2ms}, wake_wait:{total:4ms, avg:4ms, max:4ms, min:4ms}, fair_queue:{enabled:true, waited_task_slices:{total:6, avg:3, max:4, min:2}}, poll_cpu:{total:8ms, avg:2ms, max:3ms, min:1ms}, poll_wall:{total:12ms, avg:3ms, max:5ms, min:2ms}}

Check List

Tests

  • Unit test
  • Integration test
  • Manual test
  • No need to test

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Expose read-pool task scheduling and execution details in slow-query diagnostics and EXPLAIN ANALYZE output.

Tests

  • GOWORK=off ./tools/check/failpoint-go-test.sh pkg/executor -run '^TestReadPoolTaskDetailsInDiagnostics$' -count=1
  • GOWORK=off go test -tags=intest,deadlock ./pkg/util/execdetails -run '^(TestString|TestCopRuntimeStats)$' -count=1
  • GOWORK=off go test -tags=intest,deadlock ./pkg/infoschema/test/clustertablestest -run '^TestSlowQuery$' -count=1

Summary by CodeRabbit

  • New Features
    • Added read-pool task details to execution diagnostics, EXPLAIN ANALYZE, slow-query logs, and information_schema.slow_query, including runtime-statistics propagation.
    • Extended information_schema.slow_query with a new read_pool_task_details column.
  • Bug Fixes
    • Fixed slow-log column population for the read-pool task details field so it no longer falls through as an unmatched column.
  • Maintenance
    • Updated pinned TiKV/kvproto dependencies.
  • Tests
    • Added coverage for diagnostics injection/validation and refreshed slow-query and schema fixtures.

@ti-chi-bot ti-chi-bot Bot added do-not-merge/needs-tests-checked release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Jul 21, 2026
@ti-chi-bot

ti-chi-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot ti-chi-bot Bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Jul 21, 2026
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9de348f3-f0c4-4e69-b88b-20bebfea2d07

📥 Commits

Reviewing files that changed from the base of the PR and between 23d59dd and 228452d.

📒 Files selected for processing (2)
  • pkg/util/execdetails/execdetails.go
  • pkg/util/execdetails/execdetails_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • pkg/util/execdetails/execdetails.go
  • pkg/util/execdetails/execdetails_test.go

📝 Walkthrough

Walkthrough

Read-pool task details are collected from TiKV responses, propagated through runtime statistics and statement contexts, and exposed in slow-query diagnostics and EXPLAIN ANALYZE. Dependency pins and related test expectations are updated.

Changes

Read-pool diagnostics

Layer / File(s) Summary
Runtime statistics contract
pkg/util/execdetails/...
Execution and cop runtime statistics store, merge, format, and test read-pool task details.
Coprocessor response propagation
pkg/store/copr/coprocessor.go, pkg/distsql/select_result.go
Coprocessor responses extract read-pool details, and select-result paths record them in execution statistics.
Diagnostic output and validation
pkg/executor/..., pkg/infoschema/..., pkg/store/mockstore/unistore/rpc.go
Executors merge details into statement context, slow-query metadata exposes the field, and tests validate diagnostic output.
Go dependency pins
go.mod, DEPS.bzl
kvproto and client-go/v2 module versions and Bazel metadata are updated.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant TiKV
  participant Coprocessor
  participant RuntimeStats
  participant SlowQuery
  TiKV->>Coprocessor: Return ExecDetailsV2
  Coprocessor->>RuntimeStats: Record ReadPoolTaskDetails
  RuntimeStats->>SlowQuery: Serialize read-pool details
Loading

Possibly related PRs

Suggested reviewers: xuhuaiyu, yudongusa, cfzjywxk

Poem

I’m a rabbit with read-pools to share,
Carrying task details through the air.
From TiKV’s response to logs shining bright,
EXPLAIN now shows the burrow’s insight.
Hop, hop—diagnostics are clear tonight!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: exposing read-pool task details in diagnostics.
Description check ✅ Passed The description mostly matches the required template, including issue number, problem summary, changes, tests, side effects, and release note.
Linked Issues check ✅ Passed The PR addresses #69970 by surfacing read-pool metrics in slow-query diagnostics and EXPLAIN ANALYZE output.
Out of Scope Changes check ✅ Passed The dependency bumps, hooks, schema updates, and tests all support the stated diagnostics feature and appear in scope.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@lcwangchao
lcwangchao force-pushed the readpooltaskdetails branch from 0268288 to 13ad727 Compare July 24, 2026 02:55
@lcwangchao
lcwangchao marked this pull request as ready for review July 24, 2026 02:55
@ti-chi-bot ti-chi-bot Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 24, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
pkg/util/execdetails/runtime_stats.go (1)

599-607: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Doc comment doesn't capture the new parameter's non-obvious clone/merge contract.

The comment just restates the function name. Given the new readPoolTaskDetails parameter is cloned on first record but merged in-place on subsequent records (lines 619-631), documenting that asymmetry would help future readers avoid re-introducing aliasing bugs.

As per coding guidelines: "Comments SHOULD explain non-obvious intent, constraints, invariants... SHOULD NOT restate what the code already makes clear."

🤖 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 `@pkg/util/execdetails/runtime_stats.go` around lines 599 - 607, Update the doc
comment for RuntimeStatsColl.RecordCopStats to document the readPoolTaskDetails
ownership contract: the first record clones the provided details, while
subsequent records merge into the existing details in place. Preserve the
existing behavior and focus the comment on this aliasing constraint rather than
restating the method name.

Source: Coding guidelines

pkg/util/execdetails/execdetails_test.go (1)

393-393: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

No test exercises RecordCopStats's actual clone/merge branches for readPoolTaskDetails.

All three RecordCopStats call sites here pass nil; the only assertion on read-pool formatting (416-426) sets cop.readPoolTaskDetails directly, bypassing RecordCopStats. The clone-on-first-call and merge-on-repeat-call logic added in runtime_stats.go (619-631) — the path actually used when merging real coprocessor responses for the same plan node — has no direct test coverage.

Also applies to: 416-426, 747-747, 1100-1102

🤖 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 `@pkg/util/execdetails/execdetails_test.go` at line 393, Add tests that invoke
RecordCopStats with non-nil readPoolTaskDetails to cover both cloning on the
first call and merging on subsequent calls for the same plan node. Assert the
stored values after each call, and update the existing formatting test to
populate readPoolTaskDetails through RecordCopStats rather than assigning
cop.readPoolTaskDetails directly; preserve the current nil-input coverage.
🤖 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 `@pkg/util/execdetails/execdetails_test.go`:
- Line 393: Add tests that invoke RecordCopStats with non-nil
readPoolTaskDetails to cover both cloning on the first call and merging on
subsequent calls for the same plan node. Assert the stored values after each
call, and update the existing formatting test to populate readPoolTaskDetails
through RecordCopStats rather than assigning cop.readPoolTaskDetails directly;
preserve the current nil-input coverage.

In `@pkg/util/execdetails/runtime_stats.go`:
- Around line 599-607: Update the doc comment for
RuntimeStatsColl.RecordCopStats to document the readPoolTaskDetails ownership
contract: the first record clones the provided details, while subsequent records
merge into the existing details in place. Preserve the existing behavior and
focus the comment on this aliasing constraint rather than restating the method
name.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 61693938-3f8e-41da-b417-71a3302f37fa

📥 Commits

Reviewing files that changed from the base of the PR and between e09d2bd and 13ad727.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (14)
  • DEPS.bzl
  • go.mod
  • pkg/distsql/select_result.go
  • pkg/executor/batch_point_get.go
  • pkg/executor/point_get.go
  • pkg/executor/slow_query.go
  • pkg/executor/slow_query_sql_test.go
  • pkg/infoschema/tables.go
  • pkg/infoschema/test/clustertablestest/tables_test.go
  • pkg/store/copr/coprocessor.go
  • pkg/store/mockstore/unistore/rpc.go
  • pkg/util/execdetails/execdetails.go
  • pkg/util/execdetails/execdetails_test.go
  • pkg/util/execdetails/runtime_stats.go

@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 41.66667% with 35 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.5501%. Comparing base (231dad5) to head (228452d).

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #69971        +/-   ##
================================================
- Coverage   76.3266%   75.5501%   -0.7766%     
================================================
  Files          2041       2086        +45     
  Lines        559579     583026     +23447     
================================================
+ Hits         427108     440477     +13369     
- Misses       131570     140379      +8809     
- Partials        901       2170      +1269     
Flag Coverage Δ
integration 45.8268% <41.6666%> (+6.1215%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 59.8807% <ø> (ø)
parser ∅ <ø> (∅)
br 64.0465% <ø> (+1.3252%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lcwangchao
lcwangchao force-pushed the readpooltaskdetails branch from 13ad727 to b01d9df Compare July 24, 2026 03:33

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
pkg/util/execdetails/execdetails_test.go (2)

269-273: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Cover aggregation, not only initial assignment.

This single merge would also pass if the implementation overwrote instead of accumulated details. Merge two deterministic payloads and assert summed fields while confirming RequestCount remains unchanged.

As per coding guidelines, keep unit-test changes minimal and deterministic.

🤖 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 `@pkg/util/execdetails/execdetails_test.go` around lines 269 - 273, Update the
test around SyncExecDetails.MergeReadPoolTaskDetails to merge two deterministic
poolTaskDetails payloads, then assert merged ReadPoolTaskDetails fields equal
their sums while confirming RequestCount remains zero. Keep the existing initial
assignment coverage and make only the minimal test changes needed to distinguish
accumulation from overwriting.

Source: Coding guidelines


393-393: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Exercise RecordCopStats propagation instead of mutating runtime stats directly.

The test passes nil at Line 393 and then assigns cop.readPoolTaskDetails directly at Lines 416-424, so a broken RecordCopStats(..., readPoolTaskDetails, ...) propagation would remain undetected. Supply the details through RecordCopStats and assert the resulting output.

This is needed to cover the runtime-statistics contract described in the PR objectives.

Also applies to: 416-426

🤖 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 `@pkg/util/execdetails/execdetails_test.go` at line 393, Update the test around
RecordCopStats to pass readPoolTaskDetails through its corresponding argument
instead of supplying nil, remove the direct cop.readPoolTaskDetails assignment,
and assert that RecordCopStats propagates those details into the resulting
output.
🤖 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 `@pkg/util/execdetails/execdetails_test.go`:
- Around line 269-273: Update the test around
SyncExecDetails.MergeReadPoolTaskDetails to merge two deterministic
poolTaskDetails payloads, then assert merged ReadPoolTaskDetails fields equal
their sums while confirming RequestCount remains zero. Keep the existing initial
assignment coverage and make only the minimal test changes needed to distinguish
accumulation from overwriting.
- Line 393: Update the test around RecordCopStats to pass readPoolTaskDetails
through its corresponding argument instead of supplying nil, remove the direct
cop.readPoolTaskDetails assignment, and assert that RecordCopStats propagates
those details into the resulting output.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4c8b353c-ef1b-4752-bd1f-86083ef98c18

📥 Commits

Reviewing files that changed from the base of the PR and between 13ad727 and b01d9df.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (15)
  • DEPS.bzl
  • go.mod
  • pkg/distsql/select_result.go
  • pkg/executor/batch_point_get.go
  • pkg/executor/point_get.go
  • pkg/executor/slow_query.go
  • pkg/executor/slow_query_sql_test.go
  • pkg/executor/slow_query_test.go
  • pkg/infoschema/tables.go
  • pkg/infoschema/test/clustertablestest/tables_test.go
  • pkg/store/copr/coprocessor.go
  • pkg/store/mockstore/unistore/rpc.go
  • pkg/util/execdetails/execdetails.go
  • pkg/util/execdetails/execdetails_test.go
  • pkg/util/execdetails/runtime_stats.go
🚧 Files skipped from review as they are similar to previous changes (13)
  • pkg/infoschema/tables.go
  • DEPS.bzl
  • pkg/executor/slow_query.go
  • go.mod
  • pkg/store/mockstore/unistore/rpc.go
  • pkg/executor/point_get.go
  • pkg/store/copr/coprocessor.go
  • pkg/executor/batch_point_get.go
  • pkg/executor/slow_query_sql_test.go
  • pkg/distsql/select_result.go
  • pkg/util/execdetails/runtime_stats.go
  • pkg/infoschema/test/clustertablestest/tables_test.go
  • pkg/util/execdetails/execdetails.go

@lcwangchao

Copy link
Copy Markdown
Collaborator Author

/retest

@ti-chi-bot ti-chi-bot Bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jul 24, 2026

@D3Hunter D3Hunter left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rest lgtm

Comment thread pkg/util/execdetails/execdetails.go Outdated
Comment thread pkg/util/execdetails/runtime_stats.go Outdated
@ti-chi-bot ti-chi-bot Bot added approved lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jul 24, 2026
@ti-chi-bot

ti-chi-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

[LGTM Timeline notifier]

Timeline:

  • 2026-07-24 06:33:58.483308566 +0000 UTC m=+1559424.519403632: ☑️ agreed by cfzjywxk.
  • 2026-07-24 12:55:30.982264037 +0000 UTC m=+1582317.018359093: ☑️ agreed by D3Hunter.

@lcwangchao

Copy link
Copy Markdown
Collaborator Author

/hold

@ti-chi-bot ti-chi-bot Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 24, 2026
@lcwangchao
lcwangchao force-pushed the readpooltaskdetails branch from 3465a72 to 3cda80b Compare July 24, 2026 13:15
@lcwangchao
lcwangchao force-pushed the readpooltaskdetails branch from 036e0fd to 23d59dd Compare July 24, 2026 13:18
@lcwangchao

Copy link
Copy Markdown
Collaborator Author

/unhold

@ti-chi-bot ti-chi-bot Bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 24, 2026
Signed-off-by: Chao Wang <cclcwangchao@hotmail.com>
@lcwangchao
lcwangchao force-pushed the readpooltaskdetails branch from 23d59dd to 228452d Compare July 24, 2026 13:39
@ti-chi-bot

ti-chi-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cfzjywxk, D3Hunter, wjhuang2016

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

The pull request process is described 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

@lcwangchao

Copy link
Copy Markdown
Collaborator Author

/retest

@ti-chi-bot
ti-chi-bot Bot merged commit 05b396f into pingcap:master Jul 25, 2026
36 checks passed
@lcwangchao
lcwangchao deleted the readpooltaskdetails branch July 25, 2026 00:32
@lcwangchao

Copy link
Copy Markdown
Collaborator Author

/cherry-pick release-nextgen-202603

@ti-chi-bot

Copy link
Copy Markdown
Member

@lcwangchao: new pull request created to branch release-nextgen-202603: #70067.
But this PR has conflicts, please resolve them!

Details

In response to this:

/cherry-pick release-nextgen-202603

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 ti-community-infra/tichi repository.

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

Labels

approved lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

support readpool metrics for fairness schedule

5 participants