cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1098754 - in /cassandra/trunk: ./ contrib/ debian/ interface/thrift/gen-java/org/apache/cassandra/thrift/ src/java/org/apache/cassandra/config/ src/java/org/apache/cassandra/db/ src/java/org/apache/cassandra/thrift/ test/unit/org/apache/ca...
Date Mon, 02 May 2011 19:20:45 GMT
Author: jbellis
Date: Mon May  2 19:20:44 2011
New Revision: 1098754

URL: http://svn.apache.org/viewvc?rev=1098754&view=rev
Log:
merge from 0.8

Modified:
    cassandra/trunk/   (props changed)
    cassandra/trunk/CHANGES.txt
    cassandra/trunk/NEWS.txt
    cassandra/trunk/build.xml
    cassandra/trunk/contrib/   (props changed)
    cassandra/trunk/debian/rules
    cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java 
 (props changed)
    cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java   (props
changed)
    cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java
  (props changed)
    cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java
  (props changed)
    cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java
  (props changed)
    cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
    cassandra/trunk/src/java/org/apache/cassandra/db/CompactionManager.java
    cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraDaemon.java
    cassandra/trunk/test/unit/org/apache/cassandra/CleanupHelper.java
    cassandra/trunk/test/unit/org/apache/cassandra/SchemaLoader.java
    cassandra/trunk/test/unit/org/apache/cassandra/Util.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/CompactionsPurgeTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/KeyCacheTest.java

Propchange: cassandra/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May  2 19:20:44 2011
@@ -1,7 +1,7 @@
 /cassandra/branches/cassandra-0.6:922689-1052356,1052358-1053452,1053454,1053456-1081914,1083000
 /cassandra/branches/cassandra-0.7:1026516-1096531,1096805,1097448,1097455,1097668,1097843,1097852,1097892
 /cassandra/branches/cassandra-0.7.0:1053690-1055654
-/cassandra/branches/cassandra-0.8:1090935-1097951
+/cassandra/branches/cassandra-0.8:1090935-1098753
 /cassandra/tags/cassandra-0.7.0-rc3:1051699-1053689
 /incubator/cassandra/branches/cassandra-0.3:774578-796573
 /incubator/cassandra/branches/cassandra-0.4:810145-834239,834349-834350

Modified: cassandra/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/trunk/CHANGES.txt?rev=1098754&r1=1098753&r2=1098754&view=diff
==============================================================================
--- cassandra/trunk/CHANGES.txt (original)
+++ cassandra/trunk/CHANGES.txt Mon May  2 19:20:44 2011
@@ -23,6 +23,7 @@
    automatic compactions will only compact 2 or more sstables (CASSANDRA-2575)
  * refuse to apply migrations with older timestamps than the current 
    schema (CASSANDRA-2536)
+ * remove unframed Thrift transport option
 
 
 0.8.0-beta1

Modified: cassandra/trunk/NEWS.txt
URL: http://svn.apache.org/viewvc/cassandra/trunk/NEWS.txt?rev=1098754&r1=1098753&r2=1098754&view=diff
==============================================================================
--- cassandra/trunk/NEWS.txt (original)
+++ cassandra/trunk/NEWS.txt Mon May  2 19:20:44 2011
@@ -35,12 +35,17 @@ Features
 
 Other
 -----
-    In the past, sstable2json would write column names and values as hex
-    strings, and now creates human readable values based on the
-    comparator/validator.  As a result, JSON dumps created with older 
-    versions of sstable2json are no longer compatible with json2sstable,
-    and imports must be made with a configuration that is identical to
-    the export.
+    - In the past, sstable2json would write column names and values as
+      hex strings, and now creates human readable values based on the
+      comparator/validator.  As a result, JSON dumps created with
+      older versions of sstable2json are no longer compatible with
+      json2sstable, and imports must be made with a configuration that
+      is identical to the export.
+    - manually-forced compactions ("nodetool compact") will do nothing
+      if only a single SSTable remains for a ColumnFamily. To force it
+      to compact that anyway (which will free up space if there are
+      a lot of expired tombstones), use the new forceUserDefinedCompaction
+      JMX method on CompactionManager.
 
 JMX
 ---

Modified: cassandra/trunk/build.xml
URL: http://svn.apache.org/viewvc/cassandra/trunk/build.xml?rev=1098754&r1=1098753&r2=1098754&view=diff
==============================================================================
--- cassandra/trunk/build.xml (original)
+++ cassandra/trunk/build.xml Mon May  2 19:20:44 2011
@@ -458,7 +458,6 @@
         <fileset dir="${build.dir}">
           <include name="${final.name}.jar" />
           <include name="${ant.project.name}-thrift-${version}.jar" />
-          <include name="${ant.project.name}-cql-${version}.jar" />
         </fileset>
       </copy>
       <copy todir="${dist.dir}/javadoc">
@@ -539,12 +538,14 @@
                 algorithm="MD5">
         <fileset dir="${build.dir}">
           <include name="*.tar.gz" />
+          <include name="${ant.project.name}-cql-${cql.driver.version}.jar" />
         </fileset>
       </checksum>
       <checksum forceOverwrite="yes" todir="${build.dir}" fileext=".sha"
                 algorithm="SHA">
         <fileset dir="${build.dir}">
           <include name="*.tar.gz" />
+          <include name="${ant.project.name}-cql-${cql.driver.version}.jar" />
         </fileset>
       </checksum>
 

Propchange: cassandra/trunk/contrib/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May  2 19:20:44 2011
@@ -1,7 +1,7 @@
 /cassandra/branches/cassandra-0.6/contrib:922689-1052356,1052358-1053452,1053454,1053456-1068009
 /cassandra/branches/cassandra-0.7/contrib:1026516-1096531,1096805,1097448,1097455,1097668,1097843,1097852,1097892
 /cassandra/branches/cassandra-0.7.0/contrib:1053690-1055654
-/cassandra/branches/cassandra-0.8/contrib:1090935-1097951
+/cassandra/branches/cassandra-0.8/contrib:1090935-1098753
 /cassandra/tags/cassandra-0.7.0-rc3/contrib:1051699-1053689
 /incubator/cassandra/branches/cassandra-0.3/contrib:774578-796573
 /incubator/cassandra/branches/cassandra-0.4/contrib:810145-810987,810994-834239,834349-834350

Modified: cassandra/trunk/debian/rules
URL: http://svn.apache.org/viewvc/cassandra/trunk/debian/rules?rev=1098754&r1=1098753&r2=1098754&view=diff
==============================================================================
--- cassandra/trunk/debian/rules (original)
+++ cassandra/trunk/debian/rules Mon May  2 19:20:44 2011
@@ -38,6 +38,11 @@ install: build
 	# Copy in the jar and symlink to something stable
 	dh_install build/apache-cassandra-$(VERSION).jar \
 		usr/share/cassandra
+	dh_install build/apache-cassandra-thrift-$(VERSION).jar \
+		usr/share/cassandra
+	dh_install build/apache-cassandra-cql-*.jar \
+		usr/share/cassandra
+
 	dh_link usr/share/cassandra/apache-cassandra-$(VERSION).jar \
 		usr/share/cassandra/apache-cassandra.jar
 

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May  2 19:20:44 2011
@@ -1,7 +1,7 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:922689-1052356,1052358-1053452,1053454,1053456-1081914,1083000
 /cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1026516-1096531,1096805,1097448,1097455,1097668,1097843,1097852,1097892
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1053690-1055654
-/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1090935-1097951
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1090935-1098753
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1051699-1053689
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/Cassandra.java:774578-796573
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/Cassandra.java:810145-834239,834349-834350

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May  2 19:20:44 2011
@@ -1,7 +1,7 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:922689-1052356,1052358-1053452,1053454,1053456-1081914,1083000
 /cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1026516-1096531,1096805,1097448,1097455,1097668,1097843,1097852,1097892
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1053690-1055654
-/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1090935-1097951
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1090935-1098753
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1051699-1053689
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/column_t.java:774578-792198
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/Column.java:810145-834239,834349-834350

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May  2 19:20:44 2011
@@ -1,7 +1,7 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:922689-1052356,1052358-1053452,1053454,1053456-1081914,1083000
 /cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1026516-1096531,1096805,1097448,1097455,1097668,1097843,1097852,1097892
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1053690-1055654
-/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1090935-1097951
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1090935-1098753
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1051699-1053689
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java:774578-796573
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java:810145-834239,834349-834350

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May  2 19:20:44 2011
@@ -1,7 +1,7 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:922689-1052356,1052358-1053452,1053454,1053456-1081914,1083000
 /cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1026516-1096531,1096805,1097448,1097455,1097668,1097843,1097852,1097892
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1053690-1055654
-/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1090935-1097951
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1090935-1098753
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1051699-1053689
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/NotFoundException.java:774578-796573
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/NotFoundException.java:810145-834239,834349-834350

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May  2 19:20:44 2011
@@ -1,7 +1,7 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:922689-1052356,1052358-1053452,1053454,1053456-1081914,1083000
 /cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1026516-1096531,1096805,1097448,1097455,1097668,1097843,1097852,1097892
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1053690-1055654
-/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1090935-1097951
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1090935-1098753
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1051699-1053689
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/superColumn_t.java:774578-792198
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/SuperColumn.java:810145-834239,834349-834350

