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

[SPARK-35546][Shuffle] Enable push-based shuffle when multiple app attempts are enabled and manage concurrent access to the state in a better way #33078

Closed
wants to merge 19 commits into from

Conversation

zhouyejoe
Copy link
Contributor

What changes were proposed in this pull request?

This is one of the patches for SPIP SPARK-30602 which is needed for push-based shuffle.

Summary of the change:

When Executor registers with Shuffle Service, it will encode the merged shuffle dir created and also the application attemptId into the ShuffleManagerMeta into Json. Then in Shuffle Service, it will decode the Json string and get the correct merged shuffle dir and also the attemptId. If the registration comes from a newer attempt, the merged shuffle information will be updated to store the information from the newer attempt.

This PR also refactored the management of the merged shuffle information to avoid concurrency issues.

Why are the changes needed?

Refer to the SPIP in SPARK-30602.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Added unit tests.
The reference PR with the consolidated changes covering the complete implementation is also provided in SPARK-30602.
We have already verified the functionality and the improved performance as documented in the SPIP doc.

@github-actions github-actions bot added the CORE label Jun 25, 2021
@zhouyejoe
Copy link
Contributor Author

PR created. CC @Ngone51 @mridulm @Victsm @otterc

Copy link
Contributor

@mridulm mridulm left a comment

Choose a reason for hiding this comment

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

Took an initial pass through the PR

@mridulm
Copy link
Contributor

mridulm commented Jun 25, 2021

Jenkins, test this please.

@mridulm
Copy link
Contributor

mridulm commented Jun 25, 2021

Ok to test

@SparkQA
Copy link

SparkQA commented Jun 25, 2021

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/44847/

@SparkQA
Copy link

SparkQA commented Jun 25, 2021

Kubernetes integration test status success
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/44847/

@SparkQA
Copy link

SparkQA commented Jun 25, 2021

Test build #140315 has finished for PR 33078 at commit 65fca88.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
  • public static class AppShuffleInfo

Copy link
Contributor

@otterc otterc left a comment

Choose a reason for hiding this comment

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

I don't see any UTs added for all the issues that were identified with concurrency. Is there a problem in adding UTs for these cases?

@zhouyejoe
Copy link
Contributor Author

Thanks @mridulm @otterc @venkata91 for reviewing the PR. Addressed majority of the comments.
@otterc The unit test to simulate the concurrency control is yet to be added. A little bit tricky to get those added.

Hi, @Ngone51 . Can you also help review this one? Thanks.

Copy link
Contributor

@mridulm mridulm left a comment

Choose a reason for hiding this comment

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

Looks mostly good, had a couple of comments.
Will wait for @Ngone51, @otterc and @venkata91's reviews to complete as well.

@SparkQA
Copy link

SparkQA commented Jun 29, 2021

Test build #140368 has finished for PR 33078 at commit 1f915b1.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Jun 29, 2021

Kubernetes integration test unable to build dist.

exiting with code: 141
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/44900/

@mridulm
Copy link
Contributor

mridulm commented Jul 1, 2021

@Ngone51 I am leaving on slightly long-ish vacation without access to my laptop .. will it be possible for you to shepard this pr and #33034 ?
These are the last two pending fixes for push based shuffle, and deal with correctness issues (and not functionality issues).
If you feel we cant get them through, @otterc will have a pr for branch-3.2 ready which will disable push based shuffle for 3.2 - we can merge that instead to prevent issues for users trying to leverage push based shuffle in later versions.
Thanks !

@Ngone51
Copy link
Member

Ngone51 commented Jul 1, 2021

@mridulm Sure! Enjoy your vacation!

@Ngone51
Copy link
Member

Ngone51 commented Jul 2, 2021

@zhouyejoe Could you address all the comments? Branch-3.2 is already cut, we now have very limited time to merge this into it.

@zhouyejoe
Copy link
Contributor Author

@Ngone51 Sure, will update the PR ASAP.

@SparkQA
Copy link

SparkQA commented Jul 5, 2021

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/45136/

@SparkQA
Copy link

SparkQA commented Jul 5, 2021

Kubernetes integration test status success
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/45136/

@SparkQA
Copy link

SparkQA commented Jul 17, 2021

Test build #141187 has finished for PR 33078 at commit fab51d4.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Jul 17, 2021

Kubernetes integration test status success
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/45703/

@SparkQA
Copy link

SparkQA commented Jul 17, 2021

Test build #141191 has finished for PR 33078 at commit 79816ad.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@zhouyejoe
Copy link
Contributor Author

Are there any UTs that verify the changes to finalizeShuffleMerge when the message is from old attempt?

Added a unit test for this one yesterday.

@SparkQA
Copy link

SparkQA commented Jul 18, 2021

Kubernetes integration test unable to build dist.

exiting with code: 1
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/45721/

@SparkQA
Copy link

SparkQA commented Jul 18, 2021

Test build #141208 has finished for PR 33078 at commit 1de689b.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@mridulm
Copy link
Contributor

mridulm commented Jul 19, 2021

Thanks for the approve @Ngone51 !
+CC @otterc, @venkata91 can you take another pass please ? I plan to merge this later today to master and branch-3.2.

@venkata91
Copy link
Contributor

LGTM.

@otterc
Copy link
Contributor

otterc commented Jul 19, 2021

Looks good to me. Thanks for working on it @zhouyejoe

@zhouyejoe
Copy link
Contributor Author

Thanks for all the reviews.

@mridulm
Copy link
Contributor

mridulm commented Jul 19, 2021

Jenkins, test this please

@SparkQA
Copy link

SparkQA commented Jul 19, 2021

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/45798/

@SparkQA
Copy link

SparkQA commented Jul 20, 2021

Kubernetes integration test status success
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/45798/

@SparkQA
Copy link

SparkQA commented Jul 20, 2021

Kubernetes integration test unable to build dist.

exiting with code: 1
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/45800/

@SparkQA
Copy link

SparkQA commented Jul 20, 2021

Test build #141284 has finished for PR 33078 at commit 1de689b.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Jul 20, 2021

