Skip to content

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

Merged
ti-chi-bot[bot] merged 15 commits intopingcap:masterfrom
windtalker:exchange_sender_op_check_writer_status_only_if_there_is_data_to_write
Jan 2, 2025
Merged

ExchangeSenderOp check writer status only if there is data to flush to MPPTunnel#9736
ti-chi-bot[bot] merged 15 commits intopingcap:masterfrom
windtalker:exchange_sender_op_check_writer_status_only_if_there_is_data_to_write

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 release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels 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

@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. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Dec 24, 2024
@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
Copy link
Contributor

@gengliqi gengliqi left a comment

Choose a reason for hiding this comment

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

LGTM

if (need_flush)
{
// the writer must has data to flush
assert(writer->hasDataToFlush());
Copy link
Contributor

Choose a reason for hiding this comment

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

How about using RUNTIME_CHECK?

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Dec 27, 2024
@windtalker windtalker force-pushed the exchange_sender_op_check_writer_status_only_if_there_is_data_to_write branch from aa254a7 to 3be2940 Compare December 30, 2024 01:50
@SeaRise
Copy link
Contributor

SeaRise commented Dec 30, 2024

/hold

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 30, 2024
Copy link
Contributor

@SeaRise SeaRise left a comment

Choose a reason for hiding this comment

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

lgtm
comment /unhold to merge pr.

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Dec 30, 2024
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Dec 30, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-12-27 11:55:43.143647796 +0000 UTC m=+92278.499652335: ☑️ agreed by gengliqi.
  • 2024-12-30 06:19:46.619098267 +0000 UTC m=+331321.975102807: ☑️ agreed by SeaRise.

Copy link
Contributor

@yibin87 yibin87 left a comment

Choose a reason for hiding this comment

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

Others LGTM

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Dec 30, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gengliqi, SeaRise, yibin87

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

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [SeaRise,gengliqi,yibin87]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@windtalker windtalker force-pushed the exchange_sender_op_check_writer_status_only_if_there_is_data_to_write branch 2 times, most recently from 3d63e2c to 5495435 Compare December 30, 2024 09:48
Signed-off-by: xufei <xufeixw@mail.ustc.edu.cn>
Signed-off-by: xufei <xufeixw@mail.ustc.edu.cn>
Signed-off-by: xufei <xufeixw@mail.ustc.edu.cn>
Signed-off-by: xufei <xufeixw@mail.ustc.edu.cn>
Signed-off-by: xufei <xufeixw@mail.ustc.edu.cn>
Signed-off-by: xufei <xufeixw@mail.ustc.edu.cn>
Signed-off-by: xufei <xufeixw@mail.ustc.edu.cn>
Signed-off-by: xufei <xufeixw@mail.ustc.edu.cn>
Signed-off-by: xufei <xufeixw@mail.ustc.edu.cn>
Signed-off-by: xufei <xufeixw@mail.ustc.edu.cn>
Signed-off-by: xufei <xufeixw@mail.ustc.edu.cn>
Signed-off-by: xufei <xufeixw@mail.ustc.edu.cn>
Signed-off-by: xufei <xufeixw@mail.ustc.edu.cn>
Signed-off-by: xufei <xufeixw@mail.ustc.edu.cn>
@windtalker windtalker force-pushed the exchange_sender_op_check_writer_status_only_if_there_is_data_to_write branch from 5495435 to ebe5a73 Compare January 2, 2025 01:54
@windtalker
Copy link
Contributor Author

/unhold

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 2, 2025
@windtalker
Copy link
Contributor Author

/hold

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 2, 2025
Signed-off-by: xufei <xufeixw@mail.ustc.edu.cn>
@windtalker
Copy link
Contributor Author

/unhold

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 2, 2025
@ti-chi-bot ti-chi-bot bot merged commit eb4d9ea into pingcap:master Jan 2, 2025
@windtalker windtalker deleted the exchange_sender_op_check_writer_status_only_if_there_is_data_to_write branch January 2, 2025 03:29
yibin87 pushed a commit to yibin87/tiflash that referenced this pull request Jan 3, 2025
…o MPPTunnel (pingcap#9736)

ref pingcap#6233

Signed-off-by: xufei <xufeixw@mail.ustc.edu.cn>
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Jan 5, 2025

@windtalker: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-integration-test 3d63e2c link true /test pull-integration-test

Full PR test history. Your PR dashboard.

Details

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. I understand the commands that are listed here.

windtalker added a commit to windtalker/tiflash that referenced this pull request Mar 30, 2025
…o MPPTunnel (pingcap#9736)

ref pingcap#6233

Signed-off-by: xufei <xufeixw@mail.ustc.edu.cn>
windtalker added a commit to windtalker/tiflash that referenced this pull request Mar 31, 2025
…o MPPTunnel (pingcap#9736)

ref pingcap#6233

Signed-off-by: xufei <xufeixw@mail.ustc.edu.cn>
@windtalker windtalker mentioned this pull request Mar 31, 2025
12 tasks
ti-chi-bot bot added a commit that referenced this pull request Apr 7, 2025
close #10058

Signed-off-by: xufei <xufeixw@mail.ustc.edu.cn>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm 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.

4 participants