Skip to content

Conversation

@azagrebin
Copy link
Contributor

What is the purpose of the change

If counting of mapper restarts in BatchFineGrainedRecoveryITCase is based on the open method of user function, the fact of the restart depends on internal implementation of the local Task and whether the open method is eventually called.

If execution attempt numbers are used instead, the test behaviour is more stable because it depends only on coordination. The execution attempt numbers can be queried from the REST client of the testing mini cluster.

Brief change log

  • Introduce MiniClusterClient for BatchFineGrainedRecoveryITCase to query task attempts
  • Use mapper task attempt numbers instead of user function open method call counters

Verifying this change

Run BatchFineGrainedRecoveryITCase.

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, 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? (not applicable)

@flinkbot
Copy link
Collaborator

flinkbot commented Aug 6, 2019

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 03733d7 (Thu Aug 08 12:15:42 UTC 2019)

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.

Details
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 Aug 6, 2019

CI report:

Copy link
Contributor

@tillrohrmann tillrohrmann left a comment

Choose a reason for hiding this comment

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

Thanks for opening this PR @azagrebin. I had some comments mainly around the usage of RestClusterClient vs. RestClient.

I know that this test tests some complex behaviour, but I have to admit that it's not easy to actually follow what's going on. Hence I'm a bit concerned about its maintainability in the long run. Nothing we have to address right away but maybe we can rework this test to be a bit simpler and easier to understand.

rethrow(t);
throw new RuntimeException("Unreachable", t); // to prevent returning null and IDE null analysis
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this maybe go into the SupplierWithException interface as SupplierWithException.join (similarly to CompletableFuture.join)? Adding it as a default implementation should not break the interface.

//-------------------------------------------------------------------------

private <M extends MessageHeaders<EmptyRequestBody, P, U>, U extends MessageParameters, P extends ResponseBody> CompletableFuture<P>
@VisibleForTesting
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to make this visible for testing? I'd like to separate production from testing code as much as possible.

1 + // this mapper
1 + // this mapper after PartitionNotFoundException
i + // previous mappers
i) // previous mappers after PartitionNotFoundException
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not so trivial to follow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, we can try to simplify the test or you think this particular calculation could be rewritten?

Copy link
Contributor

@tillrohrmann tillrohrmann Aug 8, 2019

Choose a reason for hiding this comment

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

No I think the calculation with the comments is quite descriptive. However, the calculation itself is quite complicated because of all the different restarts being caused by different events.

private static TestingMiniCluster miniCluster;

private static MiniClusterClient client;

Copy link
Contributor

Choose a reason for hiding this comment

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

Setting FORCE_PARTITION_RELEASE_ON_CONSUMPTION to false in line 173 is no longer needed.


if (client != null) {
client.shutdown();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Side comment, why not using the MiniClusterResource to set up the TestEnvironment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

MiniClusterResource provides MiniCluster with protected methods: startTaskExecutor and terminateTaskExecutor used in this test. TestingMiniCluster exposes them as public.

Copy link
Contributor

Choose a reason for hiding this comment

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

All right. As a follow up one could think about providing a TestingMiniClusterResource but this is not necessary for this PR.

}
}

private static class MiniClusterClient extends RestClusterClient<StandaloneClusterId> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to extend the RestClusterClient? Wouldn't it be enough to simply use the RestClient with the rest address which one gets from the MiniCluster? Then one would not have to change the access modifiers of the RestClusterClient and not have to jump through all these hoops to set up the client configuration.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, there is actually not so much code to reuse with the RestClusterClient.

@azagrebin
Copy link
Contributor Author

Thanks for the review @tillrohrmann and the feedback about the test.
Let's discuss later how to simplify the test in general.
I addressed the comments and left a question about the expected attempt number calculation.

Copy link
Contributor

@tillrohrmann tillrohrmann left a comment

Choose a reason for hiding this comment

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

Thanks for updating this PR @azagrebin. LGTM. Merging this PR.

@tillrohrmann
Copy link
Contributor

Hmm the japicmp plugin complains about the added methods to the SupplierWithException interface. I'll move them again to the Utils class.

If counting of mapper restarts in BatchFineGrainedRecoveryITCase is based on the open method of user function,
the fact of the restart depends on internal implementation of the local Task and whether the open method is eventually called.

If execution attempt numbers are used instead, the test behaviour is more stable because it depends only on coordination.
The execution attempt numbers can be queried from the REST client of the testing mini cluster.

This closes apache#9374.
@tillrohrmann
Copy link
Contributor

Actually, we don't need 0e09c48. Using CompletableFuture#join does the trick.

tillrohrmann pushed a commit to tillrohrmann/flink that referenced this pull request Aug 8, 2019
If counting of mapper restarts in BatchFineGrainedRecoveryITCase is based on the open method of user function,
the fact of the restart depends on internal implementation of the local Task and whether the open method is eventually called.

If execution attempt numbers are used instead, the test behaviour is more stable because it depends only on coordination.
The execution attempt numbers can be queried from the REST client of the testing mini cluster.

This closes apache#9374.
tillrohrmann pushed a commit that referenced this pull request Aug 8, 2019
If counting of mapper restarts in BatchFineGrainedRecoveryITCase is based on the open method of user function,
the fact of the restart depends on internal implementation of the local Task and whether the open method is eventually called.

If execution attempt numbers are used instead, the test behaviour is more stable because it depends only on coordination.
The execution attempt numbers can be queried from the REST client of the testing mini cluster.

This closes #9374.
becketqin pushed a commit to becketqin/flink that referenced this pull request Aug 17, 2019
If counting of mapper restarts in BatchFineGrainedRecoveryITCase is based on the open method of user function,
the fact of the restart depends on internal implementation of the local Task and whether the open method is eventually called.

If execution attempt numbers are used instead, the test behaviour is more stable because it depends only on coordination.
The execution attempt numbers can be queried from the REST client of the testing mini cluster.

This closes apache#9374.
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