Skip to content

*: allow UnionBlockInputStream ignore the blocks#3638

Merged
ti-chi-bot merged 25 commits intopingcap:masterfrom
fuzhe1989:fuzhe/new_union_wait
Dec 17, 2021
Merged

*: allow UnionBlockInputStream ignore the blocks#3638
ti-chi-bot merged 25 commits intopingcap:masterfrom
fuzhe1989:fuzhe/new_union_wait

Conversation

@fuzhe1989
Copy link
Contributor

@fuzhe1989 fuzhe1989 commented Dec 13, 2021

What problem does this PR solve?

Issue Number: close #xxx

Problem Summary:

HashJoinBuildInputStream and ExchangeSender will return blocks through UnionBlockInputStream and all blocks will first contend for being pushed into a ConcurrentBoundedQueue. This can be a performance bottleneck:

  1. Sometimes the receiver doesn't need the returned blocks: HashJoinBuildInputStream, MPPTask.
  2. All the blocks generated from a MPP task will be transmitted to MPPTask::runImpl and then destructed, which is very unfriendly to the memory allocator (many many threads allocate and one thread deallocates).

What is changed and how it works?

Introduce a new template parameter ignore_block to UnionBlockInputStream that ignores blocks at onBlock.

To not break the test, also move some fail points from MPPTask::runImpl to StreamingDAGResponseWriter.

Candidate solution:

Introduce IgnoreBlockInputStream which simply ignores all returned blocks in a while-loop and only return an empty block when finished.

Append IgnoreBlockInputStream after HashJoinBuildInputStream and ExchangeSender since we don't need the returned blocks.

Problem: may cause UnionBlockInputStream unbalanced if the thread_num < stream_num.

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
Copy link
Member

ti-chi-bot commented Dec 13, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • SeaRise

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Details

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-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 Dec 13, 2021
@ti-chi-bot ti-chi-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 13, 2021
@ti-chi-bot ti-chi-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 13, 2021
@fuzhe1989
Copy link
Contributor Author

/run-all-tests

@fuzhe1989 fuzhe1989 changed the title *: allow UnionBlockInputStream ignore the blocks *: introduce IgnoreBlockInputStream Dec 13, 2021
@sre-bot
Copy link
Collaborator

sre-bot commented Dec 13, 2021

Coverage detail: https://ci-internal.pingcap.net/job/tics_ghpr_unit_test/350/cobertura/
(Coverage detail url is limited office network access)

lines: 41.9% (46383 out of 110695)
branches: 5.8% (69692 out of 1202058)

@fuzhe1989
Copy link
Contributor Author

/run-all-tests

@sre-bot
Copy link
Collaborator

sre-bot commented Dec 13, 2021

Coverage detail: https://ci-internal.pingcap.net/job/tics_ghpr_unit_test/356/cobertura/
(Coverage detail url is limited office network access)

lines: 41.9% (46383 out of 110699)
branches: 5.8% (69672 out of 1201841)

FAIL_POINT_TRIGGER_EXCEPTION(FailPoints::exception_during_mpp_non_root_task_run);
}
}
FAIL_POINT_PAUSE(FailPoints::hang_in_execution);
Copy link
Contributor

Choose a reason for hiding this comment

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

The failpoint here seems useless because once reach here, the execution is finished.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I fail to find a better place. If the failpoint is triggered in ExchangeSender, multiple exceptions will be thrown and the error message will be mismatch.

@fuzhe1989
Copy link
Contributor Author

/run-all-tests

@sre-bot
Copy link
Collaborator

sre-bot commented Dec 16, 2021

Coverage detail: https://ci-internal.pingcap.net/job/tics_ghpr_unit_test/396/cobertura/
(Coverage detail url is limited office network access)

lines: 42.3% (46961 out of 111016)
branches: 6.0% (72509 out of 1206362)

@fuzhe1989
Copy link
Contributor Author

/run-all-tests

@sre-bot
Copy link
Collaborator

sre-bot commented Dec 16, 2021

Coverage detail: https://ci-internal.pingcap.net/job/tics_ghpr_unit_test/401/cobertura/
(Coverage detail url is limited office network access)

lines: 42.4% (47048 out of 111015)
branches: 6.0% (72615 out of 1206368)

@fuzhe1989
Copy link
Contributor Author

/run-all-tests

@sre-bot
Copy link
Collaborator

sre-bot commented Dec 16, 2021

Coverage detail: https://ci-internal.pingcap.net/job/tics_ghpr_unit_test/408/cobertura/
(Coverage detail url is limited office network access)

lines: 42.4% (47051 out of 111014)
branches: 6.0% (72619 out of 1206364)

@fuzhe1989
Copy link
Contributor Author

/run-integration-test

@fuzhe1989 fuzhe1989 requested a review from windtalker December 16, 2021 14:15
template <class StreamWriterPtr>
void StreamingDAGResponseWriter<StreamWriterPtr>::write(const Block & block)
{
FAIL_POINT_PAUSE(FailPoints::hang_in_execution);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think its better to put these failpoint to ExchangeSender

Copy link
Contributor

Choose a reason for hiding this comment

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

Are you sure tracing will be GA in the next release, because if not then we will have to release a version without this information.

@fuzhe1989
Copy link
Contributor Author

/run-integration-test

@fuzhe1989 fuzhe1989 requested a review from windtalker December 17, 2021 02:57
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

@fuzhe1989
Copy link
Contributor Author

/merge

@ti-chi-bot
Copy link
Member

@fuzhe1989: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

You only need to trigger /merge once, and 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.

If you have any questions about the PR merge process, please refer to pr process.

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 ti-community-infra/tichi repository.

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

DetailsCommit hash: d05bcbe

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Dec 17, 2021
@sre-bot
Copy link
Collaborator

sre-bot commented Dec 17, 2021

Coverage detail: https://ci-internal.pingcap.net/job/tics_ghpr_unit_test/429/cobertura/
(Coverage detail url is limited office network access)

lines: 42.5% (47528 out of 111811)
branches: 6.0% (73010 out of 1208747)

@sre-bot
Copy link
Collaborator

sre-bot commented Dec 17, 2021

Coverage detail: https://ci-internal.pingcap.net/job/tics_ghpr_unit_test/430/cobertura/
(Coverage detail url is limited office network access)

lines: 42.5% (47528 out of 111811)
branches: 6.0% (73010 out of 1208747)

@ti-chi-bot ti-chi-bot merged commit 6092626 into pingcap:master Dec 17, 2021
@fuzhe1989 fuzhe1989 deleted the fuzhe/new_union_wait branch December 17, 2021 04:24
ti-chi-bot pushed a commit that referenced this pull request Dec 17, 2021
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/L Denotes a PR that changes 100-499 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT1 Indicates that a PR has LGTM 1.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants