Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLINK-26516][streaming] Recover GlobalCommittables with Sink V1 GlobalCommittable serializer #18805

Closed
wants to merge 3 commits into from

Conversation

fapaul
Copy link

@fapaul fapaul commented Feb 16, 2022

What is the purpose of the change

With SinkV2 the committer and global committer work very similar and
they only write committables into state. SinkV1's GlobalCommitter on the
other hand used to write GlobalCommittables into state so this commits
adds an migration path.

Brief change log

  • c725569 enabled the GlobalCommitter IT cases unfortunately we missed to enable them after FLINK-25726 was merged
  • 8549f8f Pass the global committer and serializer to the global committer operator to restore Sink V1 state

Verifying this change

  • Reenabled tests pass
  • Added an upgrade test to restore a savepoint from Sink V1.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (yes / no)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): (yes / no)
  • The serializers: (yes / no / don't know)
  • The runtime per-record code paths (performance sensitive): (yes / no / don't know)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (yes / no / don't know)
  • The S3 file system connector: (yes / no / don't know)

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)

@flinkbot
Copy link
Collaborator

Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
to review your pull request. We will use this comment to track the progress of the review.

Automated Checks

Last check on commit 8ab3d80 (Wed Feb 16 14:32:33 UTC 2022)

Warnings:

  • No documentation files were touched! Remember to keep the Flink docs up to date!
  • Invalid pull request title: No valid Jira ID provided

Mention the bot in a comment to re-run the automated checks.

Review Progress

  • ❓ 1. The [description] looks good.
  • ❓ 2. There is [consensus] that the contribution should go into to Flink.
  • ❓ 3. Needs [attention] from.
  • ❓ 4. The change fits into the overall [architecture].
  • ❓ 5. Overall code [quality] is good.

Please see the Pull Request Review Guide for a full explanation of the review process.


The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commands
The @flinkbot bot supports the following commands:

  • @flinkbot approve description to approve one or more aspects (aspects: description, consensus, architecture and quality)
  • @flinkbot approve all to approve all aspects
  • @flinkbot approve-until architecture to approve everything until architecture
  • @flinkbot attention @username1 [@username2 ..] to require somebody's attention
  • @flinkbot disapprove architecture to remove an approval you gave earlier

@flinkbot
Copy link
Collaborator

flinkbot commented Feb 16, 2022

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

@fapaul fapaul changed the title Flink 26173 [FLINK-26173][streaming] Call GlobalCommitter#filterRecoveredCommittable during commit to ensure sane behaviour after migration Feb 17, 2022
@fapaul fapaul changed the title [FLINK-26173][streaming] Call GlobalCommitter#filterRecoveredCommittable during commit to ensure sane behaviour after migration [FLINK-26173][streaming] Recover GlobalCommittables with Sink V1 GlobalCommittable serializer Feb 28, 2022
@fapaul
Copy link
Author

fapaul commented Feb 28, 2022

@gaoyunhaii I think this should fix the upgrade path from Sink V1 to Sink V2.

@fapaul
Copy link
Author

fapaul commented Feb 28, 2022

@flinkbot run azure

1 similar comment
@fapaul
Copy link
Author

fapaul commented Feb 28, 2022

@flinkbot run azure

@gaoyunhaii
Copy link
Contributor

Thanks @fapaul for the PR! I'll have a look~

@fapaul fapaul force-pushed the FLINK-26173 branch 4 times, most recently from ab6319c to 438259a Compare March 3, 2022 09:02
@@ -447,5 +451,13 @@ public void commit(Collection<CommitRequest<CommT>> committables)
committables.forEach(CommitRequest::retryLater);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here seems should be failures.forEach?

Copy link
Author

@fapaul fapaul Mar 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not easily possible because only committable are retriable at this point. I would need to add a special logic when this happens. I rely here on the fact that I assume all commit calls are idempotent because it might happen that global committables are committed again.

Copy link
Contributor

@gaoyunhaii gaoyunhaii Mar 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification! I did not notice the difference of types. Might we add some comments for this behavior?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, I add a comment.

@gaoyunhaii
Copy link
Contributor

Very thanks @fapaul for the PR!

One main issue from my side is that it seems the behavior of the current GlobalCommitterOperator is still not compatible with the legacy one? Currently once the legacy state is restored, in the following execution the behavior of combine, filterRecoveredCommittables and endOfInput is still not called~?

@fapaul
Copy link
Author

fapaul commented Mar 4, 2022

Very thanks @fapaul for the PR!

One main issue from my side is that it seems the behavior of the current GlobalCommitterOperator is still not compatible with the legacy one? Currently once the legacy state is restored, in the following execution the behavior of combine, filterRecoveredCommittables and endOfInput is still not called~?

I would have though combine and filterRecoveredCommittables are now equal or very closely to what was done before.

To be honest I never really understood the idea behind exposing endOfInput of the GlobalCommitter. I also have never seen a sink really using it. Can you maybe provide more context here? I would probably make a big warning in the release notes that this endOfInput is not used anymore.

@gaoyunhaii
Copy link
Contributor

Hi Fabian~

I would have though combine and filterRecoveredCommittables are now equal or very closely to what was done before.

It seems currently filterRecoveredCommittables and combine are used only on the legacy state~? For example, suppose we recovered from sink v1, then on restoring we would call filterRecoveredCommittables, then if the job continue running and take another several checkpoints, then after failover all committables are stored in the CommittableCollector and on restoring filterRecoveredCommittables seems would not be called~?

For endOfInput it is initially designed to write metas, like write partition to the hive metastore or write _SUCCESS file under the directory. I'm also agree with we could change it if no users are using it since it is marked as Experimental before.

@fapaul
Copy link
Author

fapaul commented Mar 4, 2022

It seems currently filterRecoveredCommittables and combine are used only on the legacy state~? For example, suppose we recovered from sink v1, then on restoring we would call filterRecoveredCommittables, then if the job continue running and take another several checkpoints, then after failover all committables are stored in the CommittableCollector and on restoring filterRecoveredCommittables seems would not be called~?

I thought about this for a longer time and think the behaviour of combine should be fine since it is always used when calling commit. The semantic of filterRecoveredCommittables is definitely currently unclear although I would also question the purpose of this method.
In general, I think all commit calls be for the committer of global committer need to be idempotent and handling already committed committables needs to happen in the commit method either way. I do not see an immediate benefit of calling filterRecoveredCommittables.

I am not really what to do about that. Do you have an idea?

@gaoyunhaii
Copy link
Contributor

gaoyunhaii commented Mar 5, 2022

Hi Fabian~ thanks for the clarification!

For the filterRecoveredCommittables, it should be initiated by some data lake systems like iceberg, if there are global committables from more than one checkpoint not committed before failover, then it should be able to merge them into one global committable on restoring, thus the restoring process could be accelerated [1].

For the combine, sorry I overlooked the issue and the current implementation, currently it is indeed called before committed. The issue is said that the committables should be combined on snapshotState, and the resulted global committables should be persisted, thus if there are failovers and re-commit, the combine does need to be executed again.

If we want to call filterRecoveredCommittables for each snapshot, we might need to add a parameter isRestored to the CommittableManager#commit. If we want to also keep the same behavior for the combine method, we might need to do some more modification to the CommittableManager or not reuse the current implementation.

However, currently the sink implementation in the iceberg, hudi and flink-table-store are indeed using the customized operators / legacy sink API instead of the sink API v1. In addition, the two issues should mainly affect he performance instead of the correctness. At last, users are still be able to add their own global committer implementation with topology API. Thus I think it is still useful to solve the two issues, but if we do not have capacity it would be also ok we postpone solving them.

If so, perhaps we could create a new jira issue for state compatibility with the sink v1 and attach this PR to that issue, and dowgrade the FLINK-26173 and leaves it open? Since we have not fully fix the issues listed in the FLINK-26173~

[1] https://lists.apache.org/thread/3tqgnhclbr8ptb69b2ro74535dtbd608

@fapaul fapaul changed the title [FLINK-26173][streaming] Recover GlobalCommittables with Sink V1 GlobalCommittable serializer [FLINK-26516][streaming] Recover GlobalCommittables with Sink V1 GlobalCommittable serializer Mar 7, 2022
…alCommittable serializer

With SinkV2 the committer and global committer work very similar and
they only write committables into state. SinkV1's GlobalCommitter on the
other hand used to write GlobalCommittables into state so this commits
adds an migration path.
@fapaul
Copy link
Author

fapaul commented Mar 7, 2022

If so, perhaps we could create a new jira issue for state compatibility with the sink v1 and attach this PR to that issue, and dowgrade the FLINK-26173 and leaves it open? Since we have not fully fix the issues listed in the FLINK-26173~

Thanks for the suggestion. I created a new ticket https://issues.apache.org/jira/browse/FLINK-26516 to fix the state incompatibility and lowered the priority of the original ticket.

@gaoyunhaii
Copy link
Contributor

I added a fix for the failed azure test: previously if there are no committables the combine and commit would be skipped, otherwise there might create an empty global committable. The test failed due to this reason.

Copy link
Contributor

@gaoyunhaii gaoyunhaii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @fapaul for the PR! LGTM

@gaoyunhaii gaoyunhaii closed this in 955e5ff Mar 8, 2022
JasonLeeCoding pushed a commit to JasonLeeCoding/flink that referenced this pull request May 27, 2022
…alCommittable serializer

With SinkV2 the committer and global committer work very similar and
they only write committables into state. SinkV1's GlobalCommitter on the
other hand used to write GlobalCommittables into state so this commits
adds an migration path.

This closes apache#18805.
zstraw pushed a commit to zstraw/flink that referenced this pull request Jul 4, 2022
…alCommittable serializer

With SinkV2 the committer and global committer work very similar and
they only write committables into state. SinkV1's GlobalCommitter on the
other hand used to write GlobalCommittables into state so this commits
adds an migration path.

This closes apache#18805.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants