-
Notifications
You must be signed in to change notification settings - Fork 13.8k
[FLINK-32512] Don't register resource to user resource manager when creating temporary function #22938
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-32512] Don't register resource to user resource manager when creating temporary function #22938
Conversation
6ded434 to
12c7871
Compare
fsk119
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 your contribution.
...table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/FunctionCatalog.java
Outdated
Show resolved
Hide resolved
...table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/FunctionCatalog.java
Outdated
Show resolved
Hide resolved
...table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/FunctionCatalog.java
Show resolved
Hide resolved
...able/flink-table-api-java/src/main/java/org/apache/flink/table/resource/ResourceManager.java
Outdated
Show resolved
Hide resolved
d9717b3 to
a7067ea
Compare
dcc1bec to
418eb19
Compare
|
Hi @fsk119 , I have updated this PR, please help to review it again, thanks |
e96dea5 to
7ab3ec3
Compare
...table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/FunctionCatalog.java
Show resolved
Hide resolved
...able/flink-table-api-java/src/main/java/org/apache/flink/table/resource/ResourceManager.java
Show resolved
Hide resolved
...able/flink-table-api-java/src/main/java/org/apache/flink/table/resource/ResourceManager.java
Outdated
Show resolved
Hide resolved
...able/flink-table-api-java/src/main/java/org/apache/flink/table/resource/ResourceManager.java
Show resolved
Hide resolved
...able/flink-table-api-java/src/main/java/org/apache/flink/table/resource/ResourceManager.java
Show resolved
Hide resolved
...table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/FunctionCatalog.java
Show resolved
Hide resolved
...table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/FunctionCatalog.java
Show resolved
Hide resolved
...table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/FunctionCatalog.java
Show resolved
Hide resolved
...table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/FunctionCatalog.java
Show resolved
Hide resolved
|
Thanks for the PR, @FangYongs . Please rebase it on the latest master and see my comments. |
...able/flink-table-api-java/src/main/java/org/apache/flink/table/resource/ResourceManager.java
Outdated
Show resolved
Hide resolved
...table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/FunctionCatalog.java
Show resolved
Hide resolved
...able/flink-table-api-java/src/main/java/org/apache/flink/table/resource/ResourceManager.java
Outdated
Show resolved
Hide resolved
...table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/FunctionCatalog.java
Show resolved
Hide resolved
...table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/FunctionCatalog.java
Show resolved
Hide resolved
...able/flink-table-api-java/src/main/java/org/apache/flink/table/resource/ResourceManager.java
Show resolved
Hide resolved
7ab3ec3 to
27d11c5
Compare
27d11c5 to
e8f015a
Compare
KarmaGYZ
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 the update. LGTM except for 2 minor comments.
...table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/FunctionCatalog.java
Outdated
Show resolved
Hide resolved
...table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/FunctionCatalog.java
Outdated
Show resolved
Hide resolved
fsk119
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.
LGTM
… when creating temporary function
d1fe483 to
2136e23
Compare
|
@flinkbot run azure |
What is the purpose of the change
When flink perform
create temporary functionorcreate system functionwith a jar file, it will register the jar file toResourceManagerand add it to theClassLoader. This cause theSHOW JARSstatement can list the jar files for these functions, and even when a job does not use these function, the jar file will be aded to the job's classpath.This PR aims to address this issue with three steps:
a> Download the jar file from remote as needed, which is the same as before for these functions.
b> Add jar files for temporary and system functions to a new class
FunctionResourceManagerinResourceManagerwhen they are created.c> Create a new classloader with the added jar files and validate the function class
a> Register the jar files for the functions to
ResourceManager, which will be added to the classpath of the jobb> Add the jar files to the classloader for the job
a> There is reference counter in
FunctionResourceManagerfor each jar fileb> Register or unregister function to the
FunctionResourceManagerwill update the reference counterc> The jar file in
FunctionResourceManagerwill be removed when the reference counter comes to 0In this way, the jar files for temporary or system function will not be listed in
SHOW JARSand will not be added to the classpath and classloader when a job does not use it.Brief change log
FunctionResourceManagerto register and unregister jar files for temporary and system functionsresourceInfosanduserClassLoaderwhen temporary and system functions are created, register jar files toFunctionResourceManagerresourceInfosanduserClassLoaderwhen the functions are used in a jobVerifying this change
This change added tests and can be verified as follows:
SHOW JARS;infunction.qafter creating a temporary functions and the result is emptyFunctionITCase.testCreateTemporarySystemFunctionByUsingJarto show jars after creating system functionResourceManagerTest.testRegisterFunctionResourceto verify the jar file will no be added to classloader when it is registered inFunctionResourceManagerResourceManagerTest.testRegisterFunctionResourceto check the jar file can be registered and unregistered inFunctionResourceManagerwith reference counterDoes this pull request potentially affect one of the following parts:
@Public(Evolving): (yes / no) noDocumentation