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

executor: control Chunk size for TopN&Sort #9364

Merged
merged 4 commits into from
Feb 21, 2019

Conversation

qw4990
Copy link
Contributor

@qw4990 qw4990 commented Feb 20, 2019

What problem does this PR solve?

Control the number of rows in chunks returned by LimitExec.
Following up #9354, this PR is a subtask of #9166.

What is changed and how it works?

  • Modify TopN and Sort to make them support chunk size control.
  • Add some unit tests.

Check List

Tests

  • Unit test

@qw4990 qw4990 requested review from lysu and zz-jason February 20, 2019 03:30
@qw4990 qw4990 added the sig/execution SIG execution label Feb 20, 2019
@codecov-io
Copy link

codecov-io commented Feb 20, 2019

Codecov Report

Merging #9364 into master will increase coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9364      +/-   ##
==========================================
+ Coverage   67.13%   67.17%   +0.04%     
==========================================
  Files         373      373              
  Lines       78136    78135       -1     
==========================================
+ Hits        52455    52487      +32     
+ Misses      20982    20954      -28     
+ Partials     4699     4694       -5
Impacted Files Coverage Δ
executor/sort.go 84.97% <100%> (+8.16%) ⬆️
infoschema/infoschema.go 76.31% <0%> (-1.32%) ⬇️
store/tikv/lock_resolver.go 41.7% <0%> (-0.95%) ⬇️
executor/distsql.go 72.24% <0%> (+0.45%) ⬆️
executor/index_lookup_join.go 77.91% <0%> (+0.63%) ⬆️
ddl/delete_range.go 79.36% <0%> (+5.82%) ⬆️
ddl/session_pool.go 93.1% <0%> (+10.34%) ⬆️
util/systimemon/systime_mon.go 100% <0%> (+20%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 77fb909...cc83665. Read the comment docs.

@qw4990
Copy link
Contributor Author

qw4990 commented Feb 20, 2019

/run-all-tests

executor/sort.go Outdated Show resolved Hide resolved
@qw4990
Copy link
Contributor Author

qw4990 commented Feb 20, 2019

/run-all-tests

@zz-jason zz-jason changed the title make TopN&Sort support chunk size control executor: control Chunk size for TopN&Sort Feb 20, 2019
Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

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

In SortExec.fetchRowChunks(), should we set the required rows?

@qw4990
Copy link
Contributor Author

qw4990 commented Feb 20, 2019

In SortExec.fetchRowChunks(), should we set the required rows?

Sort is a pipeline breaker and fetchRowChunks() is used to fetch all data from its child to sort.
For the value of requiredRows in this function, I think we have two choices:

  1. MaxChunkSize: it indicates the child return as much data as possible once.
  2. 1: it means the child should return as quickly as possible if it has any data.

Now the choice 1 is used as before.
How do you think? @zz-jason

@zz-jason
Copy link
Member

zz-jason commented Feb 20, 2019 via email

@qw4990
Copy link
Contributor Author

qw4990 commented Feb 20, 2019

maxChunkSize is better Yuanjia Zhang notifications@github.com于2019年2月20日 周三14:47写道:

In SortExec.fetchRowChunks(), should we set the required rows? Sort is a pipeline breaker and fetchRowChunks() is used to fetch all data from its child to sort. For the value of requiredRows in this function, I think we have two choices: 1. MaxChunkSize: it indicates the child return as much data as possible once. 2. 1: it means the child should return as quickly as possible if it has any data. How do you think? @zz-jason https://github.com/zz-jason — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#9364 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AFBlG3xz6mWyY4oHPklvUc44XmbA8iXMks5vPO98gaJpZM4bEVUR .

MaxChunkSize is the default value of RequiredRows for all Chunks.
So we don't need to set it explicitly. 😃

Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

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

LGTM

@qw4990 qw4990 added the status/LGT1 Indicates that a PR has LGTM 1. label Feb 20, 2019
@qw4990
Copy link
Contributor Author

qw4990 commented Feb 20, 2019

PTAL~ @lysu

Copy link
Contributor

@lysu lysu left a comment

Choose a reason for hiding this comment

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

LGTM

@lysu lysu added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Feb 21, 2019
@qw4990
Copy link
Contributor Author

qw4990 commented Feb 21, 2019

/run-all-tests

1 similar comment
@qw4990
Copy link
Contributor Author

qw4990 commented Feb 21, 2019

/run-all-tests

@qw4990 qw4990 merged commit 7a24081 into pingcap:master Feb 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/execution SIG execution status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants