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

fix data race in join auto spill #8145

Merged

Conversation

windtalker
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #8144

Problem Summary:

What is changed and how it works?

Fix data race in join auto spill.
The root cause is join spill will call spilled_partition_indexes.push_back(i); concurrently in auto spill mode.
This pr fix it by

  • Rename spilled_partition_indexes to remaining_partition_indexes_to_restore, and only use this during restore stage
  • Init remaining_partition_indexes_to_restore in workAfterBuildFinish, which is thread safe.

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 Sep 26, 2023
@windtalker windtalker force-pushed the fix_data_race_in_join_auto_spill branch from a73f1df to 3eeaf7a Compare September 26, 2023 07:27
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.

Others LGTM

dbms/src/Interpreters/HashJoinSpillContext.cpp Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Sep 26, 2023
@windtalker
Copy link
Contributor Author

/run-all-tests

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.

LGTM

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Sep 26, 2023
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Sep 26, 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 Sep 26, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-09-26 07:31:35.744039609 +0000 UTC m=+346485.462381811: ☑️ agreed by SeaRise.
  • 2023-09-26 07:57:15.409608992 +0000 UTC m=+348025.127951191: ☑️ agreed by yibin87.

@ti-chi-bot ti-chi-bot bot merged commit 7bcd506 into pingcap:master Sep 26, 2023
@ti-chi-bot
Copy link
Member

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

ti-chi-bot bot pushed a commit that referenced this pull request Sep 27, 2023
@windtalker windtalker deleted the fix_data_race_in_join_auto_spill branch September 28, 2023 02:08
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-7.4 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Data race in join auto spill
4 participants