-
Notifications
You must be signed in to change notification settings - Fork 13.9k
[FLINK-13581][coordination][tests] Harden BatchFineGrainedRecoveryITCase #9374
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
Conversation
|
Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community Automated ChecksLast check on commit 03733d7 (Thu Aug 08 12:15:42 UTC 2019) Warnings:
Mention the bot in a comment to re-run the automated checks. Review Progress
Please see the Pull Request Review Guide for a full explanation of the review process. DetailsThe 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 commandsThe @flinkbot bot supports the following commands:
|
tillrohrmann
left a comment
There was a problem hiding this 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 | ||
| } | ||
| } |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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; | ||
|
|
There was a problem hiding this comment.
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(); | ||
| } |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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> { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
|
Thanks for the review @tillrohrmann and the feedback about the test. |
tillrohrmann
left a comment
There was a problem hiding this 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.
|
Hmm the japicmp plugin complains about the added methods to the |
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.
|
Actually, we don't need 0e09c48. Using |
69613de to
03733d7
Compare
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.
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.
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.
What is the purpose of the change
If counting of mapper restarts in
BatchFineGrainedRecoveryITCaseis 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
MiniClusterClientforBatchFineGrainedRecoveryITCaseto query task attemptsVerifying this change
Run
BatchFineGrainedRecoveryITCase.Does this pull request potentially affect one of the following parts:
@Public(Evolving): (no)Documentation