Modified: cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java?rev=1098754&r1=1098753&r2=1098754&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java Mon May 
2 19:20:44 2011
@@ -275,6 +275,9 @@ public class DatabaseDescriptor
                 }
             }
 
+            if (conf.thrift_framed_transport_size_in_mb <= 0)
+                throw new ConfigurationException("thrift_framed_transport_size_in_mb must
be positive");
+
             if (conf.thrift_framed_transport_size_in_mb > 0 && conf.thrift_max_message_length_in_mb
< conf.thrift_framed_transport_size_in_mb)
             {
                 throw new ConfigurationException("thrift_max_message_length_in_mb must be
greater than thrift_framed_transport_size_in_mb when using TFramedTransport");
@@ -516,11 +519,6 @@ public class DatabaseDescriptor
         return authority;
     }
 
-    public static boolean isThriftFramed()
-    {
-        return conf.thrift_framed_transport_size_in_mb > 0;
-    }
-    
     public static int getThriftMaxMessageLength()
     {
         return conf.thrift_max_message_length_in_mb * 1024 * 1024;

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/CompactionManager.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/CompactionManager.java?rev=1098754&r1=1098753&r2=1098754&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/CompactionManager.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/CompactionManager.java Mon May  2 19:20:44
2011
@@ -378,7 +378,7 @@ public class CompactionManager implement
         submitUserDefined(cfs, descriptors, getDefaultGcBefore(cfs));
     }
 
-    private Future<Object> submitUserDefined(final ColumnFamilyStore cfs, final Collection<Descriptor>
dataFiles, final int gcBefore)
+    public Future<Object> submitUserDefined(final ColumnFamilyStore cfs, final Collection<Descriptor>
dataFiles, final int gcBefore)
     {
         Callable<Object> callable = new Callable<Object>()
         {

Modified: cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraDaemon.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraDaemon.java?rev=1098754&r1=1098753&r2=1098754&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraDaemon.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraDaemon.java Mon May  2 19:20:44
2011
@@ -119,18 +119,10 @@ public class CassandraDaemon extends org
 
             // Transport factory
             TTransportFactory inTransportFactory, outTransportFactory;
-            if (DatabaseDescriptor.isThriftFramed())
-            {
-                int tFramedTransportSize = DatabaseDescriptor.getThriftFramedTransportSize();
-                inTransportFactory  = new TFramedTransport.Factory(tFramedTransportSize);
-                outTransportFactory = new TFramedTransport.Factory(tFramedTransportSize);
-                logger.info("Using TFastFramedTransport with a max frame size of {} bytes.",
tFramedTransportSize);
-            }
-            else
-            {
-                inTransportFactory = new TTransportFactory();
-                outTransportFactory = new TTransportFactory();
-            }
+            int tFramedTransportSize = DatabaseDescriptor.getThriftFramedTransportSize();
+            inTransportFactory  = new TFramedTransport.Factory(tFramedTransportSize);
+            outTransportFactory = new TFramedTransport.Factory(tFramedTransportSize);
+            logger.info("Using TFastFramedTransport with a max frame size of {} bytes.",
tFramedTransportSize);
 
             // ThreadPool Server
             TThreadPoolServer.Args args = new TThreadPoolServer.Args(tServerSocket)

Modified: cassandra/trunk/test/unit/org/apache/cassandra/CleanupHelper.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/CleanupHelper.java?rev=1098754&r1=1098753&r2=1098754&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/CleanupHelper.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/CleanupHelper.java Mon May  2 19:20:44
2011
@@ -27,10 +27,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.apache.cassandra.config.DatabaseDescriptor;
-import org.apache.cassandra.db.ColumnFamilyStore;
-import org.apache.cassandra.db.DecoratedKey;
-import org.apache.cassandra.db.RowMutation;
-import org.apache.cassandra.db.Table;
+import org.apache.cassandra.db.*;
 import org.apache.cassandra.db.commitlog.CommitLog;
 import org.apache.cassandra.db.filter.QueryPath;
 import org.apache.cassandra.io.util.FileUtils;

Modified: cassandra/trunk/test/unit/org/apache/cassandra/SchemaLoader.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/SchemaLoader.java?rev=1098754&r1=1098753&r2=1098754&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/SchemaLoader.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/SchemaLoader.java Mon May  2 19:20:44 2011
@@ -188,6 +188,8 @@ public class SchemaLoader
                                   standardCFMD(ks_kcs, "Standard1")
                                               .keyCacheSize(0.5),
                                   standardCFMD(ks_kcs, "Standard2")
+                                              .keyCacheSize(1.0),
+                                  standardCFMD(ks_kcs, "Standard3")
                                               .keyCacheSize(1.0)));
 
         // RowCacheSpace

Modified: cassandra/trunk/test/unit/org/apache/cassandra/Util.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/Util.java?rev=1098754&r1=1098753&r2=1098754&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/Util.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/Util.java Mon May  2 19:20:44 2011
@@ -24,8 +24,11 @@ import java.io.IOException;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
 
 import org.apache.cassandra.db.*;
 import org.apache.cassandra.db.columniterator.IdentityQueryFilter;
@@ -34,6 +37,8 @@ import org.apache.cassandra.db.filter.Qu
 import org.apache.cassandra.dht.*;
 import org.apache.cassandra.gms.ApplicationState;
 import org.apache.cassandra.gms.VersionedValue;
+import org.apache.cassandra.io.sstable.Descriptor;
+import org.apache.cassandra.io.sstable.SSTableReader;
 import org.apache.cassandra.service.StorageService;
 import org.apache.cassandra.utils.ByteBufferUtil;
 import org.apache.cassandra.utils.NodeId;
@@ -179,4 +184,13 @@ public class Util
         for (int i=0; i<endpointTokens.size(); ++i)
             assertTrue(ss.getTokenMetadata().isMember(hosts.get(i)));
     }
+
+    public static Future<?> compactAll(ColumnFamilyStore cfs)
+    {
+        List<Descriptor> descriptors = new ArrayList<Descriptor>();
+        for (SSTableReader sstable : cfs.getSSTables())
+            descriptors.add(sstable.descriptor);
+        return CompactionManager.instance.submitUserDefined(cfs, descriptors, Integer.MAX_VALUE);
+    }
+
 }

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/CompactionsPurgeTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/CompactionsPurgeTest.java?rev=1098754&r1=1098753&r2=1098754&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/CompactionsPurgeTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/CompactionsPurgeTest.java Mon May  2
19:20:44 2011
@@ -21,6 +21,7 @@ package org.apache.cassandra.db;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.concurrent.ExecutionException;
 
 import org.junit.Test;