Test build #141286 has finished for PR 33078 at commit 5310991.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
  • public class ShuffleChecksumHelper
  • class MutableCheckedOutputStream(out: OutputStream) extends OutputStream
  • case class ShuffleChecksumBlockId(shuffleId: Int, mapId: Long, reduceId: Int) extends BlockId
  • case class SessionWindow(timeColumn: Expression, gapDuration: Long) extends UnaryExpression
  • protected abstract class ConnectionProviderBase extends Logging
  • case class SessionWindowStateStoreRestoreExec(
  • case class SessionWindowStateStoreSaveExec(

@asfgit asfgit closed this in c77acf0 Jul 20, 2021
asfgit pushed a commit that referenced this pull request Jul 20, 2021
…tempts are enabled and manage concurrent access to the state in a better way

### What changes were proposed in this pull request?
This is one of the patches for SPIP SPARK-30602 which is needed for push-based shuffle.

### Summary of the change:
When Executor registers with Shuffle Service, it will encode the merged shuffle dir created and also the application attemptId into the ShuffleManagerMeta into Json. Then in Shuffle Service, it will decode the Json string and get the correct merged shuffle dir and also the attemptId. If the registration comes from a newer attempt, the merged shuffle information will be updated to store the information from the newer attempt.

This PR also refactored the management of the merged shuffle information to avoid concurrency issues.
### Why are the changes needed?
Refer to the SPIP in SPARK-30602.

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
Added unit tests.
The reference PR with the consolidated changes covering the complete implementation is also provided in SPARK-30602.
We have already verified the functionality and the improved performance as documented in the SPIP doc.

Closes #33078 from zhouyejoe/SPARK-35546.

Authored-by: Ye Zhou <yezhou@linkedin.com>
Signed-off-by: Mridul Muralidharan <mridul<at>gmail.com>
(cherry picked from commit c77acf0)
Signed-off-by: Mridul Muralidharan <mridulatgmail.com>
@mridulm
Copy link
Contributor

mridulm commented Jul 20, 2021

Merged to master and branch-3.2
Thanks for working on this @zhouyejoe !
Thanks for all the reviews @Ngone51, @otterc, @venkata91 :-)

@mridulm
Copy link
Contributor

mridulm commented Jul 20, 2021

+CC @gengliangwang

@@ -64,25 +68,28 @@ public boolean equals(Object other) {
if (other != null && other instanceof FinalizeShuffleMerge) {
FinalizeShuffleMerge o = (FinalizeShuffleMerge) other;
return Objects.equal(appId, o.appId)
&& appAttemptId == appAttemptId
Copy link
Member

Choose a reason for hiding this comment

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

zhouyejoe added a commit to linkedin/spark that referenced this pull request Aug 3, 2021
…tempts are enabled and manage concurrent access to the state in a better way

This is one of the patches for SPIP SPARK-30602 which is needed for push-based shuffle.

When Executor registers with Shuffle Service, it will encode the merged shuffle dir created and also the application attemptId into the ShuffleManagerMeta into Json. Then in Shuffle Service, it will decode the Json string and get the correct merged shuffle dir and also the attemptId. If the registration comes from a newer attempt, the merged shuffle information will be updated to store the information from the newer attempt.

This PR also refactored the management of the merged shuffle information to avoid concurrency issues.
Refer to the SPIP in SPARK-30602.

No.

Added unit tests.
The reference PR with the consolidated changes covering the complete implementation is also provided in SPARK-30602.
We have already verified the functionality and the improved performance as documented in the SPIP doc.

Closes apache#33078 from zhouyejoe/SPARK-35546.

Authored-by: Ye Zhou <yezhou@linkedin.com>
Signed-off-by: Mridul Muralidharan <mridul<at>gmail.com>
(cherry picked from commit c77acf0)
domybest11 pushed a commit to domybest11/spark that referenced this pull request Jun 15, 2022
…tempts are enabled and manage concurrent access to the state in a better way

### What changes were proposed in this pull request?
This is one of the patches for SPIP SPARK-30602 which is needed for push-based shuffle.

### Summary of the change:
When Executor registers with Shuffle Service, it will encode the merged shuffle dir created and also the application attemptId into the ShuffleManagerMeta into Json. Then in Shuffle Service, it will decode the Json string and get the correct merged shuffle dir and also the attemptId. If the registration comes from a newer attempt, the merged shuffle information will be updated to store the information from the newer attempt.

This PR also refactored the management of the merged shuffle information to avoid concurrency issues.
### Why are the changes needed?
Refer to the SPIP in SPARK-30602.

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
Added unit tests.
The reference PR with the consolidated changes covering the complete implementation is also provided in SPARK-30602.
We have already verified the functionality and the improved performance as documented in the SPIP doc.

Closes apache#33078 from zhouyejoe/SPARK-35546.

Authored-by: Ye Zhou <yezhou@linkedin.com>
Signed-off-by: Mridul Muralidharan <mridul<at>gmail.com>
(cherry picked from commit c77acf0)
Signed-off-by: Mridul Muralidharan <mridulatgmail.com>
wangyum pushed a commit that referenced this pull request May 26, 2023
…tempts are enabled and manage concurrent access to the state in a better way

This is one of the patches for SPIP SPARK-30602 which is needed for push-based shuffle.

When Executor registers with Shuffle Service, it will encode the merged shuffle dir created and also the application attemptId into the ShuffleManagerMeta into Json. Then in Shuffle Service, it will decode the Json string and get the correct merged shuffle dir and also the attemptId. If the registration comes from a newer attempt, the merged shuffle information will be updated to store the information from the newer attempt.

This PR also refactored the management of the merged shuffle information to avoid concurrency issues.
Refer to the SPIP in SPARK-30602.

No.

Added unit tests.
The reference PR with the consolidated changes covering the complete implementation is also provided in SPARK-30602.
We have already verified the functionality and the improved performance as documented in the SPIP doc.

Closes #33078 from zhouyejoe/SPARK-35546.

Authored-by: Ye Zhou <yezhou@linkedin.com>
Signed-off-by: Mridul Muralidharan <mridul<at>gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants