sunchao commented on code in PR #58380:
URL: https://github.com/apache/spark/pull/58380#discussion_r4096111446


##########
core/src/main/scala/org/apache/spark/ExecutorAllocationManager.scala:
##########
@@ -878,7 +884,7 @@ private[spark] class ExecutorAllocationManager(
         stageAttemptToNumTasks -= stageAttempt
         stageAttemptToPendingSpeculativeTasks -= stageAttempt
         stageAttemptToTaskIndices -= stageAttempt
-        stageAttemptToSpeculativeTaskIndices -= stageAttempt
+        stageAttemptToSpeculativeTaskIds -= stageAttempt

Review Comment:
   **[P2] Preserve running speculative attempts across stage retries** — 
[ExecutorAllocationManager.scala:887](https://github.com/apache/spark/blob/adfbfafafd96721e8acaf7491d01b04fa8e23b23/core/src/main/scala/org/apache/spark/ExecutorAllocationManager.scala#L887).
   
   A retryable `FetchFailed` emits `StageCompleted` while other attempts can 
still produce useful results. Clearing their speculative IDs here makes the new 
allocation logic forget a running speculative copy.
   
   With three slots per executor, five regular attempts plus one speculative 
copy require target **3**. After an unrelated task fetch-fails and the stage 
completes for retry, the target drops to **2**, although the copy remains 
running. StatefulSet scale-down can then delete its newly added executor and 
discard that work. [Scaling 
behavior](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#deployment-and-scaling-guarantees).
   
   Keep live speculative IDs until their `TaskEnd` events, with eventual 
map/resource-profile cleanup.
   
   Validation:
   
   - Reproduced the **3→2** drop using the exact changed source and listener 
events. Retaining the IDs in an isolation control keeps **3→3**.
   - All **50 existing tests** passed locally using cached dependencies; all 
**33 fork CI checks** passed.
   - Kubernetes deletion was traced through source and documented behavior, not 
reproduced on a cluster.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to