-
Notifications
You must be signed in to change notification settings - Fork 409
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
Fine grained partition writer optimization #6173
Fine grained partition writer optimization #6173
Conversation
Signed-off-by: yibin <huyibin@pingcap.com>
Signed-off-by: yibin <huyibin@pingcap.com>
Signed-off-by: yibin <huyibin@pingcap.com>
Signed-off-by: yibin <huyibin@pingcap.com>
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Signed-off-by: yibin <huyibin@pingcap.com>
Signed-off-by: yibin <huyibin@pingcap.com>
Signed-off-by: yibin <huyibin@pingcap.com>
Signed-off-by: yibin <huyibin@pingcap.com>
Signed-off-by: yibin <huyibin@pingcap.com>
Signed-off-by: yibin <huyibin@pingcap.com>
Signed-off-by: yibin <huyibin@pingcap.com>
/run-unit-tests |
Signed-off-by: yibin <huyibin@pingcap.com>
Signed-off-by: yibin <huyibin@pingcap.com>
…sh into fine_grained_partition_opt
/run-unit-tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
size_t rows = block.rows(); | ||
rows_in_blocks += rows; | ||
if (rows > 0) | ||
{ | ||
blocks.push_back(block); | ||
} | ||
|
||
if (static_cast<UInt64>(rows_in_blocks) >= fine_grained_shuffle_batch_size) | ||
if (blocks.size() == fine_grained_shuffle_stream_count || static_cast<UInt64>(rows_in_blocks) >= batch_send_row_limit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- So we changed the meaning of
fine_grained_shuffle_batch_size
, maybe need to talk to PM and also change the doc - Just a question: why trigger sending data when blocks.size() equals to fine_grained_shuffle_stream_count
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion and question. For 1, I'll follow. For 2, just think like this:
Previously, no fine_grained_shuffle_stream, N partitions, then one block => N blocks
With fine_grained_shuffle_stream, N partitions, M fine_grained_shuffle_stream_count, then one block => N * M blocks, thus here use blocks.size() == stream_count, can make final block close to previous block size.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. So compared to the original situation, will trigger batchWrite more frequent when blocks are small. Guess this is the reason why long tail problem
can be fix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Long tail problem is actually fixed by the "flush" interface, which will be invoked concurrently in different threads. Previously, the remain cached blocks that are below thres, will be flushed in "finishWrite" interface, which is invoked sequentially in a single thread.
Co-authored-by: SeaRise <hhssearise@foxmail.com>
Co-authored-by: SeaRise <hhssearise@foxmail.com>
Signed-off-by: yibin <huyibin@pingcap.com>
Signed-off-by: yibin <huyibin@pingcap.com>
{ | ||
/// Materialize sample_block so that header and reserved scatterColumns are full columns | ||
/// Because ser/der don't support constant columns now | ||
header = sample_block.cloneEmpty(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The column
in ColumnWithTypeAndName
can be nullptr sometimes, so I'm a little warried that HashBaseWriterHelper::materializeBlock
may meet a npe problem, how about creating the scatter columns use the type in ColumnWithTypeAndName
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
// fine_grained_shuffle_stream_count is in (0, 1024], and partition_num is uint16_t, so will not overflow. | ||
num_bucket = partition_num * fine_grained_shuffle_stream_count; | ||
partition_key_containers_for_reuse.resize(collators.size()); | ||
resetScatterColumns(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like resetScatterColumns
is only used in prepare
, it's more like initScatterColumns
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed to initScatterColumns
Signed-off-by: yibin <huyibin@pingcap.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/merge |
@yibin87: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests You only need to trigger If you have any questions about the PR merge process, please refer to pr process. 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. |
This pull request has been accepted and is ready to merge. Commit hash: 6ef1faf
|
@yibin87: Your PR was out of date, I have automatically updated it for you. At the same time I will also trigger all tests for you: /run-all-tests If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes. 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. |
close pingcap#6157 Signed-off-by: CalvinNeo <calvinneo1995@gmail.com>
What problem does this PR solve?
Issue Number: ref #6157
Problem Summary:
This PR aims to reuse memory for scattered columns and "Long tail problem".
Referenced PR: #3787
What is changed and how it works?
Check List
Tests
Side effects
Documentation
Release note