Merge branch 'cassandra-0.8' into cassandra-1.0

Conflicts:
        src/java/org/apache/cassandra/db/filter/QueryFilter.java


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

Branch: refs/heads/cassandra-1.0
Commit: 6cb4af7c66a0a034202449362968c5274619b634
Parents: 2216a3d ad80cf4
Author: Sylvain Lebresne <sylv...@datastax.com>
Authored: Wed Feb 8 15:21:17 2012 +0100
Committer: Sylvain Lebresne <sylv...@datastax.com>
Committed: Wed Feb 8 15:21:17 2012 +0100

----------------------------------------------------------------------
 CHANGES.txt                                        |    1 +
 src/java/org/apache/cassandra/db/Column.java       |    5 ++
 .../org/apache/cassandra/db/ColumnFamilyStore.java |    2 +-
 src/java/org/apache/cassandra/db/IColumn.java      |    1 +
 src/java/org/apache/cassandra/db/SuperColumn.java  |    7 +++-
 .../apache/cassandra/db/filter/QueryFilter.java    |    2 +-
 .../apache/cassandra/db/RemoveSubColumnTest.java   |   34 +++++++++++++++
 7 files changed, 49 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/6cb4af7c/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index a8b87f1,dc17889..4be81fc
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -64,40 -5,9 +64,41 @@@ Merged from 0.8
   * use correct list of replicas for LOCAL_QUORUM reads when read repair
     is disabled (CASSANDRA-3696)
   * block on flush before compacting hints (may prevent OOM) (CASSANDRA-3733)
 +
 +
 +1.0.6
 + * (CQL) fix cqlsh support for replicate_on_write (CASSANDRA-3596)
 + * fix adding to leveled manifest after streaming (CASSANDRA-3536)
 + * filter out unavailable cipher suites when using encryption (CASSANDRA-3178)
 + * (HADOOP) add old-style api support for CFIF and CFRR (CASSANDRA-2799)
 + * Support TimeUUIDType column names in Stress.java tool (CASSANDRA-3541)
 + * (CQL) INSERT/UPDATE/DELETE/TRUNCATE commands should allow CF names to
 +   be qualified by keyspace (CASSANDRA-3419)
 + * always remove endpoints from delevery queue in HH (CASSANDRA-3546)
 + * fix race between cf flush and its 2ndary indexes flush (CASSANDRA-3547)
 + * fix potential race in AES when a repair fails (CASSANDRA-3548)
 + * fix default value validation usage in CLI SET command (CASSANDRA-3553)
 + * Optimize componentsFor method for compaction and startup time
 +   (CASSANDRA-3532)
 + * (CQL) Proper ColumnFamily metadata validation on CREATE COLUMNFAMILY 
 +   (CASSANDRA-3565)
 + * fix compression "chunk_length_kb" option to set correct kb value for 
 +   thrift/avro (CASSANDRA-3558)
 + * fix missing response during range slice repair (CASSANDRA-3551)
 + * 'describe ring' moved from CLI to nodetool and available through JMX 
(CASSANDRA-3220)
 + * add back partitioner to sstable metadata (CASSANDRA-3540)
 + * fix NPE in get_count for counters (CASSANDRA-3601)
 +Merged from 0.8:
 +||||||| merged common ancestors
 +
 +
 +0.8.9
 + * avoid logging (harmless) exception when GC takes < 1ms (CASSANDRA-3656)
 +=======
 + * block on flush before compacting hints (may prevent OOM) (CASSANDRA-3733)
   * (Pig) fix CassandraStorage to use correct comparator in Super ColumnFamily
     case (CASSANDRA-3251)
+  * Fix relevant tomstone ignored with super columns (CASSANDRA-3875)
  
  0.8.9
   * avoid logging (harmless) exception when GC takes < 1ms (CASSANDRA-3656)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6cb4af7c/src/java/org/apache/cassandra/db/Column.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6cb4af7c/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6cb4af7c/src/java/org/apache/cassandra/db/IColumn.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6cb4af7c/src/java/org/apache/cassandra/db/SuperColumn.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/SuperColumn.java
