Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Status

Current state:  "Under Discussion" Discarded (covered via KIP-258)

Discussion thread: TBD here

JIRAKAFKA-4304

Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).

...

Currently, when querying state store, it is not clear when the key was updated last. The ides of this JIRA is to make the latest update timestamp for each key-value-pair of the state store accessible.

For example, this might be useful to

  • check if a value was update but did not changed (just compare the update TS)
  • if you want to consider only recently updated keys

Public Interfaces

 

  • ReadOnlyKeyValueStore

    ReadOnlyKeyValueStoreWithKeyContext

Code Block
languagejava
longpublic getKeyTs(K key);
 
KeyContext<Kinterface ReadOnlyKeyValueStoreWithKeyContext<K, V> get(K key);  // we add this interface for use-cases where user will query for key and query for key timestamp again. To avoid double querying we overload get() methodextends ReadOnlyKeyValueStore<K, V> {
   KeyContext<K, V> getWithKeyContext(K key);
   KeyValueIterator<KeyContext<K, V>, V> rangeWithKeyContext(K from, K to);
   KeyValueIterator<KeyContext<K, V>, V> allWithKeyContext();
} 

Proposed Changes

We propose add a new interface KeyContext which will keep info about key. We can include more methods inside this context as well.

Code Block
languagejava
public interface KeyContext<K, V> {  // more key/value context can be added here as well.
   K key();
   V value();
   long keyTslastUpdated();
}

Compatibility, Deprecation, and Migration Plan

...