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-20331][checkpointing][task] Don't fail the task if unaligned checkpoint was subsumed #14218

Merged
merged 1 commit into from Nov 26, 2020

Conversation

rkhachatryan
Copy link
Contributor

What is the purpose of the change

A check was added recently that the RemoteInputChannel.lastBarrierSequenceNumber was not overwritten by a newer barrier.
The check itself is valid, however the task shouldn't fail in that case.

Relying on the assumption of at most one active unaligned checkpoint at a time, the older checkpoint should simply be declined.
Cleanup is needed for (all) channels, barrier controller, handler and checkpoint writer. Therefore, abort in SingleCheckpointBarrierHandler should be used.

Verifying this change

This change is already covered by existing test: UnalignedCheckpointITCase.parallel pipeline with mixed channels, p = 20

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

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

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? no

@rkhachatryan rkhachatryan changed the title [FLINK-20331][checkpointing][task] Don't fail the task if unaligned c… [FLINK-20331][checkpointing][task] Don't fail the task if unaligned checkpoint was subsumed Nov 25, 2020
@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 1109ad2 (Wed Nov 25 12:42:11 UTC 2020)

Warnings:

  • No documentation files were touched! Remember to keep the Flink docs up to date!

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

assert Thread.holdsLock(receivedBuffers);

if (checkpointId < lastBarrierId) {
throw new CheckpointException(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was in doubt whether this exception type is appropriate here or whether an Optional should be returned.
But at the upper level, it ultimately should be used, and the reason is only known here (so it would be harder to analyze the exception/empty buffers later).

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is exactly the case for which CheckpointException was designed.

@@ -158,14 +163,16 @@ public void processBarrierAnnouncement(
@Override
public void processCancellationBarrier(CancelCheckpointMarker cancelBarrier) throws IOException {
final long cancelledId = cancelBarrier.getCheckpointId();
if (currentCheckpointId > cancelledId || (currentCheckpointId == cancelledId && numBarriersReceived == 0)) {
return;
if (cancelledId >= currentCheckpointId && (cancelledId > currentCheckpointId || numBarriersReceived > 0)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please double-check this @AHeise :)

Copy link
Contributor

@AHeise AHeise Nov 25, 2020

Choose a reason for hiding this comment

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

It's correct but it might be easier to do

cancelledId > currentCheckpointId || (currentCheckpointId == cancelledId && numBarriersReceived > 0)

So either it's a future checkpoint, or it's the current checkpoint and not yet canceled.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like it!

// by setting the currentCheckpointId to this checkpoint while keeping the numBarriers
// at zero means that no checkpoint barrier can start a new alignment
currentCheckpointId = cancelledId;
currentCheckpointId = Math.max(cancelledId, currentCheckpointId);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not necessary currently.
But because I extracted this method the assignment became more error-prone, so I added this check.

Copy link
Contributor

@AHeise AHeise left a comment

Choose a reason for hiding this comment

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

Thank you very much. The fix looks very good.
I made a suggestion on the more complicated condition.

@@ -158,14 +163,16 @@ public void processBarrierAnnouncement(
@Override
public void processCancellationBarrier(CancelCheckpointMarker cancelBarrier) throws IOException {
final long cancelledId = cancelBarrier.getCheckpointId();
if (currentCheckpointId > cancelledId || (currentCheckpointId == cancelledId && numBarriersReceived == 0)) {
return;
if (cancelledId >= currentCheckpointId && (cancelledId > currentCheckpointId || numBarriersReceived > 0)) {
Copy link
Contributor

@AHeise AHeise Nov 25, 2020

Choose a reason for hiding this comment

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

It's correct but it might be easier to do

cancelledId > currentCheckpointId || (currentCheckpointId == cancelledId && numBarriersReceived > 0)

So either it's a future checkpoint, or it's the current checkpoint and not yet canceled.

@flinkbot
Copy link
Collaborator

flinkbot commented Nov 25, 2020

CI report:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants