You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@samza.apache.org by cr...@apache.org on 2013/08/28 19:21:50 UTC

[1/4] git commit: don't use remove() on head in cachedstore's double linked list because of https://issues.scala-lang.org/browse/SI-3970

Updated Branches:
  refs/heads/master 251b42dea -> 71f030ee4


don't use remove() on head in cachedstore's double linked list because of https://issues.scala-lang.org/browse/SI-3970


Project: http://git-wip-us.apache.org/repos/asf/incubator-samza/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-samza/commit/f59be906
Tree: http://git-wip-us.apache.org/repos/asf/incubator-samza/tree/f59be906
Diff: http://git-wip-us.apache.org/repos/asf/incubator-samza/diff/f59be906

Branch: refs/heads/master
Commit: f59be90682fbc99adb0bef220a5e919d876d5ead
Parents: ff6073d
Author: Chris Riccomini <cr...@criccomi-mn.linkedin.biz>
Authored: Tue Aug 27 15:47:17 2013 -0700
Committer: Chris Riccomini <cr...@criccomi-mn.linkedin.biz>
Committed: Tue Aug 27 15:47:17 2013 -0700

----------------------------------------------------------------------
 .../scala/org/apache/samza/storage/kv/CachedStore.scala  | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-samza/blob/f59be906/samza-kv/src/main/scala/org/apache/samza/storage/kv/CachedStore.scala
