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

Pipeline: use notify instead of polling for ExchangeSender #9072

Merged
merged 19 commits into from
Sep 2, 2024

Conversation

SeaRise
Copy link
Contributor

@SeaRise SeaRise commented May 22, 2024

What problem does this PR solve?

Issue Number: ref #8869

Problem Summary:

What is changed and how it works?

use waitForWritable() to replace isWritable()

    auto res = writer->waitForWritable();
    switch (res)
    {
    case WaitResult::Ready:
        return OperatorStatus::NEED_INPUT;
    case WaitResult::WaitForPolling:
        return OperatorStatus::WAITING;
    case WaitResult::WaitForNotify:
        return OperatorStatus::WAIT_FOR_NOTIFY;
    }

Check List

Tests

Tested tpch50, no performance regression

  • 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/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 22, 2024
@SeaRise
Copy link
Contributor Author

SeaRise commented May 22, 2024

/cc @gengliqi @windtalker

@ti-chi-bot ti-chi-bot bot requested review from gengliqi and windtalker May 22, 2024 11:04
@SeaRise
Copy link
Contributor Author

SeaRise commented May 22, 2024

I don't understand why there's always an error saying "Error: found files NOT formatted dbms/src/Flash/Mpp/tests/gtest_mpptunnel.cpp," in pull-integration-test even though I've already formatted it locally.

@SeaRise
Copy link
Contributor Author

SeaRise commented May 23, 2024

I don't understand why there's always an error saying "Error: found files NOT formatted dbms/src/Flash/Mpp/tests/gtest_mpptunnel.cpp," in pull-integration-test even though I've already formatted it locally.

Thanks a lot, @Lloyd-Pottiger .

@SeaRise
Copy link
Contributor Author

SeaRise commented Jun 5, 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 Jun 5, 2024
@SeaRise
Copy link
Contributor Author

SeaRise commented Jun 5, 2024

/hold cancel

@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 Jun 5, 2024
if (likely(dag_context))
{
// Cancel the tunnel_set here to prevent pipeline tasks waiting in the WAIT_FOR_NOTIFY state from never being notified.
if (dag_context->tunnel_set)
Copy link
Contributor

Choose a reason for hiding this comment

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

The tunnels will be always closed at the destruct of mpp task, is that too late so you need to close it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, if a pipeline task is in the wait_for_notify state, and another pipeline task throws an error and cannot terminate the query, then abortMPPTunnel cannot be called, this is a deadlock.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK

abortReceivers();
abortQueryExecutor();
Copy link
Contributor

Choose a reason for hiding this comment

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

why abort receiver first

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is currently useless and is only used to notify exchange_receiver for the same reason as #9072 (comment).

@SeaRise SeaRise requested a review from windtalker July 10, 2024 09:16
case WaitResult::Ready:
return OperatorStatus::NEED_INPUT;
case WaitResult::WaitForPolling:
return OperatorStatus::WAITING;
Copy link
Contributor

Choose a reason for hiding this comment

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

if return WAITING, it will still use wait reactor thread to check if it is ready, is my understand right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, you are right.
Here only wait for tunnel ready will return WaitForPolling.

if (likely(dag_context))
{
// Cancel the tunnel_set here to prevent pipeline tasks waiting in the WAIT_FOR_NOTIFY state from never being notified.
if (dag_context->tunnel_set)
Copy link
Contributor

Choose a reason for hiding this comment

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

OK

@SeaRise SeaRise requested a review from windtalker July 25, 2024 07:14
Copy link
Contributor

@windtalker windtalker left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Jul 25, 2024
@ti-chi-bot ti-chi-bot bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 25, 2024
@ti-chi-bot ti-chi-bot bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 26, 2024
@@ -139,6 +139,9 @@ class GRPCSendQueue

bool isWritable() const { return send_queue.isWritable(); }

void registerPipeReadTask(TaskPtr && task) { send_queue.registerPipeReadTask(std::move(task)); }
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems these registerPipeReadTasks are not used in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, they are used in the exchange receiver PR, but not in this PR.
https://github.com/pingcap/tiflash/pull/9073/files

@SeaRise SeaRise requested a review from gengliqi August 29, 2024 08:00
Copy link
Contributor

ti-chi-bot bot commented Sep 2, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gengliqi, windtalker

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

The pull request process is described here

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

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 lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Sep 2, 2024
Copy link
Contributor

ti-chi-bot bot commented Sep 2, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-07-25 08:03:36.545832468 +0000 UTC m=+1118638.536773933: ☑️ agreed by windtalker.
  • 2024-09-02 05:58:18.643919548 +0000 UTC m=+251223.161972468: ☑️ agreed by gengliqi.

@SeaRise
Copy link
Contributor Author

SeaRise commented Sep 2, 2024

/merge

Copy link
Contributor

ti-chi-bot bot commented Sep 2, 2024

@SeaRise: 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

trigger some heavy tests which will not run always when PR updated.

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.

@ti-chi-bot ti-chi-bot bot merged commit 0a80ae0 into pingcap:master Sep 2, 2024
5 checks passed
@SeaRise SeaRise deleted the notify_for_sender branch September 6, 2024 05:28
@windtalker windtalker mentioned this pull request Sep 9, 2024
12 tasks
ti-chi-bot bot pushed a commit that referenced this pull request Sep 10, 2024
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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants