Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

distsql: refine code for setting LimitSize of kvRequest #41601

Merged
merged 1 commit into from
Feb 20, 2023

Conversation

XuHuaiyu
Copy link
Contributor

@XuHuaiyu XuHuaiyu commented Feb 20, 2023

What problem does this PR solve?

Issue Number: close #41591

Problem Summary:

What is changed and how it works?

#41120 fix the problem partly.
This PR refines the code of check logic.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
    Before:
+----------------------------------+----------+---------+-----------+--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------+----------+------+
| TopN_9                           | 0.07     | 100     | root      |                                                  | time:3.28s, loops:2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | test.present.deadline_time, offset:0, count:100 | 7.73 KB  | N/A  |
| └─IndexLookUp_17                 | 0.07     | 6700    | root      | partition:p0                                     | time:3.28s, loops:9, index_task: {total_time: 2.9s, fetch_handle: 2.9s, build: 24.2µs, wait: 63.6µs}, table_task: {total_time: 1.35s, num: 7, concurrency: 5}, next: {wait_index: 1.97s, wait_table_lookup_build: 4.46ms, wait_table_lookup_resp: 1.3s}                                                                                                                                                                                                                                                                                                         |                                                 | 404.0 KB | N/A  |
|   ├─Limit_16(Build)              | 0.07     | 6700    | cop[tikv] |                                                  | time:2.89s, loops:13, cop_task: {num: 67, max: 128.9ms, min: 39.6ms, avg: 43.3ms, p95: 44.1ms, max_proc_keys: 224, p95_proc_keys: 224, rpc_num: 67, rpc_time: 2.9s, copr_cache_hit_ratio: 0.00, build_task_duration: 58.7µs, max_distsql_concurrency: 1}, tikv_task:{proc max:1ms, min:0s, avg: 134.3µs, p80:0s, p95:1ms, iters:201, tasks:67}, scan_detail: {total_process_keys: 15000, total_process_keys_size: 1260000, total_keys: 15067, get_snapshot_time: 1.8ms, rocksdb: {key_skipped_count: 15000, block: {cache_hit_count: 151}}}                     | offset:0, count:100                             | N/A      | N/A  |
|   │ └─Selection_15               | 0.07     | 15000   | cop[tikv] |                                                  | tikv_task:{proc max:1ms, min:0s, avg: 134.3µs, p80:0s, p95:1ms, iters:201, tasks:67}                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | eq(test.present.delete_time, 0)                 | N/A      | N/A  |
|   │   └─IndexRangeScan_13        | 25093.65 | 15000   | cop[tikv] | table:present, index:idx(user_id, deadline_time) | tikv_task:{proc max:1ms, min:0s, avg: 134.3µs, p80:0s, p95:1ms, iters:201, tasks:67}                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | range:[1,1], keep order:false                   | N/A      | N/A  |
|   └─TableRowIDScan_14(Probe)     | 0.07     | 6700    | cop[tikv] | table:present                                    | time:1.35s, loops:18, cop_task: {num: 7, max: 543ms, min: 41.4ms, avg: 192.5ms, p95: 543ms, max_proc_keys: 3200, p95_proc_keys: 3200, tot_proc: 128ms, rpc_num: 7, rpc_time: 1.35s, copr_cache_hit_ratio: 0.43, build_task_duration: 306.9µs, max_distsql_concurrency: 1}, tikv_task:{proc max:79ms, min:4ms, avg: 22.6ms, p80:27ms, p95:79ms, iters:33, tasks:7}, scan_detail: {total_process_keys: 5700, total_process_keys_size: 353400, total_keys: 11400, get_snapshot_time: 357µs, rocksdb: {key_skipped_count: 5700, block: {cache_hit_count: 22800}}}   | keep order:false                                | N/A      | N/A  |
+----------------------------------+----------+---------+-----------+--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------+----------+------+
6 rows in set (3.33 sec)

After:

