Skip to content
Merged
Prev Previous commit
Next Next commit
Update PipeConnectorSubtask.java
  • Loading branch information
SteveYurongSu committed May 28, 2025
commit 2fc8278d6c5a4dda89bb80f091b51563301ef06f
Original file line number Diff line number Diff line change
Expand Up @@ -237,35 +237,31 @@ public void discardEventsOfPipe(final String pipeNameToDrop, int regionId) {
// synchronized to use the lastEvent & lastExceptionEvent
synchronized (this) {
// Here we discard the last event, and re-submit the pipe task to avoid that the pipe task
Comment thread
SteveYurongSu marked this conversation as resolved.
// has
// stopped submission but will not be stopped by critical exceptions, because when it
// acquires
// lock, the pipe is already dropped, thus it will do nothing.
// Note that since we use a new thread to stop all the pipes, we will not encounter deadlock
// here. Or else we will.
// has stopped submission but will not be stopped by critical exceptions, because when it
// acquires lock, the pipe is already dropped, thus it will do nothing. Note that since we
// use a new thread to stop all the pipes, we will not encounter deadlock here. Or else we
// will.
if (lastEvent instanceof EnrichedEvent
&& pipeNameToDrop.equals(((EnrichedEvent) lastEvent).getPipeName())
&& regionId == ((EnrichedEvent) lastEvent).getRegionId()) {
// Do not clear last event's reference count because it may be on transferring
// Do not clear the last event's reference counts because it may be on transferring
lastEvent = null;
// Submit self to avoid that the lastEvent has been retried "max times" times and has
// stopped executing.
// 1. If the last event is still on execution, or submitted by the previous "onSuccess" or
// "onFailure", the "submitSelf" cause nothing.
// "onFailure", the "submitSelf" causes nothing.
// 2. If the last event is waiting the instance lock to call "onSuccess", then the
// callback
// method will skip this turn of submission.
// callback method will skip this turn of submission.
// 3. If the last event is waiting to call "onFailure", then it will be ignored because
// the
// last event has been set to null.
// the last event has been set to null.
// 4. If the last event has called "onFailure" and caused the subtask to stop submission,
// it's submitted here and the "report" will wait for the "drop pipe" lock to stop all
// the pipes with critical exceptions. As illustrated above, the "report" will do
// nothing.
submitSelf();
}

// We only clear the lastEvent's reference count when it's already on failure. Namely, we
// We only clear the lastEvent's reference counts when it's already on failure. Namely, we
// clear the lastExceptionEvent. It's safe to potentially clear it twice because we have the
// "nonnull" detection.
if (lastExceptionEvent instanceof EnrichedEvent
Expand Down