njnu-seafish commented on PR #18549:
URL: 
https://github.com/apache/dolphinscheduler/pull/18549#issuecomment-6053559516

   > ### Do not persist result alerts for rejected success events
   > TaskSuccessLifecycleEventHandler.java:56–60 checks only needAlert after 
calling onSucceedEvent(). However, TaskPauseStateAction and TaskKillStateAction 
merely log and ignore a late success event; they return normally without 
transitioning the task to SUCCESS. The handler still persists a TASK_RESULT 
alert for the paused/killed task.
   > 
   > Gate alert persistence on the effective SUCCESS state, while preserving 
idempotent handling of repeated success events. Add handler-level regression 
tests for rejected late success events and accepted/repeated success events; 
the current SQL preparation and DAO tests do not cover this behavior.
   
   
   Good catch. The success-event handler now gates alert persistence on the 
effective task state, fixed in 15c18bd77.
   
   1. Gate alert persistence on the effective SUCCESS state — 
TaskSuccessLifecycleEventHandler now checks 
taskExecution.getTaskInstance().getState() == SUCCESS before calling 
sendTaskResultAlert(). Since TaskPauseStateAction / TaskKillStateAction keep 
the task in PAUSE/KILL on a late success event, the TASK_RESULT alert is no 
longer persisted for paused/killed tasks.
   
   2. Preserve idempotent handling of repeated success events — a repeated 
success event on an already-SUCCESS task still takes the send path; 
deduplication stays at the DB level via the uk_alert_dedup unique constraint, 
so no duplicate alert is persisted and the event is acked as before.
   
   3. Handler-level regression tests — added 
TaskSuccessLifecycleEventHandlerTest (5 cases): accepted success event sends 
the alert; late success events on a paused task and on a killed task send none 
(verifyNoInteractions); a repeated success event still sends and acks; and 
needAlert=false sends none. All tests pass, and a mutation check (reversing the 
SUCCESS gate) turns 4/5 red, confirming the tests lock the behavior.


-- 
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]

Reply via email to