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

Refine cancel for read thread stream #8511

Merged
merged 5 commits into from
Dec 13, 2023

Conversation

SeaRise
Copy link
Contributor

@SeaRise SeaRise commented Dec 13, 2023

What problem does this PR solve?

Issue Number: ref #8505

Problem Summary:

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/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Dec 13, 2023
@SeaRise
Copy link
Contributor Author

SeaRise commented Dec 13, 2023

/cc @gengliqi @windtalker @JinheLin

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Dec 13, 2023
Co-authored-by: Liqi Geng <gengliqiii@gmail.com>
task_pool->decreaseUnorderedInputStreamRefCount();
LOG_DEBUG(log, "Destroy, pool_id={} ref_no={}", task_pool->pool_id, ref_no);
}
void cancel(bool /*kill*/) override { decreaseRefCount(); }
Copy link
Contributor

Choose a reason for hiding this comment

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

Where did you call cancel?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

called here

void MPPTask::abortQueryExecutor()
{
if (auto query_executor = query_executor_holder.tryGet(); query_executor)
{
assert(query_executor.value());
(*query_executor)->cancel();
}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

void DataStreamExecutor::cancel()
{
if (auto * p_stream = dynamic_cast<IProfilingBlockInputStream *>(data_stream.get()); p_stream)
p_stream->cancel(/*kill=*/false);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

void cancel(bool kill) override
{
if (kill)
is_killed = true;
bool old_val = false;
if (!is_cancelled.compare_exchange_strong(old_val, true, std::memory_order_seq_cst, std::memory_order_relaxed))
return;
if (cur_stream)
{
if (auto * child = dynamic_cast<IProfilingBlockInputStream *>(&*cur_stream))
{
child->cancel(kill);
}
}
}

It seems that cancel will not be called for UnorderedInputStream in shared_pool.

@ti-chi-bot ti-chi-bot bot added the lgtm label Dec 13, 2023
Copy link
Contributor

ti-chi-bot bot commented Dec 13, 2023

[APPROVALNOTIFIER] This PR is APPROVED

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

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:

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 removed the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Dec 13, 2023
Copy link
Contributor

ti-chi-bot bot commented Dec 13, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-12-13 05:44:02.679929085 +0000 UTC m=+421333.717156011: ☑️ agreed by gengliqi.
  • 2023-12-13 06:26:24.032276185 +0000 UTC m=+423875.069503112: ☑️ agreed by JinheLin.

Copy link
Contributor

ti-chi-bot bot commented Dec 13, 2023

@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 adf8569 into pingcap:master Dec 13, 2023
6 checks passed
@SeaRise SeaRise deleted the cancel_for_read_thread branch December 13, 2023 07:56
@gengliqi gengliqi added needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. labels Dec 14, 2023
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.5: #8516.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.5: #8517.

ti-chi-bot pushed a commit to ti-chi-bot/tiflash that referenced this pull request Dec 14, 2023
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.1: #8518.

ti-chi-bot pushed a commit to ti-chi-bot/tiflash that referenced this pull request Dec 14, 2023
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
ti-chi-bot bot pushed a commit that referenced this pull request Dec 14, 2023
ti-chi-bot bot pushed a commit that referenced this pull request Dec 14, 2023
ti-chi-bot pushed a commit to ti-chi-bot/tiflash that referenced this pull request Dec 15, 2023
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
yibin87 pushed a commit to yibin87/tiflash that referenced this pull request Dec 15, 2023
ti-chi-bot bot pushed a commit that referenced this pull request Dec 15, 2023
gengliqi added a commit to gengliqi/tiflash that referenced this pull request Dec 18, 2023
ti-chi-bot bot pushed a commit that referenced this pull request Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants