You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-zh@flink.apache.org by shx <17...@163.com> on 2020/04/30 01:40:45 UTC

回复:flink1.9,state process api 读取MapState,出错

能发一下写入状态的代码看一下吗,还有一个问题,键值状态访问,你的代码里是读出了所有key关键的mapstate吗,谢谢




| |
邵红晓
|
|
邮箱:17611022895@163.com
|

签名由 网易邮箱大师 定制

在2020年04月30日 09:04,guanyq 写道:
代码中没特别指定Serializer。都是默认的序列化。
在 2020-04-29 18:20:22,"Congxian Qiu" <qc...@gmail.com> 写道:
>Hi
>从错误日志看,是 StateMigration 相关的问题。
>你需要确认下,你的代码中的 Serializer 和 savepoint 中 state 相关的 serializer
>是一样的或者是兼容的,你可以参考下这个文档[1]
>
>[1]
>https://ci.apache.org/projects/flink/flink-docs-release-1.10/dev/stream/state/schema_evolution.html
>
>Best,
>Congxian
>
>
>guanyq <dl...@163.com> 于2020年4月29日周三 下午6:09写道:
>
>>
>> 附件是代码和错误日志。目前不知道如何调查。麻烦帮忙看下 谢谢。

Re: Re:Re:回复:flink1.9,state process api 读取MapState,出错

Posted by Congxian Qiu <qc...@gmail.com>.
你好,你最后一条消息的图挂了,可以尝试用文字把整个问题的原因,以及解决方案描述一下发到邮件列表中,可以帮助后来人。后续有人遇到类似的问题,能够搜索到相关的解决方案。
Best,
Congxian


guanyq <dl...@163.com> 于2020年4月30日周四 下午4:13写道:

> 定位到问题点了。
> 和这个keyBy有关,后一种可以读取MapState,前一种报错
>
>
>
>

Re:Re:Re:回复:flink1.9,state process api 读取MapState,出错

Posted by guanyq <dl...@163.com>.
定位到问题点了。
和这个keyBy有关,后一种可以读取MapState,前一种报错

Re:Re:回复:flink1.9,state process api 读取MapState,出错

Posted by guanyq <dl...@163.com>.
我自己又实现了一个MapState的存储job,用同样的代码是可以读取出所有MapState的key的。
在 2020-04-30 15:23:39,"guanyq" <dl...@163.com> 写道:
>public class MyKeyedMapState {<br/>    public String key;<br/>    public List&lt;String&gt; value;<br/><br/>    public MyKeyedMapState() {<br/>    }<br/><br/>    public String getKey() {<br/>        return key;<br/>    }<br/><br/>    public void setKey(String key) {<br/>        this.key = key;<br/>    }<br/><br/>    public List&lt;String&gt; getValue() {<br/>        return value;<br/>    }<br/><br/>    public void setValue(List&lt;String&gt; value) {<br/>        this.value = value;<br/>    }<br/>}<br/><br/>改成这个也还是报同样的错误!
>在 2020-04-30 15:19:18,"shao.hongxiao" <17...@163.com> 写道:
>>
>>
>>用一个正常的Java pojo试一下
>>| |
>>邵红晓
>>|
>>|
>>邮箱:17611022895@163.com
>>|
>>签名由网易邮箱大师定制
>>在2020年4月30日 15:14,guanyq<dl...@163.com> 写道:
>>有没有发现,我这还是报错。
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>在 2020-04-30 09:40:45,"shx" <17...@163.com> 写道:
>>能发一下写入状态的代码看一下吗,还有一个问题,键值状态访问,你的代码里是读出了所有key关键的mapstate吗,谢谢
>>
>>
>>
>>
>>| |
>>邵红晓
>>|
>>|
>>邮箱:17611022895@163.com
>>|
>>
>>签名由 网易邮箱大师 定制
>>
>>在2020年04月30日 09:04,guanyq 写道:
>>代码中没特别指定Serializer。都是默认的序列化。
>>在 2020-04-29 18:20:22,"Congxian Qiu" <qc...@gmail.com> 写道:
>>Hi
>>从错误日志看,是 StateMigration 相关的问题。
>>你需要确认下,你的代码中的 Serializer 和 savepoint 中 state 相关的 serializer
>>是一样的或者是兼容的,你可以参考下这个文档[1]
>>
>>[1]
>>https://ci.apache.org/projects/flink/flink-docs-release-1.10/dev/stream/state/schema_evolution.html
>>
>>Best,
>>Congxian
>>
>>
>>guanyq <dl...@163.com> 于2020年4月29日周三 下午6:09写道:
>>
>>
>>附件是代码和错误日志。目前不知道如何调查。麻烦帮忙看下 谢谢。

Re:回复:flink1.9,state process api 读取MapState,出错

Posted by guanyq <dl...@163.com>.
public class MyKeyedMapState {<br/>    public String key;<br/>    public List&lt;String&gt; value;<br/><br/>    public MyKeyedMapState() {<br/>    }<br/><br/>    public String getKey() {<br/>        return key;<br/>    }<br/><br/>    public void setKey(String key) {<br/>        this.key = key;<br/>    }<br/><br/>    public List&lt;String&gt; getValue() {<br/>        return value;<br/>    }<br/><br/>    public void setValue(List&lt;String&gt; value) {<br/>        this.value = value;<br/>    }<br/>}<br/><br/>改成这个也还是报同样的错误!
在 2020-04-30 15:19:18,"shao.hongxiao" <17...@163.com> 写道:
>
>
>用一个正常的Java pojo试一下
>| |
>邵红晓
>|
>|
>邮箱:17611022895@163.com
>|
>签名由网易邮箱大师定制
>在2020年4月30日 15:14,guanyq<dl...@163.com> 写道:
>有没有发现,我这还是报错。
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>在 2020-04-30 09:40:45,"shx" <17...@163.com> 写道:
>能发一下写入状态的代码看一下吗,还有一个问题,键值状态访问,你的代码里是读出了所有key关键的mapstate吗,谢谢
>
>
>
>
>| |
>邵红晓
>|
>|
>邮箱:17611022895@163.com
>|
>
>签名由 网易邮箱大师 定制
>
>在2020年04月30日 09:04,guanyq 写道:
>代码中没特别指定Serializer。都是默认的序列化。
>在 2020-04-29 18:20:22,"Congxian Qiu" <qc...@gmail.com> 写道:
>Hi
>从错误日志看,是 StateMigration 相关的问题。
>你需要确认下,你的代码中的 Serializer 和 savepoint 中 state 相关的 serializer
>是一样的或者是兼容的,你可以参考下这个文档[1]
>
>[1]
>https://ci.apache.org/projects/flink/flink-docs-release-1.10/dev/stream/state/schema_evolution.html
>
>Best,
>Congxian
>
>
>guanyq <dl...@163.com> 于2020年4月29日周三 下午6:09写道:
>
>
>附件是代码和错误日志。目前不知道如何调查。麻烦帮忙看下 谢谢。

回复:flink1.9,state process api 读取MapState,出错

Posted by "shao.hongxiao" <17...@163.com>.

用一个正常的Java pojo试一下
| |
邵红晓
|
|
邮箱:17611022895@163.com
|
签名由网易邮箱大师定制
在2020年4月30日 15:14,guanyq<dl...@163.com> 写道:
有没有发现,我这还是报错。

















在 2020-04-30 09:40:45,"shx" <17...@163.com> 写道:
能发一下写入状态的代码看一下吗,还有一个问题,键值状态访问,你的代码里是读出了所有key关键的mapstate吗,谢谢




| |
邵红晓
|
|
邮箱:17611022895@163.com
|

签名由 网易邮箱大师 定制

在2020年04月30日 09:04,guanyq 写道:
代码中没特别指定Serializer。都是默认的序列化。
在 2020-04-29 18:20:22,"Congxian Qiu" <qc...@gmail.com> 写道:
Hi
从错误日志看,是 StateMigration 相关的问题。
你需要确认下,你的代码中的 Serializer 和 savepoint 中 state 相关的 serializer
是一样的或者是兼容的,你可以参考下这个文档[1]

[1]
https://ci.apache.org/projects/flink/flink-docs-release-1.10/dev/stream/state/schema_evolution.html

Best,
Congxian


guanyq <dl...@163.com> 于2020年4月29日周三 下午6:09写道:


附件是代码和错误日志。目前不知道如何调查。麻烦帮忙看下 谢谢。

Re:回复:flink1.9,state process api 读取MapState,出错

