Skip to content

Conversation

yibin87
Copy link
Contributor

@yibin87 yibin87 commented May 12, 2025

What problem does this PR solve?

Issue Number: close #61072

Problem Summary:
Problem described in #61072

What changed and how does it work?

In this PR, when index/table work failed, we first check if context is cancelled. And only log errors when context is not cancelled. Doesn't use WithCancelCause function to pass cancel cause here, since the actual root cause is limit executor quit quitely, by returning empty data.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
    Use tpch, sf=1 benchmark, add index for orders table:
    alter table orders add index(o_orderdate);
    Then execute the following sql and check tidb.log to see if "table reader fetch next chunk failed" log doesn't exists any more:
+----------------------------------+---------+---------+-----------+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------+------+
| id                               | estRows | actRows | task      | access object                           | execution info                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | operator info                                                                           | memory  | disk |
+----------------------------------+---------+---------+-----------+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------+------+
| Limit_9                          | 1.00    | 1       | root      |                                         | time:1.21ms, open:4.29µs, close:123.8µs, loops:2, RU:6.39                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | offset:0, count:1                                                                       | N/A     | N/A  |
| └─IndexLookUp_18                 | 1.00    | 1       | root      |                                         | time:1.2ms, open:2.13µs, close:111.9µs, loops:1, index_task: {total_time: 638.4µs, fetch_handle: 633.6µs, build: 1.5µs, wait: 3.29µs}, table_task: {total_time: 2.83ms, num: 6, concurrency: 5}, next: {wait_index: 275µs, wait_table_lookup_build: 14.3µs, wait_table_lookup_resp: 788.6µs}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |                                                                                         | 80.4 KB | N/A  |
|   ├─IndexRangeScan_14(Build)     | 3.00    | 1696    | cop[tikv] | table:b, index:o_orderdate(O_ORDERDATE) | time:1.09ms, open:0s, close:0s, loops:9, cop_task: {num: 3, max: 461.5µs, min: 238.7µs, avg: 347.2µs, p95: 461.5µs, max_proc_keys: 992, p95_proc_keys: 992, tot_proc: 401.6µs, tot_wait: 72.1µs, copr_cache_hit_ratio: 0.00, build_task_duration: 2.54µs, max_distsql_concurrency: 1}, rpc_info:{Cop:{num_rpc:3, total_time:1.03ms}}, tikv_task:{proc max:1ms, min:0s, avg: 333.3µs, p80:1ms, p95:1ms, iters:12, tasks:3}, scan_detail: {total_process_keys: 1696, total_process_keys_size: 78016, total_keys: 1699, get_snapshot_time: 17µs, rocksdb: {key_skipped_count: 1696, block: {cache_hit_count: 12}}}, time_detail: {total_process_time: 401.6µs, total_wait_time: 72.1µs, total_kv_read_wall_time: 1ms, tikv_grpc_process_time: 20.5µs, tikv_grpc_wait_time: 668µs, tikv_wall_time: 689.8µs}                      | range:(1992-01-01,1992-01-31), keep order:false, stats:partial[o_custkey:unInitialized] | N/A     | N/A  |
|   └─Limit_17(Probe)              | 1.00    | 2       | cop[tikv] |                                         | total_time:2.44ms, total_open:0s, total_close:79.8µs, loops:8, cop_task: {num: 4, max: 555.9µs, min: 0s, avg: 263.3µs, p95: 555.9µs, max_proc_keys: 32, p95_proc_keys: 32, tot_proc: 508.3µs, tot_wait: 51.5µs, copr_cache_hit_ratio: 0.00, build_task_duration: 19.5µs, max_distsql_concurrency: 1, max_extra_concurrency: 1}, rpc_info:{Cop:{num_rpc:4, total_time:1.48ms}, rpc_errors:{context canceled:2}}, tikv_task:{proc max:0s, min:0s, avg: 0s, p80:0s, p95:0s, iters:2, tasks:2}, scan_detail: {total_process_keys: 64, total_process_keys_size: 9545, total_keys: 64, get_snapshot_time: 24.4µs, rocksdb: {block: {cache_hit_count: 128}}}, time_detail: {total_process_time: 508.3µs, total_wait_time: 51.5µs, tikv_grpc_process_time: 33.8µs, tikv_grpc_wait_time: 676.5µs, tikv_wall_time: 711µs}              | offset:0, count:1                                                                       | N/A     | N/A  |
|     └─Selection_16               | 1.00    | 24      | cop[tikv] |                                         | tikv_task:{proc max:0s, min:0s, avg: 0s, p80:0s, p95:0s, iters:2, tasks:2}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | gt(test.orders.o_custkey, 100000)                                                       | N/A     | N/A  |
|       └─TableRowIDScan_15        | 3.00    | 64      | cop[tikv] | table:b                                 | tikv_task:{proc max:0s, min:0s, avg: 0s, p80:0s, p95:0s, iters:2, tasks:2}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | keep order:false, stats:partial[o_custkey:unInitialized]                                | N/A     | N/A  |
+----------------------------------+---------+---------+-----------+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------+------+
  • No need to test
    • I checked and no code files have been changed.

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

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 12, 2025
Copy link

