You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "jerrypeng (via GitHub)" <gi...@apache.org> on 2026/07/13 03:49:16 UTC

[PR] [WIP] [SPARK-57231] [SS][RTM][StreamingShuffle][Part6] Activate streaming shuffle and add end-to-end StreamingShuffleSuite [spark]

jerrypeng opened a new pull request, #57212:
URL: https://github.com/apache/spark/pull/57212

   <!--
   Thanks for sending a pull request!  Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: https://spark.apache.org/contributing.html
     2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
     3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
     4. Be sure to keep the PR description updated to reflect all changes.
     5. Please write your PR title to summarize what this PR proposes.
     6. If possible, provide a concise example to reproduce the issue for a faster review.
     7. If you want to add a new configuration, please read the guideline first for naming configurations in
        'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
     8. If you want to add or modify an error type or message, please read the guideline first in
        'common/utils/src/main/resources/error/README.md'.
   -->
   
   ### What changes were proposed in this pull request?
   <!--
   Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue.
   If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
     1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
     2. If you fix some SQL features, you can provide some references of other DBMSes.
     3. If there is design documentation, please add the link.
     4. If there is a discussion in the mailing list, please add the link.
   -->
   
   This combines **parts 6 and 7** of the multi-PR effort to add *streaming shuffle* to Spark — a push-based shuffle used by Real-Time Mode (RTM) structured streaming, where writer tasks push records directly to reader tasks over the network instead of writing map output to disk for readers to pull. Part 6 (activation) is small, so it is bundled with the end-to-end tests (part 7) that exercise it.
   
   **Activation** — wire the streaming shuffle into the shuffle lifecycle via the `StreamingShuffleOutputTracker` (added in part 2):
   
   - **`DAGScheduler.createShuffleMapStage`** — when a shuffle map stage is created, also register the shuffle with the `StreamingShuffleOutputTracker` (alongside the existing `MapOutputTracker` registration). This is a no-op unless streaming shuffle is in use (`streamingShuffleOutputTracker` is only defined when the streaming shuffle manager is active).
   - **`BlockManagerStorageEndpoint`** (`RemoveShuffle`) — when a shuffle is removed, unregister it from the `StreamingShuffleOutputTracker`, freeing its `shuffleInfos` / `taskLocations` entries. The existing `MapOutputTracker` unregister is a no-op for streaming shuffles.
   
   Both hooks go through `SparkEnv.streamingShuffleOutputTracker`, which is `None` for the default sort shuffle, so the default path is unchanged.
   
   **End-to-end tests** — `StreamingShuffleSuite`, a real-Netty integration suite that drives the full writer <-> reader path now that the writer (part 4) and reader (part 5) are merged. It covers, among other things: writer <-> reader data transfer, the credit-control / termination handshake, sequence-number validation (out-of-order / duplicate / missing detection), checksum verification, memory back-pressure, background-thread error propagation via `ErrorNotifier`, resource cleanup on task completion (including that `RemoveShuffle` unregisters the shuffle from the tracker), and that a reader fails (rather than hangs) when a writer disconnects before terminating. A small test-only accessor, `TransportServer.channelFuture()`, is added so the suite can assert the writer's server-channel state.
   
   The full PR stack:
   
   - **Part 1** (SPARK-56674, *merged*) - streaming shuffle wire protocol (the four Netty message types).
   - **Part 2** (SPARK-56962, *merged*) - `StreamingShuffleOutputTracker` (driver-side writer-location coordination).
   - **Part 3** (SPARK-57141, *merged*) - shuffle-manager layer (`StreamingShuffleManager` + `MultiShuffleManager`).
   - **Part 3.5** (SPARK-57337, *merged*) - shared transport + error plumbing (`ErrorNotifier`, `TransportClient.send(ByteBuf)`, checksum config).
   - **Part 4** (SPARK-57229, *merged*) - `StreamingShuffleWriter` + server-side Netty handler (push path).
   - **Part 5** (SPARK-57230, *merged*) - `StreamingShuffleReader` + client-side Netty handler (pull path).
   - **Parts 6 & 7** (*this PR*) - activation (register/unregister with the tracker in the `DAGScheduler` / `BlockManager` lifecycle) + the end-to-end `StreamingShuffleSuite`.
   - **Part 8** - documentation.
   
   With parts 1 through 5 all merged, this PR is standalone against `master`.
   
   ### Why are the changes needed?
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you propose a new API, clarify the use case for a new API.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   
   Real-Time Mode / low-latency continuous queries need shuffle data to flow continuously between stages, which streaming shuffle provides by pushing records directly from writer tasks to reader tasks. For a reader to discover its writers, each streaming shuffle must be registered with the `StreamingShuffleOutputTracker` when its stage is created, and unregistered when the shuffle is removed so its per-shuffle state does not leak. These two lifecycle hooks are the last code needed (together with the already-merged writer and reader) to run a streaming shuffle end to end, and `StreamingShuffleSuite` verifies that full path.
   
   ### Does this PR introduce _any_ user-facing change?
   <!--
   Note that it means *any* user-facing change including all aspects such as new features, bug fixes, or other behavior changes. Documentation-only updates are not considered user-facing changes.
   
   If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
   If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
   If no, write 'No'.
   -->
   
   No. The streaming shuffle managers are opt-in via `spark.shuffle.manager` and are not the default. The activation hooks are guarded by `SparkEnv.streamingShuffleOutputTracker`, which is `None` for the default sort shuffle, so the default shuffle path is unaffected.
   
   ### How was this patch tested?
   <!--
   If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
   If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why it was difficult to add.
   If benchmark tests were added, please run the benchmarks in GitHub Actions for the consistent environment, and the instructions could accord to: https://spark.apache.org/developer-tools.html#github-workflow-benchmarks.
   -->
   
   This PR adds `StreamingShuffleSuite`, an end-to-end integration suite (real Netty writer + reader) covering the full push/pull path, the credit-control / termination handshake, sequence-number and checksum validation, memory back-pressure, error propagation, resource cleanup, and the register/unregister lifecycle added here. Run with:
   
   ```
   build/sbt "core/testOnly org.apache.spark.shuffle.streaming.StreamingShuffleSuite"
   ```
   
   ### Was this patch authored or co-authored using generative AI tooling?
   <!--
   If generative AI tooling has been used in the process of authoring this patch, please include the
   phrase: 'Generated-by: ' followed by the name of the tool and its version.
   If no, write 'No'.
   Please refer to the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) for details.
   -->
   
   Co-authored with Claude Code (Claude Opus 4.8)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-57232][SS][RTM][StreamingShuffle][Part7] Add additional e2e testing for streaming shuffle [spark]

Posted by "HeartSaVioR (via GitHub)" <gi...@apache.org>.
HeartSaVioR closed pull request #57212: [SPARK-57232][SS][RTM][StreamingShuffle][Part7]  Add additional e2e testing for streaming shuffle
URL: https://github.com/apache/spark/pull/57212


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-57232][SS][RTM][StreamingShuffle][Part7] Add additional e2e testing for streaming shuffle [spark]

Posted by "HeartSaVioR (via GitHub)" <gi...@apache.org>.
HeartSaVioR commented on PR #57212:
URL: https://github.com/apache/spark/pull/57212#issuecomment-4978879680

   Thanks! Merging to master/4.x.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-57232][SS][RTM][StreamingShuffle][Part7] Add additional e2e testing for streaming shuffle [spark]

Posted by "HeartSaVioR (via GitHub)" <gi...@apache.org>.
HeartSaVioR commented on PR #57212:
URL: https://github.com/apache/spark/pull/57212#issuecomment-4978892787

   **Merge Summary:**
   - merged into master https://github.com/apache/spark/commit/b22a865ad136b473b9903da7ce9eda974c977167
   - merged into branch-4.x https://github.com/apache/spark/commit/249aba0cded1703e49eae5c0fca729e65eb758be


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-57232][SS][RTM][StreamingShuffle][Part7] Add additional e2e testing for streaming shuffle [spark]

Posted by "jerrypeng (via GitHub)" <gi...@apache.org>.
jerrypeng commented on PR #57212:
URL: https://github.com/apache/spark/pull/57212#issuecomment-4986299147

   thanks @HeartSaVioR !


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org