Merge branch 'cassandra-1.2' into cassandra-2.0

Conflicts:
        CHANGES.txt


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

Branch: refs/heads/cassandra-2.1
Commit: 871a6030bc6ed475e652e67a8631338010c607dc
Parents: b9bb2c8 72203c5
Author: Aleksey Yeschenko <alek...@apache.org>
Authored: Fri Apr 25 03:19:17 2014 +0300
Committer: Aleksey Yeschenko <alek...@apache.org>
Committed: Fri Apr 25 03:19:17 2014 +0300

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 +
 .../cassandra/cache/RefCountedMemory.java       |  7 ++-
 .../cassandra/cache/SerializingCache.java       | 53 +++++++++++++++-----
 3 files changed, 49 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/871a6030/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 0b6aeaa,b3470bf..73c5034
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -12,61 -10,11 +12,63 @@@ Merged from 1.2
   * Fix CQLSH parsing of functions and BLOB literals (CASSANDRA-7018)
   * Require nodetool rebuild_index to specify index names (CASSANDRA-7038)
   * Ensure that batchlog and hint timeouts do not produce hints 
(CASSANDRA-7058)
 - * Don't shut MessagingService down when replacing a node (CASSANDRA-6476)
+  * Always clean up references in SerializingCache (CASSANDRA-6994)
++ * Don't shut MessagingService down when replacing a node (CASSANDRA-6476)
  
  
 -1.2.16
 +2.0.7
 + * Put nodes in hibernate when join_ring is false (CASSANDRA-6961)
 + * Avoid early loading of non-system keyspaces before compaction-leftovers 
 +   cleanup at startup (CASSANDRA-6913)
 + * Restrict Windows to parallel repairs (CASSANDRA-6907)
 + * (Hadoop) Allow manually specifying start/end tokens in CFIF 
(CASSANDRA-6436)
 + * Fix NPE in MeteredFlusher (CASSANDRA-6820)
 + * Fix race processing range scan responses (CASSANDRA-6820)
 + * Allow deleting snapshots from dropped keyspaces (CASSANDRA-6821)
 + * Add uuid() function (CASSANDRA-6473)
 + * Omit tombstones from schema digests (CASSANDRA-6862)
 + * Include correct consistencyLevel in LWT timeout (CASSANDRA-6884)
 + * Lower chances for losing new SSTables during nodetool refresh and
 +   ColumnFamilyStore.loadNewSSTables (CASSANDRA-6514)
 + * Add support for DELETE ... IF EXISTS to CQL3 (CASSANDRA-5708)
 + * Update hadoop_cql3_word_count example (CASSANDRA-6793)
 + * Fix handling of RejectedExecution in sync Thrift server (CASSANDRA-6788)
 + * Log more information when exceeding tombstone_warn_threshold 
(CASSANDRA-6865)
 + * Fix truncate to not abort due to unreachable fat clients (CASSANDRA-6864)
 + * Fix schema concurrency exceptions (CASSANDRA-6841)
 + * Fix leaking validator FH in StreamWriter (CASSANDRA-6832)
 + * Fix saving triggers to schema (CASSANDRA-6789)
 + * Fix trigger mutations when base mutation list is immutable (CASSANDRA-6790)
 + * Fix accounting in FileCacheService to allow re-using RAR (CASSANDRA-6838)
 + * Fix static counter columns (CASSANDRA-6827)
 + * Restore expiring->deleted (cell) compaction optimization (CASSANDRA-6844)
 + * Fix CompactionManager.needsCleanup (CASSANDRA-6845)
 + * Correctly compare BooleanType values other than 0 and 1 (CASSANDRA-6779)
 + * Read message id as string from earlier versions (CASSANDRA-6840)
 + * Properly use the Paxos consistency for (non-protocol) batch 
(CASSANDRA-6837)
 + * Add paranoid disk failure option (CASSANDRA-6646)
 + * Improve PerRowSecondaryIndex performance (CASSANDRA-6876)
 + * Extend triggers to support CAS updates (CASSANDRA-6882)
 + * Static columns with IF NOT EXISTS don't always work as expected 
(CASSANDRA-6873)
 + * Fix paging with SELECT DISTINCT (CASSANDRA-6857)
 + * Fix UnsupportedOperationException on CAS timeout (CASSANDRA-6923)
 + * Improve MeteredFlusher handling of MF-unaffected column families
 +   (CASSANDRA-6867)
 + * Add CqlRecordReader using native pagination (CASSANDRA-6311)
 + * Add QueryHandler interface (CASSANDRA-6659)
 + * Track liveRatio per-memtable, not per-CF (CASSANDRA-6945)
 + * Make sure upgradesstables keeps sstable level (CASSANDRA-6958)
 + * Fix LIMIT with static columns (CASSANDRA-6956)
 + * Fix clash with CQL column name in thrift validation (CASSANDRA-6892)
 + * Fix error with super columns in mixed 1.2-2.0 clusters (CASSANDRA-6966)
 + * Fix bad skip of sstables on slice query with composite start/finish 
(CASSANDRA-6825)
 + * Fix unintended update with conditional statement (CASSANDRA-6893)
 + * Fix map element access in IF (CASSANDRA-6914)
 + * Avoid costly range calculations for range queries on system keyspaces
 +   (CASSANDRA-6906)
 + * Fix SSTable not released if stream session fails (CASSANDRA-6818)
 + * Avoid build failure due to ANTLR timeout (CASSANDRA-6991)
 +Merged from 1.2:
   * Add UNLOGGED, COUNTER options to BATCH documentation (CASSANDRA-6816)
   * add extra SSL cipher suites (CASSANDRA-6613)
   * fix nodetool getsstables for blob PK (CASSANDRA-6803)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/871a6030/src/java/org/apache/cassandra/cache/RefCountedMemory.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/cache/RefCountedMemory.java
index 887bd86,887bd86..43c87b9
--- a/src/java/org/apache/cassandra/cache/RefCountedMemory.java
+++ b/src/java/org/apache/cassandra/cache/RefCountedMemory.java
@@@ -21,7 -21,7 +21,7 @@@ import java.util.concurrent.atomic.Atom
  
  import org.apache.cassandra.io.util.Memory;
  
--public class RefCountedMemory extends Memory
++public class RefCountedMemory extends Memory implements AutoCloseable
  {
      private final AtomicInteger references = new AtomicInteger(1);
  
@@@ -52,4 -52,4 +52,9 @@@
          if (references.decrementAndGet() == 0)
              free();
      }
++
++    public void close()
++    {
++        unreference();
++    }
  }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/871a6030/src/java/org/apache/cassandra/cache/SerializingCache.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/cache/SerializingCache.java
index 2210f10,58da56b..ca65fcc
--- a/src/java/org/apache/cassandra/cache/SerializingCache.java
+++ b/src/java/org/apache/cassandra/cache/SerializingCache.java
@@@ -68,7 -69,7 +68,7 @@@ public class SerializingCache<K, V> imp
  
      public static <K, V> SerializingCache<K, V> create(long weightedCapacity, 
Weigher<RefCountedMemory> weigher, ISerializer<V> serializer)
      {
--        return new SerializingCache<K, V>(weightedCapacity, weigher, 
serializer);
++        return new SerializingCache<>(weightedCapacity, weigher, serializer);
      }
  
      public static <K, V> SerializingCache<K, V> create(long weightedCapacity, 
ISerializer<V> serializer)
@@@ -177,7 -179,17 +178,17 @@@
          if (mem == null)
              return; // out of memory.  never mind.
  
-         RefCountedMemory old = map.put(key, mem);
+         RefCountedMemory old;
+         try
+         {
+             old = map.put(key, mem);
+         }
+         catch (Throwable t)
+         {
+             mem.unreference();
 -            throw Throwables.propagate(t);
++            throw t;
+         }
+ 
          if (old != null)
              old.unreference();
      }
@@@ -188,7 -200,17 +199,17 @@@
          if (mem == null)
              return false; // out of memory.  never mind.
  
-         RefCountedMemory old = map.putIfAbsent(key, mem);
+         RefCountedMemory old;
+         try
+         {
+             old = map.putIfAbsent(key, mem);
+         }
+         catch (Throwable t)
+         {
+             mem.unreference();
 -            throw Throwables.propagate(t);
++            throw t;
+         }
+ 
          if (old != null)
              // the new value was not put, we've uselessly allocated some 
memory, free it
              mem.unreference();
@@@ -207,19 -240,16 +239,16 @@@
          if (mem == null)
              return false; // out of memory.  never mind.
  
-         V oldValue;
-         // reference old guy before de-serializing
-         if (!old.reference())
-             return false; // we have already freed hence noop.
+         boolean success;
          try
          {
-              oldValue = deserialize(old);
+             success = map.replace(key, old, mem);
          }
-         finally
+         catch (Throwable t)
          {
-             old.unreference();
+             mem.unreference();
 -            throw Throwables.propagate(t);
++            throw t;
          }
-         boolean success = oldValue.equals(oldToReplace) && map.replace(key, 
old, mem);
  
          if (success)
              old.unreference(); // so it will be eventually be cleaned

Reply via email to