[
https://issues.apache.org/jira/browse/FLINK-11691?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Yun Tang updated FLINK-11691:
-----------------------------
Description:
Currently, interface {{ConfigurableStateBackend}} has method definition below:
{code:java}
StateBackend configure(Configuration config) throws
IllegalConfigurationException;
{code}
Actually, we need the class loader for anything needed to instantiate through
reflection when calling {{StateBackend#configure}}. This is really helpful if
we want something to be configurable. Take an example, by providing a class
name via flink-conf.yaml, user could configure anything they want, such as the
{{OptionsFactory}} in {{RocksDBStateBackend}} (FLINK-10912) or the compression
decorator in {{StateBackend}} (FLINK-11313)
On the other hand, interface {{StateBackendFactory}} also has method definition
below, which would then call {{StateBackend#configure}}.
{code:java}
T createFromConfig(Configuration config) throws IllegalConfigurationException,
IOException;
{code}
They were all called mainly in
{{StateBackendLoader#loadStateBackendFromConfig}} and
{{StateBackendLoader#fromApplicationOrConfigOrDefault}}. Those two methods
already have {{ClassLoader}} in their parameters, and it would be easy to pass
the class loader to the {{configure}} methods mentioned above.
{{ConfigurableStateBackend}} has no annotation, and from its usage, it should
be an annotation of {{'Internal'}}. On the other hand, {{StateBackendFactory}}
has an annotation of '{{PublicEvolving'}}, which means we could change the
interface if needed.
was:
Currently, interface {{ConfigurableStateBackend}} has method definition below:
{code:java}
StateBackend configure(Configuration config) throws
IllegalConfigurationException;
{code}
Actually, we need the class loader for anything needed to instantiate through
reflection when calling {{StateBackend#configure}}. This is really helpful if
we want something to be configurable. Take an example, by providing a class
name via flink-conf.yaml, user could configure anything they want, such as the
{{OptionsFactory}} in {{RocksDBStateBackend}}
([FLINK-10912|https://issues.apache.org/jira/browse/FLINK-10912]) or the
compression decorator in {{StateBackend}}
([FLINK-11313|https://issues.apache.org/jira/browse/FLINK-11313])
On the other hand, interface {{StateBackendFactory}} also has method definition
below, which would then call {{StateBackend#configure}}.
{code:java}
T createFromConfig(Configuration config) throws IllegalConfigurationException,
IOException;
{code}
They were all called mainly in
{{StateBackendLoader#loadStateBackendFromConfig}} and
{{StateBackendLoader#fromApplicationOrConfigOrDefault}}. Those two methods
already have {{ClassLoader}} in their parameters, and it would be easy to pass
the class loader to the {{configure}} methods mentioned above.
{{ConfigurableStateBackend}} has no annotation, from its usage, it should be a
{{'@Internal'}}
> Introduce ClassLoader in the methods of StateBackendFactory and
> ConfigurableStateBackend
> ----------------------------------------------------------------------------------------
>
> Key: FLINK-11691
> URL: https://issues.apache.org/jira/browse/FLINK-11691
> Project: Flink
> Issue Type: Improvement
> Reporter: Yun Tang
> Priority: Major
> Fix For: 1.8.0
>
>
> Currently, interface {{ConfigurableStateBackend}} has method definition below:
> {code:java}
> StateBackend configure(Configuration config) throws
> IllegalConfigurationException;
> {code}
> Actually, we need the class loader for anything needed to instantiate through
> reflection when calling {{StateBackend#configure}}. This is really helpful if
> we want something to be configurable. Take an example, by providing a class
> name via flink-conf.yaml, user could configure anything they want, such as
> the {{OptionsFactory}} in {{RocksDBStateBackend}} (FLINK-10912) or the
> compression decorator in {{StateBackend}} (FLINK-11313)
> On the other hand, interface {{StateBackendFactory}} also has method
> definition below, which would then call {{StateBackend#configure}}.
> {code:java}
> T createFromConfig(Configuration config) throws
> IllegalConfigurationException, IOException;
> {code}
> They were all called mainly in
> {{StateBackendLoader#loadStateBackendFromConfig}} and
> {{StateBackendLoader#fromApplicationOrConfigOrDefault}}. Those two methods
> already have {{ClassLoader}} in their parameters, and it would be easy to
> pass the class loader to the {{configure}} methods mentioned above.
> {{ConfigurableStateBackend}} has no annotation, and from its usage, it should
> be an annotation of {{'Internal'}}. On the other hand,
> {{StateBackendFactory}} has an annotation of '{{PublicEvolving'}}, which
> means we could change the interface if needed.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)