ASF GitHub Bot commented on KAFKA-5717:

GitHub user dguy opened a pull request:


    KAFKA-5717: InMemoryKeyValueStore should delete keys with null values 
during restore

    Fixed a bug in the InMemoryKeyValueStore restoration where a key with a 
`null` value is written in to the map rather than being deleted.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/dguy/kafka kafka-5717

Alternatively you can review and apply these changes as the patch at:


To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #3650


> [streams] 'null' values in state stores
> ---------------------------------------
>                 Key: KAFKA-5717
>                 URL: https://issues.apache.org/jira/browse/KAFKA-5717
>             Project: Kafka
>          Issue Type: Bug
>          Components: streams
>    Affects Versions:,
>            Reporter: Bart Vercammen
>            Assignee: Damian Guy
> When restoring the state on an in-memory KeyValue store (at startup of the 
> Kafka Streams application), the _deleted_ values are put in the store as 
> _key_ with _value_ {{null}} instead of being removed from the store.
> (this happens when the underlying kafka topic segment did not get compacted 
> yet)
> After some digging I came across this in {{InMemoryKeyValueStore<K, V>}}:
> {code}
> public synchronized void put(K key, V value) {
>         this.map.put(key, value);
>     }
> {code}
> I would assume this implementation misses the check on {{value}} being 
> {{null}} to *delete* the entry instead of just storing it.
> In the RocksDB implementation it is done correctly:
> {code}
> if (rawValue == null) {
>             try {
>                 db.delete(wOptions, rawKey);
> {code}

This message was sent by Atlassian JIRA

Reply via email to