This is an automated email from the ASF dual-hosted git repository.
zaynt4606 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/celeborn.git
The following commit(s) were added to refs/heads/main by this push:
new 070ca9a891 [CELEBORN-2547] Fix flaky SparkUtilsSuite
070ca9a891 is described below
commit 070ca9a891731a95830de684ab51d83e7d37a5e1
Author: Venkata Krishnan Sowrirajan <[email protected]>
AuthorDate: Fri Nov 20 10:39:59 2026 +0800
[CELEBORN-2547] Fix flaky SparkUtilsSuite
### What changes were proposed in this pull request?
Fix the flaky SparkUtilsSuite test "check if fetch failure task another
attempt is running or successful". It's a test-only change in
`ShuffleReaderGetHooks`.
- Before deleting the shuffle files, the hook now calls
`shuffleClient.updateFileGroup(...)`. `GetReducerFileGroup` isn't answered
until the stage has ended
(`ReducePartitionCommitHandler.handleGetReducerFileGroup`), and that only
happens after commitFiles is done, so the files are complete when we delete
them. The reader makes the same call right after the hook and gets the cached
result, so nothing else changes for the reader.
- The hook checks `executed` again inside the lock, so only one reduce task
deletes the files.
### Why are the changes needed?
JIRA: https://issues.apache.org/jira/browse/CELEBORN-2547
This failed CI on #3955, #3942 and on main at 517a9b196, always with "null
equaled null" at SparkUtilsSuite.scala:88, meaning
`SparkUtils.lastReportedShuffleFetchFailureTaskId` was never set.
From the INFO logs of the failing jobs, Spark starts the reduce tasks right
after the last `MapperEnd`, while the workers are still in commitFiles. The
hook deletes the files at that point. The worker opens its file channel lazily
with `CREATE` (`TierWriter`, `FileChannelUtils.createWritableFileChannel`), and
the test data is small enough that nothing was flushed before commit. So the
final flush just creates the file again with all the data, the read succeeds
and there's no fetch fai [...]
The "unexpected, there must be some data file" error in those logs is a
separate, harmless bug. Both reduce tasks get past the `executed` check before
either takes the lock, so the second one finds the files already gone and
throws. That task is retried and the retry skips the hook. Locally it happened
on every run.
The same hook is also used by `CelebornFetchFailureSuite` and
`CelebornFetchFailureDiskCleanSuite`, so this closes the same race there.
### Does this PR resolve a correctness bug?
- [ ] Yes
### Does this PR introduce _any_ user-facing change?
- [ ] Yes
### How was this patch tested?
Maven on JDK 17 with `-Pspark-3.5`, running the test in a loop with a
temporary wrapper.
- On main the test passed 40/40 here, since commit finishes before the
reducers start on my machine.
- To reproduce, I temporarily added a 1s sleep before `fileWriter.close()`
in the worker commit path. On main the test failed 5/5 with the same message as
CI. With this change it passed 5/5, along with the rest of `SparkUtilsSuite`,
`CelebornFetchFailureSuite` and `CelebornFetchFailureDiskCleanSuite`.
- Without the sleep, 50 runs in a row plus the other suites above: 63/63
passed, and the "unexpected" error didn't show up anymore.
- `build/mvn -Pspark-3.5 -pl tests/spark-it spotless:check` passes.
Closes #3958 from venkata91/vsowrira/celeborn-sparkutils-suite-flaky.
Authored-by: Venkata Krishnan Sowrirajan <[email protected]>
Signed-off-by: zhengtao <[email protected]>
AI-Contributed/Feature: 0/0
AI-Contributed/UT: 0/8
---
.../tests/spark/fetch/failure/ShuffleReaderGetHooks.scala | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git
a/tests/spark-it/src/test/scala/org/apache/celeborn/tests/spark/fetch/failure/ShuffleReaderGetHooks.scala
b/tests/spark-it/src/test/scala/org/apache/celeborn/tests/spark/fetch/failure/ShuffleReaderGetHooks.scala
index 09d9efe623..1653aa813f 100644
---
a/tests/spark-it/src/test/scala/org/apache/celeborn/tests/spark/fetch/failure/ShuffleReaderGetHooks.scala
+++
b/tests/spark-it/src/test/scala/org/apache/celeborn/tests/spark/fetch/failure/ShuffleReaderGetHooks.scala
@@ -58,6 +58,10 @@ class ShuffleReaderGetHooks(
return
}
lock.synchronized {
+ // The other reduce task may have deleted the files while this one
waited for the lock.
+ if (executed.get()) {
+ return
+ }
handle match {
case h: CelebornShuffleHandle[_, _, _] => {
val appUniqueId = h.appUniqueId
@@ -73,6 +77,10 @@ class ShuffleReaderGetHooks(
SparkCommonUtils.encodeAppShuffleIdentifier(handle.shuffleId,
context)
val Array(_, stageId, _) = appShuffleIdentifier.split('-')
if (triggerStageId.isEmpty || triggerStageId.get == stageId.toInt) {
+ // Reduce tasks can start before the workers have committed the
shuffle. Files deleted
+ // before the final flush get recreated, since workers open the
file channel lazily
+ // with CREATE, and the read succeeds without a fetch failure.
Wait for the commit.
+ shuffleClient.updateFileGroup(celebornShuffleId, startPartition)
if (shuffleIdToBeDeleted.isEmpty) {
deleteDataFile(appUniqueId, celebornShuffleId)
} else {