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-35346][table-common] Introduce workflow scheduler interface for materialized table #24767

Merged
merged 2 commits into from May 16, 2024

Conversation

lsyldliu
Copy link
Contributor

What is the purpose of the change

Introduce workflow scheduler interface for materialized table

Brief change log

  • Introduce workflow scheduler interface for materialized table

Verifying this change

This change added tests and can be verified as follows:

  • Added unit tests in WorkflowSchedulerFactoryUtilTest

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): (yes)
  • The serializers: (don't know)
  • The runtime per-record code paths (performance sensitive): (no)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: ( no )
  • The S3 file system connector: ( no)

Documentation

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

@flinkbot
Copy link
Collaborator

flinkbot commented May 10, 2024

CI report:

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

@lsyldliu lsyldliu force-pushed the workflow_interface branch 3 times, most recently from befaab5 to b58749b Compare May 10, 2024 08:28
@lsyldliu lsyldliu changed the title Draft PR: Introduce workflow scheduler interface for materialized table [FLINK-35346][table-api] Introduce workflow scheduler interface for materialized table May 14, 2024
@lsyldliu lsyldliu marked this pull request as ready for review May 14, 2024 05:40
@lsyldliu lsyldliu changed the title [FLINK-35346][table-api] Introduce workflow scheduler interface for materialized table [FLINK-35346][table-common] Introduce workflow scheduler interface for materialized table May 14, 2024
Copy link
Contributor

@hackergin hackergin left a comment

Choose a reason for hiding this comment

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

@lsyldliu Thanks for the contribution, I left only two minor comments.

* Close this workflow scheduler when it is no longer needed and release any resource that it
* might be holding.
*
* @throws WorkflowException if close the related resources of workflow scheduler failed
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* @throws WorkflowException if close the related resources of workflow scheduler failed
* @throws WorkflowException if closing the related resources of workflow scheduler failed

* @param createRefreshWorkflow The detail info for create refresh workflow of materialized
* table.
* @return The meta info which points to the refresh workflow in scheduler service.
* @throws WorkflowException if create refresh workflow failed
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* @throws WorkflowException if create refresh workflow failed
* @throws WorkflowException if creating refresh workflow failed

* @param createRefreshWorkflow The detail info for create refresh workflow of materialized
* table.
* @return The meta info which points to the refresh workflow in scheduler service.
* @throws WorkflowException if create refresh workflow failed
Copy link
Contributor

Choose a reason for hiding this comment

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

As I understand it, there may be two possible implementations for the current CreateRefreshWorkflow in the future, corn and one-time. If there is a WorkFlowScheduler that supports only one of these two types, should we throw an unsupported exception at this point?

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 think it is no need, you can the related interface methods of Catalog, it doesn't thrown the unsupported exception in method signature even though some operations unsupported. Moreover, we have introduced the WorkflowException for WorkflowScheduler, I think we should try to wrap the exception to WorkflowExeception, it is checked Exception, user should sense it.

* because it is optional for materialized table.
*/
public static @Nullable WorkflowScheduler<?> createWorkflowScheduler(
Configuration configuration, ClassLoader classLoader) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to pass in a ReadableConfig here? Such as TableConfig? If so, we can directly use the following method to get all options.

ConfigOption<Map<String, String>>  workflowSchedulerOptions = new 

ConfigOptions.key(WORKFLOW_SCHEDULER_PREFIX+  "." +  identifier)
                        .mapType()
                        .defaultValue(new HashMap<>());

Map<String, String> options = configuration.get(workflowSchedulerOptions);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, MaterializedTableManager will be created when open a session, it will be as a member of SessionState, we can only get the Configuration on construct SessionState.

Copy link
Contributor Author

@lsyldliu lsyldliu left a comment

Choose a reason for hiding this comment

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

@hackergin Thanks for your reviewing, I've addressed your comments.

@hackergin
Copy link
Contributor

@lsyldliu Thanks for the updates and explanations, LGTM.

@lsyldliu lsyldliu merged commit 1378979 into apache:master May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants