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

Auto spill enhance #8033

Merged
merged 7 commits into from Aug 29, 2023
Merged

Auto spill enhance #8033

merged 7 commits into from Aug 29, 2023

Conversation

windtalker
Copy link
Contributor

@windtalker windtalker commented Aug 28, 2023

What problem does this PR solve?

Issue Number: ref #7738

Problem Summary:

What is changed and how it works?

  • AutoSpillTrigger support spill check without cooldown time if memory usage is really high
  • Avoid too many logs in QueryOperatorSpillContexts::triggerAutoSpill
  • Support trigger auto spill check inside Join::InsertFromBlock
  • In HashTable and Arena, support check if current data is already marked as spilled when before trying to allocate more memory, currently, used in Join spill
  • Fix a bug that the ReceivedMessageQueue is actually not memory bounded even if max_buffered_bytes_in_executor is set

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 size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 28, 2023
@SeaRise SeaRise self-requested a review August 28, 2023 03:52
Comment on lines 100 to 104
if (resize_callback != nullptr)
{
if (!resize_callback())
throw ResizeException("Error in arena resize");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Will there be a performance regression?

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 think the cost is acceptable because 1. resize/addChunk is not a high frequency used function, 2. inside resize/addChunk it need allocate memory and maybe copy some existing data, which I think makes the cost of resize_callback() ignorable

Copy link
Contributor

@yibin87 yibin87 Aug 29, 2023

Choose a reason for hiding this comment

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

Add unlikely for exception throw path? And add random failpoint 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.

OK, I will add unlikely for it, but for failpoint, actually it is not a standalone behavior, because if this function throws error, the related partition must be marked as to spill, otherwise, it may cause wrong result. I will add failpoint to test this case in test pr.

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

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

Comment on lines 100 to 104
if (resize_callback != nullptr)
{
if (!resize_callback())
throw ResizeException("Error in arena resize");
}
Copy link
Contributor

@yibin87 yibin87 Aug 29, 2023

Choose a reason for hiding this comment

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

Add unlikely for exception throw path? And add random failpoint here?

@ti-chi-bot ti-chi-bot bot added the lgtm label Aug 29, 2023
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Aug 29, 2023

[APPROVALNOTIFIER] This PR is APPROVED

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

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

ti-chi-bot bot commented Aug 29, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-08-28 06:27:15.416883001 +0000 UTC m=+1735599.965898988: ☑️ agreed by SeaRise.
  • 2023-08-29 03:23:42.078417233 +0000 UTC m=+1810986.627433220: ☑️ agreed by yibin87.

windtalker and others added 5 commits August 29, 2023 15:18
Signed-off-by: xufei <xufei@pingcap.com>
Signed-off-by: xufei <xufei@pingcap.com>
Signed-off-by: xufei <xufeixw@mail.ustc.edu.cn>
Signed-off-by: xufei <xufei@pingcap.com>
Signed-off-by: xufei <xufei@pingcap.com>
@ti-chi-bot ti-chi-bot bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 29, 2023
@windtalker
Copy link
Contributor Author

/run-all-tests

Signed-off-by: xufei <xufei@pingcap.com>
@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Aug 29, 2023
@windtalker
Copy link
Contributor Author

/run-all-tests

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Aug 29, 2023

@windtalker: 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.

@windtalker
Copy link
Contributor Author

/run-unit-test

@windtalker
Copy link
Contributor Author

/run-unit-tests

@ti-chi-bot ti-chi-bot bot merged commit aed7d84 into pingcap:master Aug 29, 2023
6 checks passed
@windtalker windtalker deleted the auto_spill_enhance branch September 20, 2023 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none 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.

None yet

3 participants