Updated Branches:
  refs/heads/trunk 3b13457dd -> 2c250c660

corrupted saved caches
patch by Vijay; reviewed by jbellis for CASSANDRA-4622


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/2c250c66
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/2c250c66
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/2c250c66

Branch: refs/heads/trunk
Commit: 2c250c660f628d54ad57edd90d4c8ff5a4a407ee
Parents: 3b13457
Author: Vijay Parthasarathy <[email protected]>
Authored: Tue Sep 11 10:42:53 2012 -0700
Committer: Vijay Parthasarathy <[email protected]>
Committed: Tue Sep 11 10:56:13 2012 -0700

----------------------------------------------------------------------
 .../apache/cassandra/cache/AutoSavingCache.java    |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/2c250c66/src/java/org/apache/cassandra/cache/AutoSavingCache.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cache/AutoSavingCache.java 
b/src/java/org/apache/cassandra/cache/AutoSavingCache.java
index 7805340..14c379c 100644
--- a/src/java/org/apache/cassandra/cache/AutoSavingCache.java
+++ b/src/java/org/apache/cassandra/cache/AutoSavingCache.java
@@ -20,7 +20,6 @@ package org.apache.cassandra.cache;
 import java.io.*;
 import java.nio.ByteBuffer;
 import java.util.*;
-import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.Future;
 import java.util.concurrent.ScheduledFuture;
 import java.util.concurrent.TimeUnit;
@@ -142,16 +141,17 @@ public class AutoSavingCache<K extends CacheKey, V> 
extends InstrumentingCache<K
                 List<Future<Pair<K, V>>> futures = new 
ArrayList<Future<Pair<K, V>>>();
                 while (in.available() > 0)
                 {
-                    futures.add(cacheLoader.deserialize(in, cfs));
+                    Future<Pair<K, V>> entry = cacheLoader.deserialize(in, 
cfs);
+                    // Key cache entry can return null, if the SSTable doesn't 
exist.
+                    if (entry == null)
+                        continue;
+                    futures.add(entry);
                     count++;
                 }
 
                 for (Future<Pair<K, V>> future : futures)
                 {
                     Pair<K, V> entry = future.get();
-                    // Key cache entry can return null, if the SSTable doesn't 
exist.
-                    if (entry == null)
-                        continue;
                     put(entry.left, entry.right);
                 }
             }

Reply via email to