Updated Branches:
  refs/heads/cassandra-1.0 2b7672fa1 -> 48a22695f
  refs/heads/cassandra-1.1 263f192b6 -> 9efe99d92
  refs/heads/trunk fb89e2be1 -> 4b9a80231


additional trunk-only 4116 fixes


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

Branch: refs/heads/trunk
Commit: 4b9a802315ed735e9c408424f01825e50c03c1b1
Parents: 744acdf
Author: Jonathan Ellis <[email protected]>
Authored: Wed May 2 10:00:01 2012 -0500
Committer: Jonathan Ellis <[email protected]>
Committed: Wed May 2 10:00:01 2012 -0500

----------------------------------------------------------------------
 src/java/org/apache/cassandra/db/ColumnFamily.java |    2 +-
 .../org/apache/cassandra/db/ColumnFamilyTest.java  |   13 ++++
 .../cassandra/io/sstable/SSTableWriterTest.java    |   56 ---------------
 3 files changed, 14 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/4b9a8023/src/java/org/apache/cassandra/db/ColumnFamily.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/ColumnFamily.java 
b/src/java/org/apache/cassandra/db/ColumnFamily.java
index b221622..e9fedb4 100644
--- a/src/java/org/apache/cassandra/db/ColumnFamily.java
+++ b/src/java/org/apache/cassandra/db/ColumnFamily.java
@@ -367,7 +367,7 @@ public class ColumnFamily extends AbstractColumnContainer 
implements IRowCacheEn
 
     public ColumnStats getColumnStats()
     {
-        long maxTimestampSeen = Long.MIN_VALUE;
+        long maxTimestampSeen = getMarkedForDeleteAt();
         StreamingHistogram tombstones = new 
StreamingHistogram(SSTable.TOMBSTONE_HISTOGRAM_BIN_SIZE);
 
         for (IColumn column : columns)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/4b9a8023/test/unit/org/apache/cassandra/db/ColumnFamilyTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/ColumnFamilyTest.java 
b/test/unit/org/apache/cassandra/db/ColumnFamilyTest.java
index 18619a1..b1c80bb 100644
--- a/test/unit/org/apache/cassandra/db/ColumnFamilyTest.java
+++ b/test/unit/org/apache/cassandra/db/ColumnFamilyTest.java
@@ -27,6 +27,7 @@ import java.util.*;
 import org.apache.cassandra.SchemaLoader;
 import org.junit.Test;
 
+import org.apache.cassandra.io.sstable.ColumnStats;
 import org.apache.cassandra.io.util.DataOutputBuffer;
 import org.apache.cassandra.db.filter.QueryPath;
 import static org.apache.cassandra.Util.column;
@@ -178,4 +179,16 @@ public class ColumnFamilyTest extends SchemaLoader
         // array-sorted does allow conflict resolution IF it is the last 
column.  Bit of an edge case.
         testSuperColumnResolution(ArrayBackedSortedColumns.factory());
     }
+    
+    @Test
+    public void testColumnStatsRecordsRowDeletesCorrectly() throws IOException
+    {
+        long timestamp = System.currentTimeMillis();
+        int localDeletionTime = (int) (System.currentTimeMillis() / 1000);
+        
+        ColumnFamily cf = ColumnFamily.create("Keyspace1", "Standard1");
+        cf.delete(new DeletionInfo(timestamp, localDeletionTime));
+        ColumnStats stats = cf.getColumnStats();
+        assertEquals(timestamp, stats.maxTimestamp);
+    }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/4b9a8023/test/unit/org/apache/cassandra/io/sstable/SSTableWriterTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/io/sstable/SSTableWriterTest.java 
b/test/unit/org/apache/cassandra/io/sstable/SSTableWriterTest.java
deleted file mode 100644
index ba6f125..0000000
--- a/test/unit/org/apache/cassandra/io/sstable/SSTableWriterTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.apache.cassandra.io.sstable;
-/*
- * 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * 
- */
-
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.concurrent.ExecutionException;
-
-import org.apache.cassandra.SchemaLoader;
-import org.apache.cassandra.db.ColumnFamilyStore;
-import org.apache.cassandra.db.RowMutation;
-import org.apache.cassandra.db.Table;
-import org.apache.cassandra.db.filter.QueryPath;
-import org.apache.cassandra.utils.ByteBufferUtil;
-import org.junit.Test;
-
-public class SSTableWriterTest extends SchemaLoader
-{
-    @Test
-    public void testRowDeleteTimestampRecordedCorrectly() throws IOException, 
ExecutionException, InterruptedException
-    {
-        Table table = Table.open("Keyspace1");
-        ColumnFamilyStore store = table.getColumnFamilyStore("Standard2");
-        ByteBuffer key = ByteBufferUtil.bytes(String.valueOf("key1"));
-        
-        RowMutation rm = new RowMutation("Keyspace1", key);
-        rm.delete(new QueryPath("Standard2"), 0);
-        rm.apply();
-
-        store.forceBlockingFlush();
-        
-        SSTableReader sstable = store.getSSTables().iterator().next();
-        assertEquals(0, sstable.getMaxTimestamp());
-    }
-}

Reply via email to