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

ExchangeSenderOp check writer status only if there is data to flush to MPPTunnel #9736

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

windtalker
Copy link
Contributor

@windtalker windtalker commented Dec 20, 2024

What problem does this PR solve?

Issue Number: ref #6233

Problem Summary:
Currently, ExchangeSenderSinkOp check the writer status in ExchangeSenderSinkOp::prepareImpl(), so even if there is currently no data to write, the ExchangeSenderSinkOp need to check the writer status, and the pipeline task maybe blocked if the writer is not ready. In this pr, ExchangeSenderSinkOp only check the writer status if it has data to flush to MPPTunnel.

What is changed and how it works?


Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • 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

None

@ti-chi-bot ti-chi-bot bot added the release-note-none Denotes a PR that doesn't merit a release note. label Dec 20, 2024
Copy link
Contributor

ti-chi-bot bot commented Dec 20, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from windtalker, ensuring that each of them provides their approval before proceeding. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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 the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Dec 20, 2024
@windtalker
Copy link
Contributor Author

/test pull-unit-test

@windtalker
Copy link
Contributor Author

/test pull-integration-test

OperatorStatus ExchangeSenderSinkOp::tryFlush()
{
assert(buffer);
auto res = waitForWriter();
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps moving waitForWriter into Writer::write and Writer::flush would be better. This way, even if the tunnel is busy, write can still batch in memory.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean if the block's size is small, it will be cached in the writer without writting to tunnel?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, if the total block rows is smaller than batch_send_min_limit, MPPTunnel::write would not be call.
https://github.com/pingcap/tiflash/blob/master/dbms/src/Flash/Mpp/BroadcastOrPassThroughWriter.cpp#L103-L109

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea, I reimplement this pr by moving waitForWriter to Writer::flush. But waitForWriter is still needed in ExchangeSenderSinkOp::await

Copy link
Contributor

Choose a reason for hiding this comment

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

lgtm

Signed-off-by: xufei <[email protected]>
Signed-off-by: xufei <[email protected]>
Signed-off-by: xufei <[email protected]>
Signed-off-by: xufei <[email protected]>
@windtalker windtalker force-pushed the exchange_sender_op_check_writer_status_only_if_there_is_data_to_write branch from 43283c9 to f2b866d Compare December 24, 2024 03:22
@ti-chi-bot ti-chi-bot bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 24, 2024
Signed-off-by: xufei <[email protected]>
@ti-chi-bot ti-chi-bot bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Dec 24, 2024
Signed-off-by: xufei <[email protected]>
Signed-off-by: xufei <[email protected]>
Signed-off-by: xufei <[email protected]>
Signed-off-by: xufei <[email protected]>
@windtalker windtalker changed the title ExchangeSenderOp check writer status only if there is data to send ExchangeSenderOp check writer status only if there is data to flush to MPPTunnel Dec 24, 2024
Signed-off-by: xufei <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants