[
https://issues.apache.org/jira/browse/FLINK-21132?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17275234#comment-17275234
]
Kezhu Wang commented on FLINK-21132:
------------------------------------
[~aljoscha] [~pnowojski] [~roman_khachatryan] We all actually are on the same
page. So, all above approaches are feasible to me as long as there is no api
level bug-specific solution.
But I am kind of preferring to not sending {{EndOfPartitionEvent}}, so I would
like to present my [local
work|https://github.com/apache/flink/commit/d6c6837cd724913716007265f03a50098bee985e]
for another approach. Here is a summary for the changes:
# {{StopTaskException}} to throw from {{AbstractInvokable.invoke}}.
# Upon receiving savepoint completion, stop task with savepoint. This stop
phase is same for mailbox model, so FLINK-21133 does not exist anymore.
# After run out of mailbox loop, check whether it is stopped by a savepoint.
If it is, throws {{StopTaskException}}.
# If {{StopTaskException}} happens, {{Task.doRun}} will not finish result
partition(hence no EndOfPartitionEvent), but still transit task to finished
state(I am not sure it is conflict with FLIP-147 or not as I saw "Reuse Tasks'
FINISH status").
# Other works: generalize {{SteamTask.finishTask}} to all stream task but not
only source tasks; generalize {{StreamTask.cancelTask}} to mailbox model.
The benefits of this approach is that:
# It does not sending {{EndOfPartitionEvent}} anymore. There will be only true
end of input.
# If finished status caused by stop-with-savepoint is conflict with FLIP-147,
then it is easy to change to new status.
# FLINK-21133 solved with no extra work.
There is one user-notable breaking change: {{SreamOperator.close}} will not be
called in case of stop-with-savepoint.
Last, feel free to choice either approach, it is just my personal preference:P,
and I don't take any compatibility/invasiveness into account.
> BoundedOneInput.endInput is called when taking synchronous savepoint
> --------------------------------------------------------------------
>
> Key: FLINK-21132
> URL: https://issues.apache.org/jira/browse/FLINK-21132
> Project: Flink
> Issue Type: Bug
> Components: Runtime / Task
> Affects Versions: 1.10.2, 1.10.3, 1.11.3, 1.12.1
> Reporter: Kezhu Wang
> Assignee: Roman Khachatryan
> Priority: Major
> Labels: pull-request-available
>
> [~elkhand](?) reported on project iceberg that {{BoundedOneInput.endInput}}
> was
> [called|https://github.com/apache/iceberg/issues/2033#issuecomment-765864038]
> when [stopping job with
> savepoint|https://github.com/apache/iceberg/issues/2033#issuecomment-765557995].
> I think it is a bug of Flink and was introduced in FLINK-14230. The
> [changes|https://github.com/apache/flink/pull/9854/files#diff-0c5fe245445b932fa83fdaf5c4802dbe671b73e8d76f39058c6eaaaffd9639faL577]
> rely on {{StreamTask.afterInvoke}} and {{OperatorChain.closeOperators}} will
> only be invoked after *end of input*. But that is not true long before after
> [FLIP-34: Terminate/Suspend Job with
> Savepoint|https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=103090212].
> Task could enter state called
> [*finished*|https://github.com/apache/flink/blob/3a8e06cd16480eacbbf0c10f36b8c79a6f741814/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java#L467]
> after synchronous savepoint, that is an expected job suspension and stopping.
> [~sunhaibotb] [~pnowojski] [~roman_khachatryan] Could you help confirm this ?
> For full context, see
> [apache/iceberg#2033|https://github.com/apache/iceberg/issues/2033]. I have
> pushed branch
> [synchronous-savepoint-conflict-with-bounded-end-input-case|https://github.com/kezhuw/flink/commits/synchronous-savepoint-conflict-with-bounded-end-input-case]
> in my repository. Test case
> {{SavepointITCase.testStopSavepointWithBoundedInput}} failed due to
> {{BoundedOneInput.endInput}} called.
> I am also aware of [FLIP-147: Support Checkpoints After Tasks
> Finished|https://cwiki.apache.org/confluence/x/mw-ZCQ], maybe the three
> should align on what *finished* means exactly. [~kkl0u] [~chesnay]
> [~gaoyunhaii]
--
This message was sent by Atlassian Jira
(v8.3.4#803005)