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-14264][StateBackend][Rest] Expose state backend in checkpoint rest api #10344
Conversation
cc @aljoscha |
Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community Automated ChecksLast check on commit fbd6e89 (Thu Nov 28 06:51:46 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. 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 commandsThe @flinkbot bot supports the following commands:
|
@@ -100,13 +100,15 @@ private static CheckpointConfigInfo createCheckpointConfigInfo(AccessExecutionGr | |||
retentionPolicy != CheckpointRetentionPolicy.NEVER_RETAIN_AFTER_TERMINATION, | |||
retentionPolicy != CheckpointRetentionPolicy.RETAIN_ON_CANCELLATION); | |||
|
|||
String stateName = checkpointCoordinatorConfiguration.getStateBackendName() == null ? "TEMPORARY_UNKNOWN" : checkpointCoordinatorConfiguration.getStateBackendName(); |
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.
If we query the rest before the job is running, maybe the checkpointCoordinatorConfiguration.getStateBackendName()
will return null (please see the above comments), so transfer to TEMPORARY_UNKNOWN
here.
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.
how would you query for a job before it is submitted? You'd end up with 404 in all cases.
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.
@zentol Thanks for the clarification. Before I submit the PR, I tried a few times to query the rest before job submitted, but the job submitting duration holds too small, all end up with a running job.
Maybe we should add a checkNotNull
here for stateBackendName
, what do you think.
return stateBackendName; | ||
} | ||
|
||
public void setStateBackendName(@Nonnull String newStateBackend) { |
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.
Add a setter function here instead of passed in from constructor, because StreamGraph#getStateBackend()
may return null in StreamingJobGraphGenerator#configureCheckpointing
@klion26 It's a bit harder to find but there is this: https://github.com/apache/flink/blob/e1ca4c46ea7e2940b0200b635bc49766d594ffb0/flink-docs/README.md |
@aljoscha thanks for the reply, have generated the rest document. |
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.
I don't think this is a viable approach; unfortunately I couldn't quickly come up with a proper way of doing it.
@@ -2526,7 +2529,7 @@ | |||
"type" : "array", | |||
"items" : { | |||
"type" : "object", | |||
"id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:SubtaskExecutionAttemptDetailsInfo", | |||
"id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:job:SubtaskExecutionAttemptDetailsInfo", |
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.
it appears the api docs were a bit outdated; can you move this change and below ones into a separate commit?
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, will update it
@@ -36,6 +38,8 @@ | |||
|
|||
private static final long serialVersionUID = 2L; | |||
|
|||
private String stateBackendName; |
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 doesn't seem like the right place to put it; we are polluting a runtime configuration class with information that is only relevant to the REST API. This class should only contain things that are relevant for the CheckpointCoordinator; that's this class purpose after all.
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.
I think it's the name here that makes people confused. the stateBackendName
here is checkpoint backend name
, such as MemoryStateBackend
, FsStateBackend
or RocksDBStateBackend
, and I think they'are relevant with CheckpointCoordinator
, we'll also pass the backend into CheckpointCoordinator to init the checkpoint directory.
Maybe we could update the name here, what do you think?
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.
What functional purpose would this field have for the coordinator? It already has the actual backend.
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.
Ahh, got it.
Maybe we should get the stateBackendName
from AccessExecutionGraph
directly(add a new function getStateBackend
in AccessExecutionGraph
, pass the stateBackendName
into ArchivedExecutionGraph
when init a new ArchivedExecutionGraph
), what do you think?
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.
That's a better option.
I would suggest adding CheckpointCoordinator#getStateBackendName()
that is called in ArchivedExecutionGraph#from()
. Your plan should cover the rest.
@@ -100,13 +100,15 @@ private static CheckpointConfigInfo createCheckpointConfigInfo(AccessExecutionGr | |||
retentionPolicy != CheckpointRetentionPolicy.NEVER_RETAIN_AFTER_TERMINATION, | |||
retentionPolicy != CheckpointRetentionPolicy.RETAIN_ON_CANCELLATION); | |||
|
|||
String stateName = checkpointCoordinatorConfiguration.getStateBackendName() == null ? "TEMPORARY_UNKNOWN" : checkpointCoordinatorConfiguration.getStateBackendName(); |
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.
how would you query for a job before it is submitted? You'd end up with 404 in all cases.
@zentol thanks for your review. |
Currently, I set the default value of "stateBackend" to "disabled", because when I run job(disabled periodic checkpoint) on yarn, I can still get the checkpoint config from rest. I find that in I'll find out why this happens and come back. |
Currently, we use I think we can create another issue to use |
So I asked around and the reason why the CC is created even if checkpointing is disabled is that you still need it to support savepoints.
Which part would be failing right now? |
Currently, not part will fail right now. I said that it will always fail is that Before I find that the rest will throw exception with reason Apart from the default value of |
I'm fine with setting it to null by default; it's a bit odd that the CC can be null in the ArchivedEG but not the stateBackendName. |
@zentol thanks for the replay, updated it. |
What is the purpose of the change
Expose
stateBackend
injobs/:jobId/checkpoints/config
rest apiVerifying this change
This change added tests and can be verified as follows:
CheckpointConfigInfoTest#testJsonMarshalling
Does this pull request potentially affect one of the following parts:
@Public(Evolving)
: (no)Documentation