tiprow bot commented May 12, 2025

Hi @yibin87. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

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.

@yibin87
Copy link
Contributor Author

yibin87 commented May 12, 2025

/cc @XuHuaiyu @zimulala

@ti-chi-bot ti-chi-bot bot requested review from XuHuaiyu and zimulala May 12, 2025 02:59
@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels May 12, 2025
Copy link

codecov bot commented May 12, 2025

Codecov Report

Attention: Patch coverage is 33.33333% with 6 lines in your changes missing coverage. Please review.

Project coverage is 73.5967%. Comparing base (f4d2318) to head (4b588ab).
Report is 25 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #61073        +/-   ##
================================================
+ Coverage   73.1387%   73.5967%   +0.4579%     
================================================
  Files          1724       1724                
  Lines        477000     478478      +1478     
================================================
+ Hits         348872     352144      +3272     
+ Misses       106705     104891      -1814     
- Partials      21423      21443        +20     
Flag Coverage Δ
integration 42.5461% <0.0000%> (?)
unit 72.3982% <33.3333%> (+0.0309%) ⬆️

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

Components Coverage Δ
dumpling 52.7804% <ø> (ø)
parser ∅ <ø> (∅)
br 47.5111% <ø> (-0.0431%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

ti-chi-bot bot commented May 12, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: XuHuaiyu, zimulala

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

The pull request process is described here

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

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels May 12, 2025
Copy link

ti-chi-bot bot commented May 12, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-05-12 03:13:30.908044533 +0000 UTC m=+328477.056005750: ☑️ agreed by XuHuaiyu.
  • 2025-05-12 03:22:12.083230698 +0000 UTC m=+328998.231191936: ☑️ agreed by zimulala.

@ti-chi-bot ti-chi-bot bot merged commit f7149b7 into pingcap:master May 12, 2025
23 of 24 checks passed
@XuHuaiyu XuHuaiyu added needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. affects-8.1 This bug affects the 8.1.x(LTS) versions. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. labels May 14, 2025
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.1: #61112.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.5: #61113.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-8.5: #61114.

@XuHuaiyu XuHuaiyu added affects-8.1 This bug affects the 8.1.x(LTS) versions. and removed affects-8.1 This bug affects the 8.1.x(LTS) versions. labels May 14, 2025
@XuHuaiyu XuHuaiyu added the needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. label May 14, 2025
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-8.1: #61115.

ti-chi-bot bot pushed a commit that referenced this pull request May 15, 2025
ti-chi-bot bot pushed a commit that referenced this pull request May 15, 2025
ti-chi-bot bot pushed a commit that referenced this pull request May 15, 2025
@ti-chi-bot ti-chi-bot bot removed the needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. label Jun 12, 2025
ti-chi-bot bot pushed a commit that referenced this pull request Jun 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't print error log for indexLookUpExecutor when context canceled
4 participants