Posted by guanyq <dl...@163.com>.
有没有发现,我这还是报错。

















在 2020-04-30 09:40:45,"shx" <17...@163.com> 写道:
>能发一下写入状态的代码看一下吗,还有一个问题,键值状态访问,你的代码里是读出了所有key关键的mapstate吗,谢谢
>
>
>
>
>| |
>邵红晓
>|
>|
>邮箱:17611022895@163.com
>|
>
>签名由 网易邮箱大师 定制
>
>在2020年04月30日 09:04,guanyq 写道:
>代码中没特别指定Serializer。都是默认的序列化。
>在 2020-04-29 18:20:22,"Congxian Qiu" <qc...@gmail.com> 写道:
>>Hi
>>从错误日志看,是 StateMigration 相关的问题。
>>你需要确认下,你的代码中的 Serializer 和 savepoint 中 state 相关的 serializer
>>是一样的或者是兼容的,你可以参考下这个文档[1]
>>
>>[1]
>>https://ci.apache.org/projects/flink/flink-docs-release-1.10/dev/stream/state/schema_evolution.html
>>
>>Best,
>>Congxian
>>
>>
>>guanyq <dl...@163.com> 于2020年4月29日周三 下午6:09写道:
>>
>>>
>>> 附件是代码和错误日志。目前不知道如何调查。麻烦帮忙看下 谢谢。

Re:Re:回复:flink1.9,state process api 读取MapState,出错

Posted by guanyq <dl...@163.com>.
还有其他可能的原因么。
















在 2020-04-30 10:25:32,"guanyq" <dl...@163.com> 写道:







附件是代码
还有一个问题,键值状态访问,你的代码里是读出了所有key关键的mapstate吗
-- 代码是读出所有map状态的key。













在 2020-04-30 09:40:45,"shx" <17...@163.com> 写道:
>能发一下写入状态的代码看一下吗,还有一个问题,键值状态访问,你的代码里是读出了所有key关键的mapstate吗,谢谢
>
>
>
>
>| |
>邵红晓
>|
>|
>邮箱:17611022895@163.com
>|
>
>签名由 网易邮箱大师 定制
>
>在2020年04月30日 09:04,guanyq 写道:
>代码中没特别指定Serializer。都是默认的序列化。
>在 2020-04-29 18:20:22,"Congxian Qiu" <qc...@gmail.com> 写道:
>>Hi
>>从错误日志看,是 StateMigration 相关的问题。
>>你需要确认下,你的代码中的 Serializer 和 savepoint 中 state 相关的 serializer
>>是一样的或者是兼容的,你可以参考下这个文档[1]
>>
>>[1]
>>https://ci.apache.org/projects/flink/flink-docs-release-1.10/dev/stream/state/schema_evolution.html
>>
>>Best,
>>Congxian
>>
>>
>>guanyq <dl...@163.com> 于2020年4月29日周三 下午6:09写道:
>>
>>>
>>> 附件是代码和错误日志。目前不知道如何调查。麻烦帮忙看下 谢谢。





 

Re:回复:flink1.9,state process api 读取MapState,出错

Posted by guanyq <dl...@163.com>.





附件是代码
还有一个问题,键值状态访问,你的代码里是读出了所有key关键的mapstate吗
-- 代码是读出所有map状态的key。













在 2020-04-30 09:40:45,"shx" <17...@163.com> 写道:
>能发一下写入状态的代码看一下吗,还有一个问题,键值状态访问,你的代码里是读出了所有key关键的mapstate吗,谢谢
>
>
>
>
>| |
>邵红晓
>|
>|
>邮箱:17611022895@163.com
>|
>
>签名由 网易邮箱大师 定制
>
>在2020年04月30日 09:04,guanyq 写道:
>代码中没特别指定Serializer。都是默认的序列化。
>在 2020-04-29 18:20:22,"Congxian Qiu" <qc...@gmail.com> 写道:
>>Hi
>>从错误日志看,是 StateMigration 相关的问题。
>>你需要确认下,你的代码中的 Serializer 和 savepoint 中 state 相关的 serializer
>>是一样的或者是兼容的,你可以参考下这个文档[1]
>>
>>[1]
>>https://ci.apache.org/projects/flink/flink-docs-release-1.10/dev/stream/state/schema_evolution.html
>>
>>Best,
>>Congxian
>>
>>
>>guanyq <dl...@163.com> 于2020年4月29日周三 下午6:09写道:
>>
>>>
>>> 附件是代码和错误日志。目前不知道如何调查。麻烦帮忙看下 谢谢。

