Author: slebresne
Date: Mon May 23 10:16:25 2011
New Revision: 1126416

URL: http://svn.apache.org/viewvc?rev=1126416&view=rev
Log:
Don't write CounterUpdateColumn to disk in tests
patch by stuhood; reviewed by slebresne for CASSANDRA-2650

Modified:
    cassandra/branches/cassandra-0.8/CHANGES.txt
    
cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/CounterMutation.java
    
cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/IMutation.java
    
cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/RowMutation.java
    cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/Util.java
    
cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
    
cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/service/AntiEntropyServiceCounterTest.java
    
cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/service/AntiEntropyServiceStandardTest.java
    
cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/service/AntiEntropyServiceTestAbstract.java

Modified: cassandra/branches/cassandra-0.8/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/CHANGES.txt?rev=1126416&r1=1126415&r2=1126416&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.8/CHANGES.txt Mon May 23 10:16:25 2011
@@ -16,6 +16,7 @@
  * don't perform HH to client-mode [storageproxy] nodes (CASSANDRA-2668)
  * Improve forceDeserialize/getCompactedRow encapsulation (CASSANDRA-2659)
  * Assert ranges are not overlapping in AB.normalize (CASSANDRA-2641)
+ * Don't write CounterUpdateColumn to disk in tests (CASSANDRA-2650)
 
 
 0.8.0-final

Modified: 
cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/CounterMutation.java
URL: 
http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/CounterMutation.java?rev=1126416&r1=1126415&r2=1126416&view=diff
==============================================================================
--- 
cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/CounterMutation.java
 (original)
+++ 
cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/CounterMutation.java
 Mon May 23 10:16:25 2011
@@ -72,6 +72,11 @@ public class CounterMutation implements 
         return rowMutation.getTable();
     }
 
+    public Collection<Integer> getColumnFamilyIds()
+    {
+        return rowMutation.getColumnFamilyIds();
+    }
+
     public ByteBuffer key()
     {
         return rowMutation.key();

Modified: 
cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/IMutation.java
URL: 
http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/IMutation.java?rev=1126416&r1=1126415&r2=1126416&view=diff
==============================================================================
--- 
cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/IMutation.java
 (original)
+++ 
cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/IMutation.java
 Mon May 23 10:16:25 2011
@@ -19,11 +19,14 @@
 package org.apache.cassandra.db;
 
 import java.nio.ByteBuffer;
-
+import java.io.IOException;
+import java.util.Collection;
 
 public interface IMutation
 {
     public String getTable();
+    public Collection<Integer> getColumnFamilyIds();
     public ByteBuffer key();
+    public void apply() throws IOException;
     public String toString(boolean shallow);
 }

Modified: 
cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/RowMutation.java
URL: 
http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/RowMutation.java?rev=1126416&r1=1126415&r2=1126416&view=diff
==============================================================================
--- 
cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/RowMutation.java
 (original)
+++ 
cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/RowMutation.java
 Mon May 23 10:16:25 2011
@@ -82,6 +82,11 @@ public class RowMutation implements IMut
         return table_;
     }
 