index 4301f73,4cd9ebe..75f166c
--- a/src/java/org/apache/cassandra/db/SuperColumn.java
+++ b/src/java/org/apache/cassandra/db/SuperColumn.java
@@@ -140,10 -159,15 +140,15 @@@ public class SuperColumn extends Abstra
  
      public long mostRecentLiveChangeAt()
      {
+         return mostRecentNonGCableChangeAt(Integer.MAX_VALUE);
+     }
+ 
+     public long mostRecentNonGCableChangeAt(int gcbefore)
+     {
          long max = Long.MIN_VALUE;
 -        for (IColumn column : columns_.values())
 +        for (IColumn column : getSubColumns())
          {
-             if (!column.isMarkedForDelete() && column.timestamp() > max)
 -            if ((!column.isMarkedForDelete() || column.getLocalDeletionTime() 
> gcbefore) && column.timestamp() > max)
++            if ((!column.isMarkedForDelete() || column.getLocalDeletionTime() 
>= gcbefore) && column.timestamp() > max)
              {
                  max = column.timestamp();
              }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6cb4af7c/src/java/org/apache/cassandra/db/filter/QueryFilter.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/filter/QueryFilter.java
index 3405c46,2e911b6..a2e9a95
--- a/src/java/org/apache/cassandra/db/filter/QueryFilter.java
+++ b/src/java/org/apache/cassandra/db/filter/QueryFilter.java
@@@ -154,8 -152,8 +154,8 @@@ public class QueryFilte
          // the column itself must be not gc-able (it is live, or a still 
relevant tombstone, or has live subcolumns), (1)
          // and if its container is deleted, the column must be changed more 
recently than the container tombstone (2)
          // (since otherwise, the only thing repair cares about is the 
container tombstone)
-         long maxChange = column.mostRecentLiveChangeAt();
+         long maxChange = column.mostRecentNonGCableChangeAt(gcBefore);
 -        return (!column.isMarkedForDelete() || column.getLocalDeletionTime() 
> gcBefore || maxChange > column.getMarkedForDeleteAt()) // (1)
 +        return (!column.isMarkedForDelete() || column.getLocalDeletionTime() 
>= gcBefore || maxChange > column.getMarkedForDeleteAt()) // (1)
                 && (!container.isMarkedForDelete() || maxChange > 
container.getMarkedForDeleteAt()); // (2)
      }
  

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6cb4af7c/test/unit/org/apache/cassandra/db/RemoveSubColumnTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/db/RemoveSubColumnTest.java
index 7abcc59,d1e54ba..28e4aef
--- a/test/unit/org/apache/cassandra/db/RemoveSubColumnTest.java
+++ b/test/unit/org/apache/cassandra/db/RemoveSubColumnTest.java
@@@ -55,7 -55,41 +55,41 @@@ public class RemoveSubColumnTest extend
          rm.apply();
  
          ColumnFamily retrieved = 
store.getColumnFamily(QueryFilter.getIdentityFilter(dk, new QueryPath("Super1", 
ByteBufferUtil.bytes("SC1"))));
 -        assert 
retrieved.getColumn(ByteBufferUtil.bytes("SC1")).getSubColumn(getBytes(1)).isMarkedForDelete();
 +        assert 
retrieved.getColumn(ByteBufferUtil.bytes("SC1")).getSubColumn(getBytes(1L)).isMarkedForDelete();
          assertNull(Util.cloneAndRemoveDeleted(retrieved, Integer.MAX_VALUE));
      }
+ 
+     @Test
+     public void testRemoveSubColumnAndContainer() throws IOException, 
ExecutionException, InterruptedException
+     {
+         Table table = Table.open("Keyspace1");
+         ColumnFamilyStore store = table.getColumnFamilyStore("Super1");
+         RowMutation rm;
+         DecoratedKey dk = Util.dk("key2");
+ 
+         // add data
+         rm = new RowMutation("Keyspace1", dk.key);
+         Util.addMutation(rm, "Super1", "SC1", 1, "asdf", 0);
+         rm.apply();
+         store.forceBlockingFlush();
+ 
+         // remove the SC
+         rm = new RowMutation("Keyspace1", dk.key);
+         rm.delete(new QueryPath("Super1", ByteBufferUtil.bytes("SC1"), null), 
1);
+         rm.apply();
+ 
+         // Mark current time and make sure the next insert happens at least
+         // one second after the previous one (since gc resolution is the 
second)
+         int gcbefore = (int)(System.currentTimeMillis() / 1000);
+         Thread.currentThread().sleep(1000);
+ 
+         // remove the column itself
+         rm = new RowMutation("Keyspace1", dk.key);
+         rm.delete(new QueryPath("Super1", ByteBufferUtil.bytes("SC1"), 
getBytes(1)), 2);
+         rm.apply();
+ 
+         ColumnFamily retrieved = 
store.getColumnFamily(QueryFilter.getIdentityFilter(dk, new QueryPath("Super1", 
ByteBufferUtil.bytes("SC1"))), gcbefore);
+         assert 
retrieved.getColumn(ByteBufferUtil.bytes("SC1")).getSubColumn(getBytes(1)).isMarkedForDelete();
+         assertNull(Util.cloneAndRemoveDeleted(retrieved, Integer.MAX_VALUE));
+     }
  }

Reply via email to