@@ -28,6 +29,7 @@ import org.junit.Test;
 import org.apache.cassandra.CleanupHelper;
 import org.apache.cassandra.db.filter.QueryFilter;
 import org.apache.cassandra.db.filter.QueryPath;
+import org.apache.cassandra.io.sstable.Descriptor;
 import org.apache.cassandra.io.sstable.SSTableReader;
 import org.apache.cassandra.Util;
 
@@ -148,7 +150,7 @@ public class CompactionsPurgeTest extend
 
         Table table = Table.open(TABLE1);
         String cfName = "Standard2";
-        ColumnFamilyStore store = table.getColumnFamilyStore(cfName);
+        ColumnFamilyStore cfs = table.getColumnFamilyStore(cfName);
 
         DecoratedKey key = Util.dk("key1");
         RowMutation rm;
@@ -168,13 +170,12 @@ public class CompactionsPurgeTest extend
             rm.delete(new QueryPath(cfName, null, ByteBufferUtil.bytes(String.valueOf(i))),
1);
             rm.apply();
         }
-        store.forceBlockingFlush();
-
-        assert store.getSSTables().size() == 1 : store.getSSTables(); // inserts & deletes
were in the same memtable -> only deletes in sstable
+        cfs.forceBlockingFlush();
+        assert cfs.getSSTables().size() == 1 : cfs.getSSTables(); // inserts & deletes
were in the same memtable -> only deletes in sstable
 
         // compact and test that the row is completely gone
-        CompactionManager.instance.submitMajor(store, 0, Integer.MAX_VALUE).get();
-        assert store.getSSTables().isEmpty();
+        Util.compactAll(cfs).get();
+        assert cfs.getSSTables().isEmpty();
         ColumnFamily cf = table.getColumnFamilyStore(cfName).getColumnFamily(QueryFilter.getIdentityFilter(key,
new QueryPath(cfName)));
         assert cf == null : cf;
     }
@@ -210,8 +211,7 @@ public class CompactionsPurgeTest extend
 
         // flush and major compact
         cfs.forceBlockingFlush();
