Hi Pengfei Li:

        I have not encountered this in production yet, I just check the code 
and found this is not the same with no userkey suppilied.

I checked the MapSerializer and found the serialized format for each Map.entry 
is  [key – isValueNull(boolean) – value].  And When boolean is serialized, byte 
1 is for true and byte 0 is for false. If we change the serialized format to 
[key-flag(byte)-value] , That is we do not view the byte as Boolean, just pure 
byte, I think we can migrate the key too:

      Flag == 0, value is null.
      Flag == 1, the key is in old format.
      Flag == 2, we can use this to write new key.

从 Windows 版邮件发送

发件人: Pengfei Li
发送时间: 2021年11月25日 18:17
收件人: dev@flink.apache.org
主题: Re: RocksDBMapState get the binary key bytes

This problem is tracked in FLINK-11141
<https://issues.apache.org/jira/browse/FLINK-11141>, but there is not a
solution yet considering the state compatibility. Have you encountered the
problem in production?

Zen4YYDS <gafam...@163.com> 于2021年11月25日周四 下午3:30写道:

> Hi devs:
>
>      Using RocksDB, when key and namespace both have variable binary
> length, to prevent [key, namespace] have equal binary number, we add key
> length and namespace length after key and namespace respectively. Then the
> format is:
>     Keygroup – key -keyLength– namespace-namespaceLenth
>
>      Then what about we use a fixed length key and variable length
> namespace and userkey. In current implement, I found the binary key format
> is as below:
>
>        Keygroup – key – namespace- userkey
>
> Think about following situation, I think we may get the same value for
> different [namespace, userkey]. or I get something wrong?
>
> Keygroup      key   namespace      userkey
>     1                 1          11                  1
> 1              1         1                11
>
>
> 从 Windows 版邮件发送
>
>


Reply via email to