+    public Collection<Integer> getColumnFamilyIds()
+    {
+        return modifications_.keySet();
+    }
+
     public ByteBuffer key()
     {
         return key_;

Modified: 
cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/Util.java
URL: 
http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/Util.java?rev=1126416&r1=1126415&r2=1126416&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/Util.java 
(original)
+++ cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/Util.java 
Mon May 23 10:16:25 2011
@@ -106,18 +106,16 @@ public class Util
      * @param rows A group of RowMutations for the same table and column 
family.
      * @return The ColumnFamilyStore that was used.
      */
-    public static ColumnFamilyStore writeColumnFamily(List<RowMutation> rms) 
throws IOException, ExecutionException, InterruptedException
+    public static ColumnFamilyStore writeColumnFamily(List<IMutation> rms) 
throws IOException, ExecutionException, InterruptedException
     {
-        RowMutation first = rms.get(0);
+        IMutation first = rms.get(0);
         String tablename = first.getTable();
-        String cfname = 
first.getColumnFamilies().iterator().next().metadata().cfName;
+        Integer cfid = first.getColumnFamilyIds().iterator().next();
 
-        Table table = Table.open(tablename);
-        ColumnFamilyStore store = table.getColumnFamilyStore(cfname);
-
-        for (RowMutation rm : rms)
+        for (IMutation rm : rms)
             rm.apply();
 
+        ColumnFamilyStore store = 
Table.open(tablename).getColumnFamilyStore(cfid);
         store.forceBlockingFlush();
         return store;
     }

Modified: 
cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
URL: 
http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java?rev=1126416&r1=1126415&r2=1126416&view=diff
==============================================================================
--- 
cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
 (original)
+++ 
cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
 Mon May 23 10:16:25 2011
@@ -70,7 +70,7 @@ public class ColumnFamilyStoreTest exten
     @Test
     public void testGetColumnWithWrongBF() throws IOException, 
ExecutionException, InterruptedException
     {
-        List<RowMutation> rms = new LinkedList<RowMutation>();
+        List<IMutation> rms = new LinkedList<IMutation>();
         RowMutation rm;
         rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes("key1"));
         rm.add(new QueryPath("Standard1", null, 
ByteBufferUtil.bytes("Column1")), ByteBufferUtil.bytes("asdf"), 0);
@@ -606,7 +606,7 @@ public class ColumnFamilyStoreTest exten
 
     private ColumnFamilyStore insertKey1Key2() throws IOException, 
ExecutionException, InterruptedException
     {
-        List<RowMutation> rms = new LinkedList<RowMutation>();
+        List<IMutation> rms = new LinkedList<IMutation>();
         RowMutation rm;
         rm = new RowMutation("Keyspace2", ByteBufferUtil.bytes("key1"));
         rm.add(new QueryPath("Standard1", null, 
ByteBufferUtil.bytes("Column1")), ByteBufferUtil.bytes("asdf"), 0);

Modified: 
cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/service/AntiEntropyServiceCounterTest.java
URL: 
http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/service/AntiEntropyServiceCounterTest.java?rev=1126416&r1=1126415&r2=1126416&view=diff
==============================================================================
--- 
cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/service/AntiEntropyServiceCounterTest.java
 (original)
+++ 
cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/service/AntiEntropyServiceCounterTest.java
 Mon May 23 10:16:25 2011
@@ -26,6 +26,7 @@ import java.util.LinkedList;
 import org.apache.cassandra.db.*;
 import org.apache.cassandra.db.filter.QueryPath;
 import org.apache.cassandra.utils.ByteBufferUtil;
+import org.apache.cassandra.thrift.ConsistencyLevel;
 
 public class AntiEntropyServiceCounterTest extends 
AntiEntropyServiceTestAbstract
 {
@@ -35,13 +36,12 @@ public class AntiEntropyServiceCounterTe
         cfname    = "Counter1";
     }
 
-    public List<RowMutation> getWriteData()
+    public List<IMutation> getWriteData()
     {
-        List<RowMutation> rms = new LinkedList<RowMutation>();
-        RowMutation rm;
-        rm = new RowMutation(tablename, ByteBufferUtil.bytes("key1"));
+        List<IMutation> rms = new LinkedList<IMutation>();
+        RowMutation rm = new RowMutation(tablename, 
ByteBufferUtil.bytes("key1"));
         rm.addCounter(new QueryPath(cfname, null, 
ByteBufferUtil.bytes("Column1")), 42);
-        rms.add(rm);
+        rms.add(new CounterMutation(rm, ConsistencyLevel.ONE));
         return rms;
     }
 }

Modified: 
cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/service/AntiEntropyServiceStandardTest.java
URL: 
http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/service/AntiEntropyServiceStandardTest.java?rev=1126416&r1=1126415&r2=1126416&view=diff
==============================================================================
--- 
cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/service/AntiEntropyServiceStandardTest.java
 (original)
+++ 
cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/service/AntiEntropyServiceStandardTest.java
 Mon May 23 10:16:25 2011
@@ -35,9 +35,9 @@ public class AntiEntropyServiceStandardT
         cfname    = "Standard1";
     }
 
-    public List<RowMutation> getWriteData()
+    public List<IMutation> getWriteData()
     {
-        List<RowMutation> rms = new LinkedList<RowMutation>();
+        List<IMutation> rms = new LinkedList<IMutation>();
         RowMutation rm;
         rm = new RowMutation(tablename, ByteBufferUtil.bytes("key1"));
         rm.add(new QueryPath(cfname, null, ByteBufferUtil.bytes("Column1")), 
ByteBufferUtil.bytes("asdfasdf"), 0);

Modified: 
cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/service/AntiEntropyServiceTestAbstract.java
URL: 
http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/service/AntiEntropyServiceTestAbstract.java?rev=1126416&r1=1126415&r2=1126416&view=diff
==============================================================================
--- 
cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/service/AntiEntropyServiceTestAbstract.java
 (original)
+++ 
cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/service/AntiEntropyServiceTestAbstract.java
 Mon May 23 10:16:25 2011
@@ -69,7 +69,7 @@ public abstract class AntiEntropyService
 
     public abstract void init();
 
-    public abstract List<RowMutation> getWriteData();
+    public abstract List<IMutation> getWriteData();
 
     @Before
     public void prepare() throws Exception


Reply via email to