----------------------------------------------------------------------
diff --git a/samza-kv/src/main/scala/org/apache/samza/storage/kv/CachedStore.scala b/samza-kv/src/main/scala/org/apache/samza/storage/kv/CachedStore.scala
index 0eed8fa..8938b89 100644
--- a/samza-kv/src/main/scala/org/apache/samza/storage/kv/CachedStore.scala
+++ b/samza-kv/src/main/scala/org/apache/samza/storage/kv/CachedStore.scala
@@ -92,8 +92,15 @@ class CachedStore[K, V](val store: KeyValueStore[K, V],
     val found = cache.get(key)
     if (found == null || found.dirty == null)
       this.dirtyCount += 1
-    else
-      found.dirty.remove()
+    else {
+      // If we are removing the head of the list, move the head to the next element.
+      if(found.dirty.prev == null) {
+        this.dirty = found.dirty.next
+        this.dirty.prev = null
+      } else {
+        found.dirty.remove
+      }
+    }
     this.dirty = new mutable.DoubleLinkedList(key, this.dirty)
 
     // add the key to the cache (but don't allocate a new cache entry if we already have one)


[3/4] git commit: Merge branch 'SAMZA-45_NPE-in-linked-list-in-samza-kv-cachedstore'

Posted by cr...@apache.org.
Merge branch 'SAMZA-45_NPE-in-linked-list-in-samza-kv-cachedstore'


Project: http://git-wip-us.apache.org/repos/asf/incubator-samza/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-samza/commit/c688d86f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-samza/tree/c688d86f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-samza/diff/c688d86f

Branch: refs/heads/master
Commit: c688d86ffe52b9a1d187e992657eb054b847a6e0
Parents: 251b42d c587a35
Author: Chris Riccomini <cr...@criccomi-mn.linkedin.biz>
Authored: Wed Aug 28 10:18:56 2013 -0700
Committer: Chris Riccomini <cr...@criccomi-mn.linkedin.biz>
Committed: Wed Aug 28 10:18:56 2013 -0700

----------------------------------------------------------------------
 .../org/apache/samza/storage/kv/CachedStore.scala      | 13 ++++++++++---
 .../apache/samza/storage/kv/TestKeyValueStores.scala   |  3 ++-
 2 files changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------



[4/4] git commit: add mention of SAMZA-45 in cached store comments.

Posted by cr...@apache.org.
add mention of SAMZA-45 in cached store comments.


Project: http://git-wip-us.apache.org/repos/asf/incubator-samza/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-samza/commit/71f030ee
Tree: http://git-wip-us.apache.org/repos/asf/incubator-samza/tree/71f030ee
Diff: http://git-wip-us.apache.org/repos/asf/incubator-samza/diff/71f030ee

Branch: refs/heads/master
Commit: 71f030ee4ae74a30ffa7a933b24ea25eab54486d
Parents: c688d86
Author: Chris Riccomini <cr...@criccomi-mn.linkedin.biz>
Authored: Wed Aug 28 10:21:48 2013 -0700
Committer: Chris Riccomini <cr...@criccomi-mn.linkedin.biz>
Committed: Wed Aug 28 10:21:48 2013 -0700

----------------------------------------------------------------------
 .../src/main/scala/org/apache/samza/storage/kv/CachedStore.scala  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-samza/blob/71f030ee/samza-kv/src/main/scala/org/apache/samza/storage/kv/CachedStore.scala
----------------------------------------------------------------------
diff --git a/samza-kv/src/main/scala/org/apache/samza/storage/kv/CachedStore.scala b/samza-kv/src/main/scala/org/apache/samza/storage/kv/CachedStore.scala
index 81e33b8..bd479b6 100644
--- a/samza-kv/src/main/scala/org/apache/samza/storage/kv/CachedStore.scala
+++ b/samza-kv/src/main/scala/org/apache/samza/storage/kv/CachedStore.scala
@@ -93,7 +93,8 @@ class CachedStore[K, V](val store: KeyValueStore[K, V],
     if (found == null || found.dirty == null) {
       this.dirtyCount += 1
     } else {
-      // If we are removing the head of the list, move the head to the next element.
+      // If we are removing the head of the list, move the head to the next 
+      // element. See SAMZA-45 for details.
       if(found.dirty.prev == null) {
         this.dirty = found.dirty.next
         this.dirty.prev = null


[2/4] git commit: tweak kv test to trigger NPE when test is run with Scala 2.8.1. Validate that patch fixes the bug. Add brackets in if else in cached store for style.

Posted by cr...@apache.org.
tweak kv test to trigger NPE when test is run with Scala 2.8.1. Validate that patch fixes the bug. Add brackets in if else in cached store for style.


Project: http://git-wip-us.apache.org/repos/asf/incubator-samza/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-samza/commit/c587a351
Tree: http://git-wip-us.apache.org/repos/asf/incubator-samza/tree/c587a351
Diff: http://git-wip-us.apache.org/repos/asf/incubator-samza/diff/c587a351

Branch: refs/heads/master
Commit: c587a3513947c4c8c31176a99debff16cc436b18
Parents: f59be90
Author: Chris Riccomini <cr...@criccomi-mn.linkedin.biz>
Authored: Wed Aug 28 10:14:03 2013 -0700
Committer: Chris Riccomini <cr...@criccomi-mn.linkedin.biz>
Committed: Wed Aug 28 10:14:03 2013 -0700

----------------------------------------------------------------------
 .../src/main/scala/org/apache/samza/storage/kv/CachedStore.scala | 4 ++--
 .../scala/org/apache/samza/storage/kv/TestKeyValueStores.scala   | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-samza/blob/c587a351/samza-kv/src/main/scala/org/apache/samza/storage/kv/CachedStore.scala
----------------------------------------------------------------------
diff --git a/samza-kv/src/main/scala/org/apache/samza/storage/kv/CachedStore.scala b/samza-kv/src/main/scala/org/apache/samza/storage/kv/CachedStore.scala
index 8938b89..81e33b8 100644
--- a/samza-kv/src/main/scala/org/apache/samza/storage/kv/CachedStore.scala
+++ b/samza-kv/src/main/scala/org/apache/samza/storage/kv/CachedStore.scala
@@ -90,9 +90,9 @@ class CachedStore[K, V](val store: KeyValueStore[K, V],
   def put(key: K, value: V) {
     // add the key to the front of the dirty list (and remove any prior occurrences to dedupe)
     val found = cache.get(key)
-    if (found == null || found.dirty == null)
+    if (found == null || found.dirty == null) {
       this.dirtyCount += 1
-    else {
+    } else {
       // If we are removing the head of the list, move the head to the next element.
       if(found.dirty.prev == null) {
         this.dirty = found.dirty.next

http://git-wip-us.apache.org/repos/asf/incubator-samza/blob/c587a351/samza-kv/src/test/scala/org/apache/samza/storage/kv/TestKeyValueStores.scala
----------------------------------------------------------------------
diff --git a/samza-kv/src/test/scala/org/apache/samza/storage/kv/TestKeyValueStores.scala b/samza-kv/src/test/scala/org/apache/samza/storage/kv/TestKeyValueStores.scala
index 5f9d66c..0be0722 100644
--- a/samza-kv/src/test/scala/org/apache/samza/storage/kv/TestKeyValueStores.scala
+++ b/samza-kv/src/test/scala/org/apache/samza/storage/kv/TestKeyValueStores.scala
@@ -79,7 +79,8 @@ class TestKeyValueStores(cache: Boolean) {
     val k = b("k2")
     store.put(k, b("v1"))
     store.put(k, b("v2"))
-    assertTrue(Arrays.equals(b("v2"), store.get(k)))
+    store.put(k, b("v3"))
+    assertTrue(Arrays.equals(b("v3"), store.get(k)))
   }
 
   @Test