Caideyipi commented on code in PR #19119:
URL: https://github.com/apache/iotdb/pull/19119#discussion_r4464301129
##########
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/agent/task/subtask/PipeAbstractSinkSubtask.java:
##########
@@ -83,6 +84,15 @@ public void bindExecutors(
this.subtaskScheduler = subtaskScheduler;
}
+ @Override
+ protected synchronized void onDisallowSubmittingSelf() {
+ // The subtask is not submitting itself any more. The "isSubmitted" sign
is cleared so that a
+ // later allowSubmittingSelf() + submitSelf() can really submit the
subtask again, even if the
+ // previous submission was never dispatched to the worker pool, e.g.,
because the submission was
+ // rejected or scheduled on an executor that has been shut down.
+ isSubmitted = false;
Review Comment:
[P1] Preserve the submitted state while a sink is in flight.
disallowSubmittingSelf() is also used by an ordinary stop, and
PipeSubtaskExecutor.stop() only flips the stop flag without waiting for the
worker. Clearing isSubmitted here lets a quick stop/start submit the same sink
subtask while its previous worker is still running. A pending delayed lambda
can also pass the shouldStopSubmittingSelf check after restart and submit in
addition to the new run. That breaks the non-parallel invariant and can
concurrently consume or send the same events. Please clear this flag only when
the previous submission was definitely rejected, or otherwise prevent old work
from resuming after restart.
--
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]