+----------------------------------+----------+---------+-----------+--------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------+---------+------+
| id                               | estRows  | actRows | task      | access object                                    | execution info                                                                                                                                                                                                                                                                                                                                                                                                                | operator info                                   | memory  | disk |
+----------------------------------+----------+---------+-----------+--------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------+---------+------+
| TopN_9                           | 0.07     | 100     | root      |                                                  | time:85.7ms, loops:2                                                                                                                                                                                                                                                                                                                                                                                                          | test.present.deadline_time, offset:0, count:100 | 5.82 KB | N/A  |
| └─IndexLookUp_17                 | 0.07     | 100     | root      | partition:p0                                     | time:85.6ms, loops:2, index_task: {total_time: 42.2ms, fetch_handle: 42.1ms, build: 1.65µs, wait: 5.94µs}, table_task: {total_time: 43.2ms, num: 1, concurrency: 5}, next: {wait_index: 42.4ms, wait_table_lookup_build: 161.1µs, wait_table_lookup_resp: 43ms}                                                                                                                                                               |                                                 | 8.63 KB | N/A  |
|   ├─Limit_16(Build)              | 0.07     | 100     | cop[tikv] |                                                  | time:42ms, loops:2, cop_task: {num: 1, max: 41.9ms, proc_keys: 224, rpc_num: 1, rpc_time: 41.8ms, copr_cache_hit_ratio: 0.00, build_task_duration: 90.9µs, max_distsql_concurrency: 1}, tikv_task:{time:0s, loops:3}, scan_detail: {total_process_keys: 224, total_process_keys_size: 18816, total_keys: 225, get_snapshot_time: 41.2µs, rocksdb: {key_skipped_count: 224, block: {cache_hit_count: 2}}}                      | offset:0, count:100                             | N/A     | N/A  |
|   │ └─Selection_15               | 0.07     | 224     | cop[tikv] |                                                  | tikv_task:{time:0s, loops:3}                                                                                                                                                                                                                                                                                                                                                                                                  | eq(test.present.delete_time, 0)                 | N/A     | N/A  |
|   │   └─IndexRangeScan_13        | 25093.65 | 224     | cop[tikv] | table:present, index:idx(user_id, deadline_time) | tikv_task:{time:0s, loops:3}                                                                                                                                                                                                                                                                                                                                                                                                  | range:[1,1], keep order:false                   | N/A     | N/A  |
|   └─TableRowIDScan_14(Probe)     | 0.07     | 100     | cop[tikv] | table:present                                    | time:42.9ms, loops:2, cop_task: {num: 1, max: 42.8ms, proc_keys: 100, tot_proc: 2ms, rpc_num: 1, rpc_time: 42.7ms, copr_cache_hit_ratio: 0.00, build_task_duration: 22.9µs, max_distsql_concurrency: 1}, tikv_task:{time:2ms, loops:3}, scan_detail: {total_process_keys: 100, total_process_keys_size: 6200, total_keys: 200, get_snapshot_time: 75.4µs, rocksdb: {key_skipped_count: 100, block: {cache_hit_count: 400}}}   | keep order:false                                | N/A     | N/A  |
+----------------------------------+----------+---------+-----------+--------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------+---------+------+
6 rows in set (0.13 sec)
  • No code

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
Copy link
Member

ti-chi-bot commented Feb 20, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • tiancaiamao
  • wshwsh12

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added do-not-merge/needs-triage-completed 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 Feb 20, 2023
@solotzg
Copy link
Contributor

solotzg commented Feb 20, 2023

lgtm

@ti-chi-bot ti-chi-bot added needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. and removed do-not-merge/needs-triage-completed labels Feb 20, 2023
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Feb 20, 2023
@XuHuaiyu XuHuaiyu added the type/bugfix This PR fixes a bug. label Feb 20, 2023
@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Feb 20, 2023
@XuHuaiyu
Copy link
Contributor Author

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 0c3338a

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Feb 20, 2023
@ti-chi-bot ti-chi-bot merged commit f950007 into pingcap:master Feb 20, 2023
@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Feb 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 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. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Limit exec return enough data but not stop
5 participants