How to use FsBackBackend without getting deprecation warning

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to use FsBackBackend without getting deprecation warning

Nikola Hrusov
Hello,

I would like to enable fs backend for the state of my job.
Following the guides: 


what I need to do is:

StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.setStateBackend(new FsStateBackend("hdfs://namenode:40010/flink/checkpoints"));
However, when I do this, I get a deprecation warning which says "@deprecated Use {@link #setStateBackend(StateBackend)} instead.": https://ci.apache.org/projects/flink/flink-docs-master/api/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.html#setStateBackend-org.apache.flink.runtime.state.AbstractStateBackend

Which class should I use instead of this one so I do not get a warning? Is it possible to reflect that in the docs?

Thank you

Regards
,
Nikola Hrusov

Reply | Threaded
Open this post in threaded view
|

Re: How to use FsBackBackend without getting deprecation warning

KristoffSC
Hi,
had the same problem.

Try this:
env.setStateBackend((StateBackend) new
FsStateBackend("hdfs://namenode:40010/flink/checkpoints"));

yeah... not the cleanest way... I guess the API is not that clean after all.



--
Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: How to use FsBackBackend without getting deprecation warning

Nikola Hrusov
Hello,

That does seem to remove the warning, but I am not sure that's the way I would like to go about it. 
Just casting it seems like hiding the issue. But I agree with you, it is not the most clean in that case.


Regards
,
Nikola Hrusov

On Mon, Aug 10, 2020 at 9:46 PM KristoffSC <[hidden email]> wrote:
Hi,
had the same problem.

Try this:
env.setStateBackend((StateBackend) new
FsStateBackend("hdfs://namenode:40010/flink/checkpoints"));

yeah... not the cleanest way... I guess the API is not that clean after all.



--
Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: How to use FsBackBackend without getting deprecation warning

Yun Tang
Hi Nikola

You could use codes below to get rid of the warnings.
StateBackend fsStateBackend = new FsStateBackend("hdfs://namenode:40010/flink/checkpoints");
env
.setStateBackend(fsStateBackend);
In fact, this warning is actually no harmful.

Best
Yun Tang

From: Nikola Hrusov <[hidden email]>
Sent: Tuesday, August 11, 2020 13:32
To: KristoffSC <[hidden email]>
Cc: [hidden email] <[hidden email]>
Subject: Re: How to use FsBackBackend without getting deprecation warning
 
Hello,

That does seem to remove the warning, but I am not sure that's the way I would like to go about it. 
Just casting it seems like hiding the issue. But I agree with you, it is not the most clean in that case.


Regards
,
Nikola Hrusov

On Mon, Aug 10, 2020 at 9:46 PM KristoffSC <[hidden email]> wrote:
Hi,
had the same problem.

Try this:
env.setStateBackend((StateBackend) new
FsStateBackend("hdfs://namenode:40010/flink/checkpoints"));

yeah... not the cleanest way... I guess the API is not that clean after all.



--
Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/