-        CompactionManager.instance.submitMajor(cfs, 0, Integer.MAX_VALUE).get();
-        //cfs.invalidateCachedRow(key);
+        Util.compactAll(cfs).get();
 
         // re-inserts with timestamp lower than delete
         rm = new RowMutation(tableName, key.key);

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/KeyCacheTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/KeyCacheTest.java?rev=1098754&r1=1098753&r2=1098754&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/KeyCacheTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/KeyCacheTest.java Mon May  2 19:20:44
2011
@@ -35,11 +35,14 @@ import org.apache.cassandra.io.sstable.D
 import org.apache.cassandra.utils.ByteBufferUtil;
 import org.apache.cassandra.utils.Pair;
 
+import static junit.framework.Assert.assertEquals;
+
 public class KeyCacheTest extends CleanupHelper
 {
     private static final String TABLE1 = "KeyCacheSpace";
     private static final String COLUMN_FAMILY1 = "Standard1";
     private static final String COLUMN_FAMILY2 = "Standard2";
+    private static final String COLUMN_FAMILY3 = "Standard3";
 
     @Test
     public void testKeyCache50() throws IOException, ExecutionException, InterruptedException
@@ -58,19 +61,19 @@ public class KeyCacheTest extends Cleanu
     {
         CompactionManager.instance.disableAutoCompaction();
 
-        ColumnFamilyStore store = Table.open(TABLE1).getColumnFamilyStore(COLUMN_FAMILY2);
+        ColumnFamilyStore store = Table.open(TABLE1).getColumnFamilyStore(COLUMN_FAMILY3);
 
         // empty the cache
         store.invalidateKeyCache();
         assert store.getKeyCacheSize() == 0;
 
         // insert data and force to disk
-        insertData(TABLE1, COLUMN_FAMILY2, 0, 100);
+        insertData(TABLE1, COLUMN_FAMILY3, 0, 100);
         store.forceBlockingFlush();
 
         // populate the cache
-        readData(TABLE1, COLUMN_FAMILY2, 0, 100);
-        assert store.getKeyCacheSize() == 100;
+        readData(TABLE1, COLUMN_FAMILY3, 0, 100);
+        assertEquals(100, store.getKeyCacheSize());
 
         // really? our caches don't implement the map interface? (hence no .addAll)
         Map<Pair<Descriptor, DecoratedKey>, Long> savedMap = new HashMap<Pair<Descriptor,
DecoratedKey>, Long>();
@@ -88,7 +91,7 @@ public class KeyCacheTest extends Cleanu
 
         // load the cache from disk
         store.unregisterMBean(); // unregistering old MBean to test how key cache will be
loaded
-        ColumnFamilyStore newStore = ColumnFamilyStore.createColumnFamilyStore(Table.open(TABLE1),
COLUMN_FAMILY2);
+        ColumnFamilyStore newStore = ColumnFamilyStore.createColumnFamilyStore(Table.open(TABLE1),
COLUMN_FAMILY3);
         assert newStore.getKeyCacheSize() == 100;
 
         assert savedMap.size() == 100;
@@ -103,10 +106,10 @@ public class KeyCacheTest extends Cleanu
         CompactionManager.instance.disableAutoCompaction();
 
         Table table = Table.open(TABLE1);
-        ColumnFamilyStore store = table.getColumnFamilyStore(cfName);
+        ColumnFamilyStore cfs = table.getColumnFamilyStore(cfName);
 
         // KeyCache should start at size 1 if we're caching X% of zero data.
-        int keyCacheSize = store.getKeyCacheCapacity();
+        int keyCacheSize = cfs.getKeyCacheCapacity();
         assert keyCacheSize == 1 : keyCacheSize;
 
         DecoratedKey key1 = Util.dk("key1");
@@ -130,13 +133,13 @@ public class KeyCacheTest extends Cleanu
         rm.apply();
 
         // After a flush, the cache should expand to be X% of indices * INDEX_INTERVAL.
-        store.forceBlockingFlush();
-        keyCacheSize = store.getKeyCacheCapacity();
+        cfs.forceBlockingFlush();
+        keyCacheSize = cfs.getKeyCacheCapacity();
         assert keyCacheSize == expectedCacheSize : keyCacheSize;
 
         // After a compaction, the cache should expand to be X% of zero data.
-        CompactionManager.instance.submitMajor(store, 0, Integer.MAX_VALUE).get();
-        keyCacheSize = store.getKeyCacheCapacity();
+        Util.compactAll(cfs).get();
+        keyCacheSize = cfs.getKeyCacheCapacity();
         assert keyCacheSize == 1 : keyCacheSize;
     }
 }



Mime
View raw message