[
https://issues.apache.org/jira/browse/SAMZA-94?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13843435#comment-13843435
]
Chris Riccomini commented on SAMZA-94:
--------------------------------------
RB updated.
Changes:
1. Followed option (2) in my list above. The SerializedKeyValueStore now
bypasses the serde for null keys and values.
2. Prohibit all usage of null for key and value in put methods, and all usage
of null for key in get methods.
3. Put expect method into TestUtil class in samza-test.
4. Added return time to bytesNotNull.
5. Added javadocs to KeyValueStore to warn about null pointer exceptions.
6. Updated expected method per-Jay's feedback on the RB.
7. Removed testSerializedValueIsNull since it's no longer valid.
Regarding (2), I chose to warn, not fail when range() is called, and null is
returned for the key. I thought this might be valid in cases where the store is
lossy, and can't recover the key for a given entry, and so it returns null. Up
for debate, I suppose.
Regarding (3), I chose to put the TestUtil in main, not test, because depending
on test JARs is not pleasant
(http://stackoverflow.com/questions/5644011/multi-project-test-dependencies-with-gradle).
I chose not to put TestUtil in samza-core because I didn't want a test class
in the main core package (pulling in the junit dependencies).
Regarding (6), I opted not to use the JUnit method that Jakob proposes since it
can't do message checking.
> State management kv-store delete() does not remove key
> ------------------------------------------------------
>
> Key: SAMZA-94
> URL: https://issues.apache.org/jira/browse/SAMZA-94
> Project: Samza
> Issue Type: Bug
> Components: kv
> Affects Versions: 0.6.0
> Reporter: Alan Li
> Assignee: Chris Riccomini
> Fix For: 0.7.0
>
> Attachments: SAMZA-94.0.patch, SAMZA-94.1.patch
>
>
> Sample code snippet:
> {noformat}
> _realtimeStateStore.put("foo", new HashMap());
>
> KeyValueIterator<String, Map<String, State>> realtimeIterator =
> _realtimeStateStore.all();
> while (realtimeIterator.hasNext())
> {
> Entry<String, Map<String, State>> entry = realtimeIterator.next();
> System.out.println("read from leveldb: " + entry.getKey() + "=>" +
> entry.getValue());
> }
> realtimeIterator.close();
>
> _realtimeStateStore.delete("foo");
>
> KeyValueIterator<String, Map<String, State>> iter =
> _realtimeStateStore.all();
> while (iter.hasNext())
> {
> Entry<String, Map<String, State>> entry = iter.next();
> System.out.println("read from leveldb: " + entry.getKey() + "=>" +
> entry.getValue());
> }
> iter.close();
> {noformat}
> Output:
> read from leveldb: foo=>{}
> read from leveldb: foo=>null
> I would expect that the kv would remove both the key & value on delete so
> that subsequent iterators will not return keys that have been deleted.
--
This message was sent by Atlassian JIRA
(v6.1.4#6159)