[
https://issues.apache.org/jira/browse/SAMZA-104?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Chris Riccomini updated SAMZA-104:
----------------------------------
Attachment: SAMZA-104.0.patch
Attaching patch. RB available at:
https://reviews.apache.org/r/16159/
All tests pass.
1. Removed NPE from SerializedKeyValueStore.
2. Added NullSafeKeyValueStore.
3. Moved all metrics and toBytes/fromBytes in SerializedKeyValueStore into
shared methods.
4. Added more testing to KeyValueStores.
5. Updated KeyValueStoreFactory to compose all stores with a
NullSafeKeyValueStore.
I did (1) and (2) in order to make key-value behavior predictable whether cache
is used or not. Previously, in SAMZA-94, using the SerializedKeyValueStore with
the CacheStore yielded unpredictable behaviour (e.g. delete causes NPE when
cache is used). The NullSafeKeyValueStore also enforces the null rules
(documented in the KeyValueStore API) across all stores, not just the
serialized store.
The rule for (3) is now that the SerializedKeyValueStore will allow nulls for
both keys and values, but it will ALWAYS bypass the Serde when it receives a
null. That is, if an object or byte array is null, it'll never call
toBytes(null), or fromBytes(null); it'll always just use null directly as the
bytes or object. This conforms with "option 2" in SAMZA-94.
For (4), we are now testing cache and serde together, which we weren't before.
This is what exposed the bug.
> Delete doesn't work with cache and serde store
> ----------------------------------------------
>
> Key: SAMZA-104
> URL: https://issues.apache.org/jira/browse/SAMZA-104
> Project: Samza
> Issue Type: Bug
> Components: kv
> Affects Versions: 0.6.0
> Reporter: Chris Riccomini
> Assignee: Chris Riccomini
> Fix For: 0.7.0
>
> Attachments: SAMZA-104.0.patch
>
>
> A bug appears to have been introduced in SAMZA-94. The bug is that, when a
> CachedStore wraps a SerializedKeyValueStore, CachedStore.delete calls
> store.put(k, null), which triggers an NPE in the SerializedKeyValueStore.
--
This message was sent by Atlassian JIRA
(v6.1.4#6159)