Re:回复:flink1.9,state process api 读取MapState,出错

Posted by guanyq <dl...@163.com>.
我把静态类替换成List<String>也还报同样错误
附件是代码

















在 2020-04-30 10:32:26,"shao.hongxiao" <17...@163.com> 写道:
>是不是静态内部类的问题?
>Rules for POJO types
>
>Flink recognizes a data type as a POJO type (and allows “by-name” field referencing) if the following conditions are fulfilled:
>
>The class is public and standalone (no non-static inner class)
>The class has a public no-argument constructor
>All non-static, non-transient fields in the class (and all superclasses) are either public (and non-final) or have a public getter- and a setter- method that follows the Java beans naming conventions for getters and setters.
>
>Note that when a user-defined data type can’t be recognized as a POJO type, it must be processed as GenericType and serialized with Kryo.
>
>
>
>| |
>邵红晓
>|
>|
>邮箱:17611022895@163.com
>|
>签名由网易邮箱大师定制
>在2020年4月30日 09:40,shx<17...@163.com> 写道:
>能发一下写入状态的代码看一下吗,还有一个问题,键值状态访问,你的代码里是读出了所有key关键的mapstate吗,谢谢
>
>
>
>
>| |
>邵红晓
>|
>|
>邮箱:17611022895@163.com
>|
>
>签名由 网易邮箱大师 定制
>
>在2020年04月30日 09:04,guanyq 写道:
>代码中没特别指定Serializer。都是默认的序列化。
>在 2020-04-29 18:20:22,"Congxian Qiu" <qc...@gmail.com> 写道:
>Hi
>从错误日志看,是 StateMigration 相关的问题。
>你需要确认下,你的代码中的 Serializer 和 savepoint 中 state 相关的 serializer
>是一样的或者是兼容的,你可以参考下这个文档[1]
>
>[1]
>https://ci.apache.org/projects/flink/flink-docs-release-1.10/dev/stream/state/schema_evolution.html
>
>Best,
>Congxian
>
>
>guanyq <dl...@163.com> 于2020年4月29日周三 下午6:09写道:
>
>
>附件是代码和错误日志。目前不知道如何调查。麻烦帮忙看下 谢谢。

回复:flink1.9,state process api 读取MapState,出错

Posted by "shao.hongxiao" <17...@163.com>.
是不是静态内部类的问题?
Rules for POJO types

Flink recognizes a data type as a POJO type (and allows “by-name” field referencing) if the following conditions are fulfilled:

The class is public and standalone (no non-static inner class)
The class has a public no-argument constructor
All non-static, non-transient fields in the class (and all superclasses) are either public (and non-final) or have a public getter- and a setter- method that follows the Java beans naming conventions for getters and setters.

Note that when a user-defined data type can’t be recognized as a POJO type, it must be processed as GenericType and serialized with Kryo.



| |
邵红晓
|
|
邮箱:17611022895@163.com
|
签名由网易邮箱大师定制
在2020年4月30日 09:40,shx<17...@163.com> 写道:
能发一下写入状态的代码看一下吗,还有一个问题,键值状态访问,你的代码里是读出了所有key关键的mapstate吗,谢谢




| |
邵红晓
|
|
邮箱:17611022895@163.com
|

签名由 网易邮箱大师 定制

在2020年04月30日 09:04,guanyq 写道:
代码中没特别指定Serializer。都是默认的序列化。
在 2020-04-29 18:20:22,"Congxian Qiu" <qc...@gmail.com> 写道:
Hi
从错误日志看,是 StateMigration 相关的问题。
你需要确认下,你的代码中的 Serializer 和 savepoint 中 state 相关的 serializer
是一样的或者是兼容的,你可以参考下这个文档[1]

[1]
https://ci.apache.org/projects/flink/flink-docs-release-1.10/dev/stream/state/schema_evolution.html

Best,
Congxian


guanyq <dl...@163.com> 于2020年4月29日周三 下午6:09写道:


附件是代码和错误日志。目前不知道如何调查。麻烦帮忙看下 谢谢。