You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2011/06/11 00:13:55 UTC

svn commit: r1134460 [1/2] - in /cassandra/trunk: ./ interface/ interface/thrift/gen-java/org/apache/cassandra/thrift/ src/avro/ src/java/org/apache/cassandra/cli/ src/java/org/apache/cassandra/config/ src/java/org/apache/cassandra/db/ src/java/org/apa...

Author: jbellis
Date: Fri Jun 10 22:13:54 2011
New Revision: 1134460

URL: http://svn.apache.org/viewvc?rev=1134460&view=rev
Log:
extract AbstractCompactionStrategy, AbstractCompactionTask
patch by Alan Liang and Ben Coverston; reviewed by jbellis for CASSANDRA-1610

Added:
    cassandra/trunk/src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java
    cassandra/trunk/src/java/org/apache/cassandra/db/compaction/AbstractCompactionTask.java
    cassandra/trunk/src/java/org/apache/cassandra/db/compaction/CompactionTask.java
    cassandra/trunk/src/java/org/apache/cassandra/db/compaction/SizeTieredCompactionStrategy.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/compaction/SizeTieredCompactionStrategyTest.java
Modified:
    cassandra/trunk/build.xml
    cassandra/trunk/interface/cassandra.thrift
    cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
    cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/CfDef.java
    cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlResult.java
    cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlRow.java
    cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/KsDef.java
    cassandra/trunk/src/avro/internode.genavro
    cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java
    cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java
    cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
    cassandra/trunk/src/java/org/apache/cassandra/db/DataTracker.java
    cassandra/trunk/src/java/org/apache/cassandra/db/HintedHandOffManager.java
    cassandra/trunk/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
    cassandra/trunk/src/java/org/apache/cassandra/service/AbstractCassandraDaemon.java
    cassandra/trunk/test/long/org/apache/cassandra/db/compaction/LongCompactionSpeedTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/cli/CliTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/DefsTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/compaction/CompactionsPurgeTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/compaction/CompactionsTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java

Modified: cassandra/trunk/build.xml
URL: http://svn.apache.org/viewvc/cassandra/trunk/build.xml?rev=1134460&r1=1134459&r2=1134460&view=diff
==============================================================================
--- cassandra/trunk/build.xml (original)
+++ cassandra/trunk/build.xml Fri Jun 10 22:13:54 2011
@@ -378,6 +378,8 @@ url=${svn.entry.url}?pathrev=${svn.entry
 
           <dependency groupId="com.thoughtworks.paranamer" artifactId="paranamer-ant" version="2.1"/>
           <dependency groupId="junit" artifactId="junit" version="4.6" />
+          <dependency groupId="org.mockito" artifactId="mockito-core" version="1.8.1"/>
+          <dependency groupId="org.mockito" artifactId="mockito-all" version="1.8.1"/>
           <dependency groupId="commons-logging" artifactId="commons-logging" version="1.1.1"/>
           <dependency groupId="org.apache.rat" artifactId="apache-rat" version="0.6" />
           <dependency groupId="com.cloudera.hadoop" artifactId="hadoop-core" version="0.20.2-320"/>
@@ -421,6 +423,8 @@ url=${svn.entry.url}?pathrev=${svn.entry
         (since it depends on them). -->
         <dependency groupId="com.thoughtworks.paranamer" artifactId="paranamer-ant"/>
         <dependency groupId="junit" artifactId="junit"/>
+        <dependency groupId="org.mockito" artifactId="mockito-core"/>
+        <dependency groupId="org.mockito" artifactId="mockito-all"/>
         <dependency groupId="commons-logging" artifactId="commons-logging"/>
         <dependency groupId="org.apache.rat" artifactId="apache-rat"/>
         <dependency groupId="com.cloudera.hadoop" artifactId="hadoop-core"/>

Modified: cassandra/trunk/interface/cassandra.thrift
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/cassandra.thrift?rev=1134460&r1=1134459&r2=1134460&view=diff
==============================================================================
--- cassandra/trunk/interface/cassandra.thrift (original)
+++ cassandra/trunk/interface/cassandra.thrift Fri Jun 10 22:13:54 2011
@@ -395,6 +395,8 @@ struct CfDef {
     26: optional string key_validation_class,
     27: optional string row_cache_provider="org.apache.cassandra.cache.ConcurrentLinkedHashCacheProvider",
     28: optional binary key_alias,
+    29: optional string compaction_strategy,
+    30: optional map<string,string> compaction_strategy_options,
 }
 
 /* describes a keyspace. */

Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java?rev=1134460&r1=1134459&r2=1134460&view=diff
==============================================================================
--- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java (original)
+++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java Fri Jun 10 22:13:54 2011
@@ -7624,14 +7624,14 @@ public class Cassandra {
           case 0: // SUCCESS
             if (field.type == org.apache.thrift.protocol.TType.LIST) {
               {
-                org.apache.thrift.protocol.TList _list50 = iprot.readListBegin();
-                this.success = new ArrayList<ColumnOrSuperColumn>(_list50.size);
-                for (int _i51 = 0; _i51 < _list50.size; ++_i51)
+                org.apache.thrift.protocol.TList _list55 = iprot.readListBegin();
+                this.success = new ArrayList<ColumnOrSuperColumn>(_list55.size);
+                for (int _i56 = 0; _i56 < _list55.size; ++_i56)
                 {
-                  ColumnOrSuperColumn _elem52;
-                  _elem52 = new ColumnOrSuperColumn();
-                  _elem52.read(iprot);
-                  this.success.add(_elem52);
+                  ColumnOrSuperColumn _elem57;
+                  _elem57 = new ColumnOrSuperColumn();
+                  _elem57.read(iprot);
+                  this.success.add(_elem57);
                 }
                 iprot.readListEnd();
               }
@@ -7681,9 +7681,9 @@ public class Cassandra {
         oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
         {
           oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.success.size()));
-          for (ColumnOrSuperColumn _iter53 : this.success)
+          for (ColumnOrSuperColumn _iter58 : this.success)
           {
-            _iter53.write(oprot);
+            _iter58.write(oprot);
           }
           oprot.writeListEnd();
         }
@@ -9435,13 +9435,13 @@ public class Cassandra {
           case 1: // KEYS
             if (field.type == org.apache.thrift.protocol.TType.LIST) {
               {
-                org.apache.thrift.protocol.TList _list54 = iprot.readListBegin();
-                this.keys = new ArrayList<ByteBuffer>(_list54.size);
-                for (int _i55 = 0; _i55 < _list54.size; ++_i55)
+                org.apache.thrift.protocol.TList _list59 = iprot.readListBegin();
+                this.keys = new ArrayList<ByteBuffer>(_list59.size);
+                for (int _i60 = 0; _i60 < _list59.size; ++_i60)
                 {
-                  ByteBuffer _elem56;
-                  _elem56 = iprot.readBinary();
-                  this.keys.add(_elem56);
+                  ByteBuffer _elem61;
+                  _elem61 = iprot.readBinary();
+                  this.keys.add(_elem61);
                 }
                 iprot.readListEnd();
               }
@@ -9491,9 +9491,9 @@ public class Cassandra {
         oprot.writeFieldBegin(KEYS_FIELD_DESC);
         {
           oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, this.keys.size()));
-          for (ByteBuffer _iter57 : this.keys)
+          for (ByteBuffer _iter62 : this.keys)
           {
-            oprot.writeBinary(_iter57);
+            oprot.writeBinary(_iter62);
           }
           oprot.writeListEnd();
         }
@@ -10066,26 +10066,26 @@ public class Cassandra {
           case 0: // SUCCESS
             if (field.type == org.apache.thrift.protocol.TType.MAP) {
               {
-                org.apache.thrift.protocol.TMap _map58 = iprot.readMapBegin();
-                this.success = new HashMap<ByteBuffer,List<ColumnOrSuperColumn>>(2*_map58.size);
-                for (int _i59 = 0; _i59 < _map58.size; ++_i59)
+                org.apache.thrift.protocol.TMap _map63 = iprot.readMapBegin();
+                this.success = new HashMap<ByteBuffer,List<ColumnOrSuperColumn>>(2*_map63.size);
+                for (int _i64 = 0; _i64 < _map63.size; ++_i64)
                 {
-                  ByteBuffer _key60;
-                  List<ColumnOrSuperColumn> _val61;
-                  _key60 = iprot.readBinary();
+                  ByteBuffer _key65;
+                  List<ColumnOrSuperColumn> _val66;
+                  _key65 = iprot.readBinary();
                   {
-                    org.apache.thrift.protocol.TList _list62 = iprot.readListBegin();
-                    _val61 = new ArrayList<ColumnOrSuperColumn>(_list62.size);
-                    for (int _i63 = 0; _i63 < _list62.size; ++_i63)
+                    org.apache.thrift.protocol.TList _list67 = iprot.readListBegin();
+                    _val66 = new ArrayList<ColumnOrSuperColumn>(_list67.size);
+                    for (int _i68 = 0; _i68 < _list67.size; ++_i68)
                     {
-                      ColumnOrSuperColumn _elem64;
-                      _elem64 = new ColumnOrSuperColumn();
-                      _elem64.read(iprot);
-                      _val61.add(_elem64);
+                      ColumnOrSuperColumn _elem69;
+                      _elem69 = new ColumnOrSuperColumn();
+                      _elem69.read(iprot);
+                      _val66.add(_elem69);
                     }
                     iprot.readListEnd();
                   }
-                  this.success.put(_key60, _val61);
+                  this.success.put(_key65, _val66);
                 }
                 iprot.readMapEnd();
               }
@@ -10135,14 +10135,14 @@ public class Cassandra {
         oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
         {
           oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.LIST, this.success.size()));
-          for (Map.Entry<ByteBuffer, List<ColumnOrSuperColumn>> _iter65 : this.success.entrySet())
+          for (Map.Entry<ByteBuffer, List<ColumnOrSuperColumn>> _iter70 : this.success.entrySet())
           {
-            oprot.writeBinary(_iter65.getKey());
+            oprot.writeBinary(_iter70.getKey());
             {
-              oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, _iter65.getValue().size()));
-              for (ColumnOrSuperColumn _iter66 : _iter65.getValue())
+              oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, _iter70.getValue().size()));
+              for (ColumnOrSuperColumn _iter71 : _iter70.getValue())
               {
-                _iter66.write(oprot);
+                _iter71.write(oprot);
               }
               oprot.writeListEnd();
             }
@@ -10714,13 +10714,13 @@ public class Cassandra {
           case 1: // KEYS
             if (field.type == org.apache.thrift.protocol.TType.LIST) {
               {
-                org.apache.thrift.protocol.TList _list67 = iprot.readListBegin();
-                this.keys = new ArrayList<ByteBuffer>(_list67.size);
-                for (int _i68 = 0; _i68 < _list67.size; ++_i68)
+                org.apache.thrift.protocol.TList _list72 = iprot.readListBegin();
+                this.keys = new ArrayList<ByteBuffer>(_list72.size);
+                for (int _i73 = 0; _i73 < _list72.size; ++_i73)
                 {
-                  ByteBuffer _elem69;
-                  _elem69 = iprot.readBinary();
-                  this.keys.add(_elem69);
+                  ByteBuffer _elem74;
+                  _elem74 = iprot.readBinary();
+                  this.keys.add(_elem74);
                 }
                 iprot.readListEnd();
               }
@@ -10770,9 +10770,9 @@ public class Cassandra {
         oprot.writeFieldBegin(KEYS_FIELD_DESC);
         {
           oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, this.keys.size()));
-          for (ByteBuffer _iter70 : this.keys)
+          for (ByteBuffer _iter75 : this.keys)
           {
-            oprot.writeBinary(_iter70);
+            oprot.writeBinary(_iter75);
           }
           oprot.writeListEnd();
         }
@@ -11341,15 +11341,15 @@ public class Cassandra {
           case 0: // SUCCESS
             if (field.type == org.apache.thrift.protocol.TType.MAP) {
               {
-                org.apache.thrift.protocol.TMap _map71 = iprot.readMapBegin();
-                this.success = new HashMap<ByteBuffer,Integer>(2*_map71.size);
-                for (int _i72 = 0; _i72 < _map71.size; ++_i72)
+                org.apache.thrift.protocol.TMap _map76 = iprot.readMapBegin();
+                this.success = new HashMap<ByteBuffer,Integer>(2*_map76.size);
+                for (int _i77 = 0; _i77 < _map76.size; ++_i77)
                 {
-                  ByteBuffer _key73;
-                  int _val74;
-                  _key73 = iprot.readBinary();
-                  _val74 = iprot.readI32();
-                  this.success.put(_key73, _val74);
+                  ByteBuffer _key78;
+                  int _val79;
+                  _key78 = iprot.readBinary();
+                  _val79 = iprot.readI32();
+                  this.success.put(_key78, _val79);
                 }
                 iprot.readMapEnd();
               }
@@ -11399,10 +11399,10 @@ public class Cassandra {
         oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
         {
           oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.I32, this.success.size()));
-          for (Map.Entry<ByteBuffer, Integer> _iter75 : this.success.entrySet())
+          for (Map.Entry<ByteBuffer, Integer> _iter80 : this.success.entrySet())
           {
-            oprot.writeBinary(_iter75.getKey());
-            oprot.writeI32(_iter75.getValue());
+            oprot.writeBinary(_iter80.getKey());
+            oprot.writeI32(_iter80.getValue());
           }
           oprot.writeMapEnd();
         }
@@ -12554,14 +12554,14 @@ public class Cassandra {
           case 0: // SUCCESS
             if (field.type == org.apache.thrift.protocol.TType.LIST) {
               {
-                org.apache.thrift.protocol.TList _list76 = iprot.readListBegin();
-                this.success = new ArrayList<KeySlice>(_list76.size);
-                for (int _i77 = 0; _i77 < _list76.size; ++_i77)
+                org.apache.thrift.protocol.TList _list81 = iprot.readListBegin();
+                this.success = new ArrayList<KeySlice>(_list81.size);
+                for (int _i82 = 0; _i82 < _list81.size; ++_i82)
                 {
-                  KeySlice _elem78;
-                  _elem78 = new KeySlice();
-                  _elem78.read(iprot);
-                  this.success.add(_elem78);
+                  KeySlice _elem83;
+                  _elem83 = new KeySlice();
+                  _elem83.read(iprot);
+                  this.success.add(_elem83);
                 }
                 iprot.readListEnd();
               }
@@ -12611,9 +12611,9 @@ public class Cassandra {
         oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
         {
           oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.success.size()));
-          for (KeySlice _iter79 : this.success)
+          for (KeySlice _iter84 : this.success)
           {
-            _iter79.write(oprot);
+            _iter84.write(oprot);
           }
           oprot.writeListEnd();
         }
@@ -13765,14 +13765,14 @@ public class Cassandra {
           case 0: // SUCCESS
             if (field.type == org.apache.thrift.protocol.TType.LIST) {
               {
-                org.apache.thrift.protocol.TList _list80 = iprot.readListBegin();
-                this.success = new ArrayList<KeySlice>(_list80.size);
-                for (int _i81 = 0; _i81 < _list80.size; ++_i81)
+                org.apache.thrift.protocol.TList _list85 = iprot.readListBegin();
+                this.success = new ArrayList<KeySlice>(_list85.size);
+                for (int _i86 = 0; _i86 < _list85.size; ++_i86)
                 {
-                  KeySlice _elem82;
-                  _elem82 = new KeySlice();
-                  _elem82.read(iprot);
-                  this.success.add(_elem82);
+                  KeySlice _elem87;
+                  _elem87 = new KeySlice();
+                  _elem87.read(iprot);
+                  this.success.add(_elem87);
                 }
                 iprot.readListEnd();
               }
@@ -13822,9 +13822,9 @@ public class Cassandra {
         oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
         {
           oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.success.size()));
-          for (KeySlice _iter83 : this.success)
+          for (KeySlice _iter88 : this.success)
           {
-            _iter83.write(oprot);
+            _iter88.write(oprot);
           }
           oprot.writeListEnd();
         }
@@ -18523,38 +18523,38 @@ public class Cassandra {
           case 1: // MUTATION_MAP
             if (field.type == org.apache.thrift.protocol.TType.MAP) {
               {
-                org.apache.thrift.protocol.TMap _map84 = iprot.readMapBegin();
-                this.mutation_map = new HashMap<ByteBuffer,Map<String,List<Mutation>>>(2*_map84.size);
-                for (int _i85 = 0; _i85 < _map84.size; ++_i85)
+                org.apache.thrift.protocol.TMap _map89 = iprot.readMapBegin();
+                this.mutation_map = new HashMap<ByteBuffer,Map<String,List<Mutation>>>(2*_map89.size);
+                for (int _i90 = 0; _i90 < _map89.size; ++_i90)
                 {
-                  ByteBuffer _key86;
-                  Map<String,List<Mutation>> _val87;
-                  _key86 = iprot.readBinary();
+                  ByteBuffer _key91;
+                  Map<String,List<Mutation>> _val92;
+                  _key91 = iprot.readBinary();
                   {
-                    org.apache.thrift.protocol.TMap _map88 = iprot.readMapBegin();
-                    _val87 = new HashMap<String,List<Mutation>>(2*_map88.size);
-                    for (int _i89 = 0; _i89 < _map88.size; ++_i89)
+                    org.apache.thrift.protocol.TMap _map93 = iprot.readMapBegin();
+                    _val92 = new HashMap<String,List<Mutation>>(2*_map93.size);
+                    for (int _i94 = 0; _i94 < _map93.size; ++_i94)
                     {
-                      String _key90;
-                      List<Mutation> _val91;
-                      _key90 = iprot.readString();
+                      String _key95;
+                      List<Mutation> _val96;
+                      _key95 = iprot.readString();
                       {
-                        org.apache.thrift.protocol.TList _list92 = iprot.readListBegin();
-                        _val91 = new ArrayList<Mutation>(_list92.size);
-                        for (int _i93 = 0; _i93 < _list92.size; ++_i93)
+                        org.apache.thrift.protocol.TList _list97 = iprot.readListBegin();
+                        _val96 = new ArrayList<Mutation>(_list97.size);
+                        for (int _i98 = 0; _i98 < _list97.size; ++_i98)
                         {
-                          Mutation _elem94;
-                          _elem94 = new Mutation();
-                          _elem94.read(iprot);
-                          _val91.add(_elem94);
+                          Mutation _elem99;
+                          _elem99 = new Mutation();
+                          _elem99.read(iprot);
+                          _val96.add(_elem99);
                         }
                         iprot.readListEnd();
                       }
-                      _val87.put(_key90, _val91);
+                      _val92.put(_key95, _val96);
                     }
                     iprot.readMapEnd();
                   }
-                  this.mutation_map.put(_key86, _val87);
+                  this.mutation_map.put(_key91, _val92);
                 }
                 iprot.readMapEnd();
               }
@@ -18588,19 +18588,19 @@ public class Cassandra {
         oprot.writeFieldBegin(MUTATION_MAP_FIELD_DESC);
         {
           oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.MAP, this.mutation_map.size()));
-          for (Map.Entry<ByteBuffer, Map<String,List<Mutation>>> _iter95 : this.mutation_map.entrySet())
+          for (Map.Entry<ByteBuffer, Map<String,List<Mutation>>> _iter100 : this.mutation_map.entrySet())
           {
-            oprot.writeBinary(_iter95.getKey());
+            oprot.writeBinary(_iter100.getKey());
             {
-              oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.LIST, _iter95.getValue().size()));
-              for (Map.Entry<String, List<Mutation>> _iter96 : _iter95.getValue().entrySet())
+              oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.LIST, _iter100.getValue().size()));
+              for (Map.Entry<String, List<Mutation>> _iter101 : _iter100.getValue().entrySet())
               {
-                oprot.writeString(_iter96.getKey());
+                oprot.writeString(_iter101.getKey());
                 {
-                  oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, _iter96.getValue().size()));
-                  for (Mutation _iter97 : _iter96.getValue())
+                  oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, _iter101.getValue().size()));
+                  for (Mutation _iter102 : _iter101.getValue())
                   {
-                    _iter97.write(oprot);
+                    _iter102.write(oprot);
                   }
                   oprot.writeListEnd();
                 }
@@ -20335,25 +20335,25 @@ public class Cassandra {
           case 0: // SUCCESS
             if (field.type == org.apache.thrift.protocol.TType.MAP) {
               {
-                org.apache.thrift.protocol.TMap _map98 = iprot.readMapBegin();
-                this.success = new HashMap<String,List<String>>(2*_map98.size);
-                for (int _i99 = 0; _i99 < _map98.size; ++_i99)
+                org.apache.thrift.protocol.TMap _map103 = iprot.readMapBegin();
+                this.success = new HashMap<String,List<String>>(2*_map103.size);
+                for (int _i104 = 0; _i104 < _map103.size; ++_i104)
                 {
-                  String _key100;
-                  List<String> _val101;
-                  _key100 = iprot.readString();
+                  String _key105;
+                  List<String> _val106;
+                  _key105 = iprot.readString();
                   {
-                    org.apache.thrift.protocol.TList _list102 = iprot.readListBegin();
-                    _val101 = new ArrayList<String>(_list102.size);
-                    for (int _i103 = 0; _i103 < _list102.size; ++_i103)
+                    org.apache.thrift.protocol.TList _list107 = iprot.readListBegin();
+                    _val106 = new ArrayList<String>(_list107.size);
+                    for (int _i108 = 0; _i108 < _list107.size; ++_i108)
                     {
-                      String _elem104;
-                      _elem104 = iprot.readString();
-                      _val101.add(_elem104);
+                      String _elem109;
+                      _elem109 = iprot.readString();
+                      _val106.add(_elem109);
                     }
                     iprot.readListEnd();
                   }
-                  this.success.put(_key100, _val101);
+                  this.success.put(_key105, _val106);
                 }
                 iprot.readMapEnd();
               }
@@ -20387,14 +20387,14 @@ public class Cassandra {
         oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
         {
           oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.LIST, this.success.size()));
-          for (Map.Entry<String, List<String>> _iter105 : this.success.entrySet())
+          for (Map.Entry<String, List<String>> _iter110 : this.success.entrySet())
           {
-            oprot.writeString(_iter105.getKey());
+            oprot.writeString(_iter110.getKey());
             {
-              oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, _iter105.getValue().size()));
-              for (String _iter106 : _iter105.getValue())
+              oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, _iter110.getValue().size()));
+              for (String _iter111 : _iter110.getValue())
               {
-                oprot.writeString(_iter106);
+                oprot.writeString(_iter111);
               }
               oprot.writeListEnd();
             }
@@ -20961,14 +20961,14 @@ public class Cassandra {
           case 0: // SUCCESS
             if (field.type == org.apache.thrift.protocol.TType.LIST) {
               {
-                org.apache.thrift.protocol.TList _list107 = iprot.readListBegin();
-                this.success = new ArrayList<KsDef>(_list107.size);
-                for (int _i108 = 0; _i108 < _list107.size; ++_i108)
+                org.apache.thrift.protocol.TList _list112 = iprot.readListBegin();
+                this.success = new ArrayList<KsDef>(_list112.size);
+                for (int _i113 = 0; _i113 < _list112.size; ++_i113)
                 {
-                  KsDef _elem109;
-                  _elem109 = new KsDef();
-                  _elem109.read(iprot);
-                  this.success.add(_elem109);
+                  KsDef _elem114;
+                  _elem114 = new KsDef();
+                  _elem114.read(iprot);
+                  this.success.add(_elem114);
                 }
                 iprot.readListEnd();
               }
@@ -21002,9 +21002,9 @@ public class Cassandra {
         oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
         {
           oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.success.size()));
-          for (KsDef _iter110 : this.success)
+          for (KsDef _iter115 : this.success)
           {
-            _iter110.write(oprot);
+            _iter115.write(oprot);
           }
           oprot.writeListEnd();
         }
@@ -22621,14 +22621,14 @@ public class Cassandra {
           case 0: // SUCCESS
             if (field.type == org.apache.thrift.protocol.TType.LIST) {
               {
-                org.apache.thrift.protocol.TList _list111 = iprot.readListBegin();
-                this.success = new ArrayList<TokenRange>(_list111.size);
-                for (int _i112 = 0; _i112 < _list111.size; ++_i112)
+                org.apache.thrift.protocol.TList _list116 = iprot.readListBegin();
+                this.success = new ArrayList<TokenRange>(_list116.size);
+                for (int _i117 = 0; _i117 < _list116.size; ++_i117)
                 {
-                  TokenRange _elem113;
-                  _elem113 = new TokenRange();
-                  _elem113.read(iprot);
-                  this.success.add(_elem113);
+                  TokenRange _elem118;
+                  _elem118 = new TokenRange();
+                  _elem118.read(iprot);
+                  this.success.add(_elem118);
                 }
                 iprot.readListEnd();
               }
@@ -22662,9 +22662,9 @@ public class Cassandra {
         oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
         {
           oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.success.size()));
-          for (TokenRange _iter114 : this.success)
+          for (TokenRange _iter119 : this.success)
           {
-            _iter114.write(oprot);
+            _iter119.write(oprot);
           }
           oprot.writeListEnd();
         }
@@ -25338,13 +25338,13 @@ public class Cassandra {
           case 0: // SUCCESS
             if (field.type == org.apache.thrift.protocol.TType.LIST) {
               {
-                org.apache.thrift.protocol.TList _list115 = iprot.readListBegin();
-                this.success = new ArrayList<String>(_list115.size);
-                for (int _i116 = 0; _i116 < _list115.size; ++_i116)
+                org.apache.thrift.protocol.TList _list120 = iprot.readListBegin();
+                this.success = new ArrayList<String>(_list120.size);
+                for (int _i121 = 0; _i121 < _list120.size; ++_i121)
                 {
-                  String _elem117;
-                  _elem117 = iprot.readString();
-                  this.success.add(_elem117);
+                  String _elem122;
+                  _elem122 = iprot.readString();
+                  this.success.add(_elem122);
                 }
                 iprot.readListEnd();
               }
@@ -25378,9 +25378,9 @@ public class Cassandra {
         oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
         {
           oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, this.success.size()));
-          for (String _iter118 : this.success)
+          for (String _iter123 : this.success)
           {
-            oprot.writeString(_iter118);
+            oprot.writeString(_iter123);
           }
           oprot.writeListEnd();
         }

Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/CfDef.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/CfDef.java?rev=1134460&r1=1134459&r2=1134460&view=diff
==============================================================================
--- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/CfDef.java (original)
+++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/CfDef.java Fri Jun 10 22:13:54 2011
@@ -70,6 +70,8 @@ public class CfDef implements org.apache
   private static final org.apache.thrift.protocol.TField KEY_VALIDATION_CLASS_FIELD_DESC = new org.apache.thrift.protocol.TField("key_validation_class", org.apache.thrift.protocol.TType.STRING, (short)26);
   private static final org.apache.thrift.protocol.TField ROW_CACHE_PROVIDER_FIELD_DESC = new org.apache.thrift.protocol.TField("row_cache_provider", org.apache.thrift.protocol.TType.STRING, (short)27);
   private static final org.apache.thrift.protocol.TField KEY_ALIAS_FIELD_DESC = new org.apache.thrift.protocol.TField("key_alias", org.apache.thrift.protocol.TType.STRING, (short)28);
+  private static final org.apache.thrift.protocol.TField COMPACTION_STRATEGY_FIELD_DESC = new org.apache.thrift.protocol.TField("compaction_strategy", org.apache.thrift.protocol.TType.STRING, (short)29);
+  private static final org.apache.thrift.protocol.TField COMPACTION_STRATEGY_OPTIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("compaction_strategy_options", org.apache.thrift.protocol.TType.MAP, (short)30);
 
   public String keyspace;
   public String name;
@@ -96,6 +98,8 @@ public class CfDef implements org.apache
   public String key_validation_class;
   public String row_cache_provider;
   public ByteBuffer key_alias;
+  public String compaction_strategy;
+  public Map<String,String> compaction_strategy_options;
 
   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
@@ -123,7 +127,9 @@ public class CfDef implements org.apache
     MERGE_SHARDS_CHANCE((short)25, "merge_shards_chance"),
     KEY_VALIDATION_CLASS((short)26, "key_validation_class"),
     ROW_CACHE_PROVIDER((short)27, "row_cache_provider"),
-    KEY_ALIAS((short)28, "key_alias");
+    KEY_ALIAS((short)28, "key_alias"),
+    COMPACTION_STRATEGY((short)29, "compaction_strategy"),
+    COMPACTION_STRATEGY_OPTIONS((short)30, "compaction_strategy_options");
 
     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 
@@ -188,6 +194,10 @@ public class CfDef implements org.apache
           return ROW_CACHE_PROVIDER;
         case 28: // KEY_ALIAS
           return KEY_ALIAS;
+        case 29: // COMPACTION_STRATEGY
+          return COMPACTION_STRATEGY;
+        case 30: // COMPACTION_STRATEGY_OPTIONS
+          return COMPACTION_STRATEGY_OPTIONS;
         default:
           return null;
       }
@@ -298,6 +308,12 @@ public class CfDef implements org.apache
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
     tmpMap.put(_Fields.KEY_ALIAS, new org.apache.thrift.meta_data.FieldMetaData("key_alias", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , true)));
+    tmpMap.put(_Fields.COMPACTION_STRATEGY, new org.apache.thrift.meta_data.FieldMetaData("compaction_strategy", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.COMPACTION_STRATEGY_OPTIONS, new org.apache.thrift.meta_data.FieldMetaData("compaction_strategy_options", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
+            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING), 
+            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
     metaDataMap = Collections.unmodifiableMap(tmpMap);
     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CfDef.class, metaDataMap);
   }
@@ -384,6 +400,24 @@ public class CfDef implements org.apache
       this.key_alias = org.apache.thrift.TBaseHelper.copyBinary(other.key_alias);
 ;
     }
+    if (other.isSetCompaction_strategy()) {
+      this.compaction_strategy = other.compaction_strategy;
+    }
+    if (other.isSetCompaction_strategy_options()) {
+      Map<String,String> __this__compaction_strategy_options = new HashMap<String,String>();
+      for (Map.Entry<String, String> other_element : other.compaction_strategy_options.entrySet()) {
+
+        String other_element_key = other_element.getKey();
+        String other_element_value = other_element.getValue();
+
+        String __this__compaction_strategy_options_copy_key = other_element_key;
+
+        String __this__compaction_strategy_options_copy_value = other_element_value;
+
+        __this__compaction_strategy_options.put(__this__compaction_strategy_options_copy_key, __this__compaction_strategy_options_copy_value);
+      }
+      this.compaction_strategy_options = __this__compaction_strategy_options;
+    }
   }
 
   public CfDef deepCopy() {
@@ -434,6 +468,8 @@ public class CfDef implements org.apache
     this.row_cache_provider = "org.apache.cassandra.cache.ConcurrentLinkedHashCacheProvider";
 
     this.key_alias = null;
+    this.compaction_strategy = null;
+    this.compaction_strategy_options = null;
   }
 
   public String getKeyspace() {
@@ -1047,6 +1083,65 @@ public class CfDef implements org.apache
     }
   }
 
+  public String getCompaction_strategy() {
+    return this.compaction_strategy;
+  }
+
+  public CfDef setCompaction_strategy(String compaction_strategy) {
+    this.compaction_strategy = compaction_strategy;
+    return this;
+  }
+
+  public void unsetCompaction_strategy() {
+    this.compaction_strategy = null;
+  }
+
+  /** Returns true if field compaction_strategy is set (has been assigned a value) and false otherwise */
+  public boolean isSetCompaction_strategy() {
+    return this.compaction_strategy != null;
+  }
+
+  public void setCompaction_strategyIsSet(boolean value) {
+    if (!value) {
+      this.compaction_strategy = null;
+    }
+  }
+
+  public int getCompaction_strategy_optionsSize() {
+    return (this.compaction_strategy_options == null) ? 0 : this.compaction_strategy_options.size();
+  }
+
+  public void putToCompaction_strategy_options(String key, String val) {
+    if (this.compaction_strategy_options == null) {
+      this.compaction_strategy_options = new HashMap<String,String>();
+    }
+    this.compaction_strategy_options.put(key, val);
+  }
+
+  public Map<String,String> getCompaction_strategy_options() {
+    return this.compaction_strategy_options;
+  }
+
+  public CfDef setCompaction_strategy_options(Map<String,String> compaction_strategy_options) {
+    this.compaction_strategy_options = compaction_strategy_options;
+    return this;
+  }
+
+  public void unsetCompaction_strategy_options() {
+    this.compaction_strategy_options = null;
+  }
+
+  /** Returns true if field compaction_strategy_options is set (has been assigned a value) and false otherwise */
+  public boolean isSetCompaction_strategy_options() {
+    return this.compaction_strategy_options != null;
+  }
+
+  public void setCompaction_strategy_optionsIsSet(boolean value) {
+    if (!value) {
+      this.compaction_strategy_options = null;
+    }
+  }
+
   public void setFieldValue(_Fields field, Object value) {
     switch (field) {
     case KEYSPACE:
@@ -1249,6 +1344,22 @@ public class CfDef implements org.apache
       }
       break;
 
+    case COMPACTION_STRATEGY:
+      if (value == null) {
+        unsetCompaction_strategy();
+      } else {
+        setCompaction_strategy((String)value);
+      }
+      break;
+
+    case COMPACTION_STRATEGY_OPTIONS:
+      if (value == null) {
+        unsetCompaction_strategy_options();
+      } else {
+        setCompaction_strategy_options((Map<String,String>)value);
+      }
+      break;
+
     }
   }
 
@@ -1329,6 +1440,12 @@ public class CfDef implements org.apache
     case KEY_ALIAS:
       return getKey_alias();
 
+    case COMPACTION_STRATEGY:
+      return getCompaction_strategy();
+
+    case COMPACTION_STRATEGY_OPTIONS:
+      return getCompaction_strategy_options();
+
     }
     throw new IllegalStateException();
   }
@@ -1390,6 +1507,10 @@ public class CfDef implements org.apache
       return isSetRow_cache_provider();
     case KEY_ALIAS:
       return isSetKey_alias();
+    case COMPACTION_STRATEGY:
+      return isSetCompaction_strategy();
+    case COMPACTION_STRATEGY_OPTIONS:
+      return isSetCompaction_strategy_options();
     }
     throw new IllegalStateException();
   }
@@ -1632,6 +1753,24 @@ public class CfDef implements org.apache
         return false;
     }
 
+    boolean this_present_compaction_strategy = true && this.isSetCompaction_strategy();
+    boolean that_present_compaction_strategy = true && that.isSetCompaction_strategy();
+    if (this_present_compaction_strategy || that_present_compaction_strategy) {
+      if (!(this_present_compaction_strategy && that_present_compaction_strategy))
+        return false;
+      if (!this.compaction_strategy.equals(that.compaction_strategy))
+        return false;
+    }
+
+    boolean this_present_compaction_strategy_options = true && this.isSetCompaction_strategy_options();
+    boolean that_present_compaction_strategy_options = true && that.isSetCompaction_strategy_options();
+    if (this_present_compaction_strategy_options || that_present_compaction_strategy_options) {
+      if (!(this_present_compaction_strategy_options && that_present_compaction_strategy_options))
+        return false;
+      if (!this.compaction_strategy_options.equals(that.compaction_strategy_options))
+        return false;
+    }
+
     return true;
   }
 
@@ -1764,6 +1903,16 @@ public class CfDef implements org.apache
     if (present_key_alias)
       builder.append(key_alias);
 
+    boolean present_compaction_strategy = true && (isSetCompaction_strategy());
+    builder.append(present_compaction_strategy);
+    if (present_compaction_strategy)
+      builder.append(compaction_strategy);
+
+    boolean present_compaction_strategy_options = true && (isSetCompaction_strategy_options());
+    builder.append(present_compaction_strategy_options);
+    if (present_compaction_strategy_options)
+      builder.append(compaction_strategy_options);
+
     return builder.toHashCode();
   }
 
@@ -2025,6 +2174,26 @@ public class CfDef implements org.apache
         return lastComparison;
       }
     }
+    lastComparison = Boolean.valueOf(isSetCompaction_strategy()).compareTo(typedOther.isSetCompaction_strategy());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetCompaction_strategy()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.compaction_strategy, typedOther.compaction_strategy);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetCompaction_strategy_options()).compareTo(typedOther.isSetCompaction_strategy_options());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetCompaction_strategy_options()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.compaction_strategy_options, typedOther.compaction_strategy_options);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
     return 0;
   }
 
@@ -2242,6 +2411,32 @@ public class CfDef implements org.apache
             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
           }
           break;
+        case 29: // COMPACTION_STRATEGY
+          if (field.type == org.apache.thrift.protocol.TType.STRING) {
+            this.compaction_strategy = iprot.readString();
+          } else { 
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
+          }
+          break;
+        case 30: // COMPACTION_STRATEGY_OPTIONS
+          if (field.type == org.apache.thrift.protocol.TType.MAP) {
+            {
+              org.apache.thrift.protocol.TMap _map32 = iprot.readMapBegin();
+              this.compaction_strategy_options = new HashMap<String,String>(2*_map32.size);
+              for (int _i33 = 0; _i33 < _map32.size; ++_i33)
+              {
+                String _key34;
+                String _val35;
+                _key34 = iprot.readString();
+                _val35 = iprot.readString();
+                this.compaction_strategy_options.put(_key34, _val35);
+              }
+              iprot.readMapEnd();
+            }
+          } else { 
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
+          }
+          break;
         default:
           org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
       }
@@ -2315,9 +2510,9 @@ public class CfDef implements org.apache
         oprot.writeFieldBegin(COLUMN_METADATA_FIELD_DESC);
         {
           oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.column_metadata.size()));
-          for (ColumnDef _iter32 : this.column_metadata)
+          for (ColumnDef _iter36 : this.column_metadata)
           {
-            _iter32.write(oprot);
+            _iter36.write(oprot);
           }
           oprot.writeListEnd();
         }
@@ -2407,6 +2602,28 @@ public class CfDef implements org.apache
         oprot.writeFieldEnd();
       }
     }
+    if (this.compaction_strategy != null) {
+      if (isSetCompaction_strategy()) {
+        oprot.writeFieldBegin(COMPACTION_STRATEGY_FIELD_DESC);
+        oprot.writeString(this.compaction_strategy);
+        oprot.writeFieldEnd();
+      }
+    }
+    if (this.compaction_strategy_options != null) {
+      if (isSetCompaction_strategy_options()) {
+        oprot.writeFieldBegin(COMPACTION_STRATEGY_OPTIONS_FIELD_DESC);
+        {
+          oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, this.compaction_strategy_options.size()));
+          for (Map.Entry<String, String> _iter37 : this.compaction_strategy_options.entrySet())
+          {
+            oprot.writeString(_iter37.getKey());
+            oprot.writeString(_iter37.getValue());
+          }
+          oprot.writeMapEnd();
+        }
+        oprot.writeFieldEnd();
+      }
+    }
     oprot.writeFieldStop();
     oprot.writeStructEnd();
   }
@@ -2605,6 +2822,26 @@ public class CfDef implements org.apache
       }
       first = false;
     }
+    if (isSetCompaction_strategy()) {
+      if (!first) sb.append(", ");
+      sb.append("compaction_strategy:");
+      if (this.compaction_strategy == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.compaction_strategy);
+      }
+      first = false;
+    }
+    if (isSetCompaction_strategy_options()) {
+      if (!first) sb.append(", ");
+      sb.append("compaction_strategy_options:");
+      if (this.compaction_strategy_options == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.compaction_strategy_options);
+      }
+      first = false;
+    }
     sb.append(")");
     return sb.toString();
   }

Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlResult.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlResult.java?rev=1134460&r1=1134459&r2=1134460&view=diff
==============================================================================
--- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlResult.java (original)
+++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlResult.java Fri Jun 10 22:13:54 2011
@@ -469,14 +469,14 @@ public class CqlResult implements org.ap
         case 2: // ROWS
           if (field.type == org.apache.thrift.protocol.TType.LIST) {
             {
-              org.apache.thrift.protocol.TList _list46 = iprot.readListBegin();
-              this.rows = new ArrayList<CqlRow>(_list46.size);
-              for (int _i47 = 0; _i47 < _list46.size; ++_i47)
+              org.apache.thrift.protocol.TList _list51 = iprot.readListBegin();
+              this.rows = new ArrayList<CqlRow>(_list51.size);
+              for (int _i52 = 0; _i52 < _list51.size; ++_i52)
               {
-                CqlRow _elem48;
-                _elem48 = new CqlRow();
-                _elem48.read(iprot);
-                this.rows.add(_elem48);
+                CqlRow _elem53;
+                _elem53 = new CqlRow();
+                _elem53.read(iprot);
+                this.rows.add(_elem53);
               }
               iprot.readListEnd();
             }
@@ -517,9 +517,9 @@ public class CqlResult implements org.ap
         oprot.writeFieldBegin(ROWS_FIELD_DESC);
         {
           oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.rows.size()));
-          for (CqlRow _iter49 : this.rows)
+          for (CqlRow _iter54 : this.rows)
           {
-            _iter49.write(oprot);
+            _iter54.write(oprot);
           }
           oprot.writeListEnd();
         }

Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlRow.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlRow.java?rev=1134460&r1=1134459&r2=1134460&view=diff
==============================================================================
--- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlRow.java (original)
+++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlRow.java Fri Jun 10 22:13:54 2011
@@ -395,14 +395,14 @@ public class CqlRow implements org.apach
         case 2: // COLUMNS
           if (field.type == org.apache.thrift.protocol.TType.LIST) {
             {
-              org.apache.thrift.protocol.TList _list42 = iprot.readListBegin();
-              this.columns = new ArrayList<Column>(_list42.size);
-              for (int _i43 = 0; _i43 < _list42.size; ++_i43)
+              org.apache.thrift.protocol.TList _list47 = iprot.readListBegin();
+              this.columns = new ArrayList<Column>(_list47.size);
+              for (int _i48 = 0; _i48 < _list47.size; ++_i48)
               {
-                Column _elem44;
-                _elem44 = new Column();
-                _elem44.read(iprot);
-                this.columns.add(_elem44);
+                Column _elem49;
+                _elem49 = new Column();
+                _elem49.read(iprot);
+                this.columns.add(_elem49);
               }
               iprot.readListEnd();
             }
@@ -434,9 +434,9 @@ public class CqlRow implements org.apach
       oprot.writeFieldBegin(COLUMNS_FIELD_DESC);
       {
         oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.columns.size()));
-        for (Column _iter45 : this.columns)
+        for (Column _iter50 : this.columns)
         {
-          _iter45.write(oprot);
+          _iter50.write(oprot);
         }
         oprot.writeListEnd();
       }

Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/KsDef.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/KsDef.java?rev=1134460&r1=1134459&r2=1134460&view=diff
==============================================================================
--- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/KsDef.java (original)
+++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/KsDef.java Fri Jun 10 22:13:54 2011
@@ -718,15 +718,15 @@ public class KsDef implements org.apache
         case 3: // STRATEGY_OPTIONS
           if (field.type == org.apache.thrift.protocol.TType.MAP) {
             {
-              org.apache.thrift.protocol.TMap _map33 = iprot.readMapBegin();
-              this.strategy_options = new HashMap<String,String>(2*_map33.size);
-              for (int _i34 = 0; _i34 < _map33.size; ++_i34)
+              org.apache.thrift.protocol.TMap _map38 = iprot.readMapBegin();
+              this.strategy_options = new HashMap<String,String>(2*_map38.size);
+              for (int _i39 = 0; _i39 < _map38.size; ++_i39)
               {
-                String _key35;
-                String _val36;
-                _key35 = iprot.readString();
-                _val36 = iprot.readString();
-                this.strategy_options.put(_key35, _val36);
+                String _key40;
+                String _val41;
+                _key40 = iprot.readString();
+                _val41 = iprot.readString();
+                this.strategy_options.put(_key40, _val41);
               }
               iprot.readMapEnd();
             }
@@ -745,14 +745,14 @@ public class KsDef implements org.apache
         case 5: // CF_DEFS
           if (field.type == org.apache.thrift.protocol.TType.LIST) {
             {
-              org.apache.thrift.protocol.TList _list37 = iprot.readListBegin();
-              this.cf_defs = new ArrayList<CfDef>(_list37.size);
-              for (int _i38 = 0; _i38 < _list37.size; ++_i38)
+              org.apache.thrift.protocol.TList _list42 = iprot.readListBegin();
+              this.cf_defs = new ArrayList<CfDef>(_list42.size);
+              for (int _i43 = 0; _i43 < _list42.size; ++_i43)
               {
-                CfDef _elem39;
-                _elem39 = new CfDef();
-                _elem39.read(iprot);
-                this.cf_defs.add(_elem39);
+                CfDef _elem44;
+                _elem44 = new CfDef();
+                _elem44.read(iprot);
+                this.cf_defs.add(_elem44);
               }
               iprot.readListEnd();
             }
@@ -798,10 +798,10 @@ public class KsDef implements org.apache
         oprot.writeFieldBegin(STRATEGY_OPTIONS_FIELD_DESC);
         {
           oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, this.strategy_options.size()));
-          for (Map.Entry<String, String> _iter40 : this.strategy_options.entrySet())
+          for (Map.Entry<String, String> _iter45 : this.strategy_options.entrySet())
           {
-            oprot.writeString(_iter40.getKey());
-            oprot.writeString(_iter40.getValue());
+            oprot.writeString(_iter45.getKey());
+            oprot.writeString(_iter45.getValue());
           }
           oprot.writeMapEnd();
         }
@@ -817,9 +817,9 @@ public class KsDef implements org.apache
       oprot.writeFieldBegin(CF_DEFS_FIELD_DESC);
       {
         oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.cf_defs.size()));
-        for (CfDef _iter41 : this.cf_defs)
+        for (CfDef _iter46 : this.cf_defs)
         {
-          _iter41.write(oprot);
+          _iter46.write(oprot);
         }
         oprot.writeListEnd();
       }

Modified: cassandra/trunk/src/avro/internode.genavro
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/avro/internode.genavro?rev=1134460&r1=1134459&r2=1134460&view=diff
==============================================================================
--- cassandra/trunk/src/avro/internode.genavro (original)
+++ cassandra/trunk/src/avro/internode.genavro Fri Jun 10 22:13:54 2011
@@ -65,6 +65,8 @@ protocol InterNode {
         union { array<ColumnDef>, null } column_metadata;
         union { string, null } row_cache_provider = "org.apache.cassandra.cache.ConcurrentLinkedHashCacheProvider";
         union { null, bytes } key_alias = null;
+        union { null, string } compaction_strategy = null;
+        union { null, map<string> } compaction_strategy_options = null;
     }
 
     @aliases(["org.apache.cassandra.config.avro.KsDef"])

Modified: cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java?rev=1134460&r1=1134459&r2=1134460&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java Fri Jun 10 22:13:54 2011
@@ -132,7 +132,9 @@ public class CliClient
         MAX_COMPACTION_THRESHOLD,
         REPLICATE_ON_WRITE,
         ROW_CACHE_PROVIDER,
-        KEY_VALIDATION_CLASS
+        KEY_VALIDATION_CLASS,
+        COMPACTION_STRATEGY,
+        COMPACTION_STRATEGY_OPTIONS
     }
 
     private static final String DEFAULT_PLACEMENT_STRATEGY = "org.apache.cassandra.locator.NetworkTopologyStrategy";
@@ -1210,6 +1212,11 @@ public class CliClient
                 break;
             case KEY_VALIDATION_CLASS:
                 cfDef.setKey_validation_class(CliUtils.unescapeSQLString(mValue));
+            case COMPACTION_STRATEGY:
+                cfDef.setCompaction_strategy(CliUtils.unescapeSQLString(mValue));
+                break;
+            case COMPACTION_STRATEGY_OPTIONS:
+                cfDef.setCompaction_strategy_options(getStrategyOptionsFromTree(statement.getChild(i+1)));
                 break;
             default:
                 //must match one of the above or we'd throw an exception at the valueOf statement above.
@@ -1725,6 +1732,13 @@ public class CliClient
                         }
                     }
                 }
+                sessionState.out.printf("      Compaction Strategy: %s%n", cf_def.compaction_strategy);
+                if (!cf_def.compaction_strategy_options.isEmpty())
+                {
+                    sessionState.out.printf("      Compaction Strategy Options: %s%n", cf_def.compaction_strategy);
+                    for (Map.Entry<String, String> e : cf_def.compaction_strategy_options.entrySet())
+                        sessionState.out.printf("        %s: %s%n", e.getKey(), e.getValue());
+                }
             }
 
             // compaction manager information

Modified: cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java?rev=1134460&r1=1134459&r2=1134460&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java Fri Jun 10 22:13:54 2011
@@ -36,16 +36,30 @@ import org.apache.cassandra.db.ColumnFam
 import org.apache.cassandra.db.HintedHandOffManager;
 import org.apache.cassandra.db.SystemTable;
 import org.apache.cassandra.db.Table;
+import org.apache.cassandra.db.ColumnFamilyStore;
+import org.apache.cassandra.db.marshal.AbstractType;
+import org.apache.cassandra.db.marshal.BytesType;
+import org.apache.cassandra.db.marshal.TimeUUIDType;
+import org.apache.cassandra.db.marshal.UTF8Type;
 import org.apache.cassandra.db.migration.Migration;
+import org.apache.cassandra.db.compaction.AbstractCompactionStrategy;
 import org.apache.cassandra.io.SerDeUtils;
 import org.apache.cassandra.thrift.InvalidRequestException;
 import org.apache.cassandra.utils.ByteBufferUtil;
 import org.apache.cassandra.utils.FBUtilities;
 import org.apache.cassandra.utils.Pair;
 
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
 
 public final class CFMetaData
 {
+    //
+    // !! Important !!
+    // This class can be tricky to modify.  Please read http://wiki.apache.org/cassandra/ConfigurationNotes
+    // for how to do so safely.
+    //
+
     public final static double DEFAULT_ROW_CACHE_SIZE = 0.0;
     public final static double DEFAULT_KEY_CACHE_SIZE = 200000;
     public final static double DEFAULT_READ_REPAIR_CHANCE = 1.0;
@@ -61,7 +75,8 @@ public final class CFMetaData
     public final static double DEFAULT_MEMTABLE_OPERATIONS_IN_MILLIONS = sizeMemtableOperations(DEFAULT_MEMTABLE_THROUGHPUT_IN_MB);
     public final static double DEFAULT_MERGE_SHARDS_CHANCE = 0.1;
     public final static String DEFAULT_ROW_CACHE_PROVIDER = "org.apache.cassandra.cache.ConcurrentLinkedHashCacheProvider";
-    
+    public static final String DEFAULT_COMPACTION_STRATEGY_CLASS = "org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy";
+
     private static final int MIN_CF_ID = 1000;
     private static final AtomicInteger idGen = new AtomicInteger(MIN_CF_ID);
     
@@ -153,9 +168,10 @@ public final class CFMetaData
     private double mergeShardsChance;                 // default 0.1, chance [0.0, 1.0] of merging old shards during replication
     private IRowCacheProvider rowCacheProvider;
     private ByteBuffer keyAlias;                      // default NULL
-    // NOTE: if you find yourself adding members to this class, make sure you keep the convert methods in lockstep.
 
     private Map<ByteBuffer, ColumnDefinition> column_metadata;
+    public Class<? extends AbstractCompactionStrategy> compactionStrategyClass;
+    public Map<String, String> compactionStrategyOptions;
 
     public CFMetaData comment(String prop) { comment = enforceCommentNotNull(prop); return this;}
     public CFMetaData rowCacheSize(double prop) {rowCacheSize = prop; return this;}
@@ -176,6 +192,8 @@ public final class CFMetaData
     public CFMetaData keyAlias(ByteBuffer prop) {keyAlias = prop; return this;}
     public CFMetaData columnMetadata(Map<ByteBuffer,ColumnDefinition> prop) {column_metadata = prop; return this;}
     public CFMetaData rowCacheProvider(IRowCacheProvider prop) { rowCacheProvider = prop; return this;}
+    public CFMetaData compactionStrategyClass(Class<? extends AbstractCompactionStrategy> prop) {compactionStrategyClass = prop; return this;}
+    public CFMetaData compactionStrategyOptions(Map<String, String> prop) {compactionStrategyOptions = prop; return this;}
 
     public CFMetaData(String keyspace, String name, ColumnFamilyType type, AbstractType comp, AbstractType subcc)
     {
@@ -237,6 +255,16 @@ public final class CFMetaData
         comment = "";
         keyAlias = null; // This qualifies as a 'strange default'.
         column_metadata = new HashMap<ByteBuffer,ColumnDefinition>();
+
+        try
+        {
+            compactionStrategyClass = (Class<? extends AbstractCompactionStrategy>)Class.forName(DEFAULT_COMPACTION_STRATEGY_CLASS);
+        }
+        catch (Exception e)
+        {
+            throw new RuntimeException("Could not create Compaction Strategy of type " + DEFAULT_COMPACTION_STRATEGY_CLASS, e);
+        }
+        compactionStrategyOptions = new HashMap<String, String>();
     }
 
     private static CFMetaData newSystemMetadata(String cfName, int cfId, String comment, AbstractType comparator, AbstractType subcc, int memtableThroughPutInMB)
@@ -296,7 +324,9 @@ public final class CFMetaData
                       .memTime(oldCFMD.memtableFlushAfterMins)
                       .memSize(oldCFMD.memtableThroughputInMb)
                       .memOps(oldCFMD.memtableOperationsInMillions)
-                      .columnMetadata(oldCFMD.column_metadata);
+                      .columnMetadata(oldCFMD.column_metadata)
+                      .compactionStrategyClass(oldCFMD.compactionStrategyClass)
+                      .compactionStrategyOptions(oldCFMD.compactionStrategyOptions);
     }
 
     /** used for evicting cf data out of static tracking collections. */
@@ -351,6 +381,13 @@ public final class CFMetaData
         for (ColumnDefinition cd : column_metadata.values())
             cf.column_metadata.add(cd.deflate());
         cf.row_cache_provider = new Utf8(rowCacheProvider.getClass().getName());
+        cf.compaction_strategy = new Utf8(compactionStrategyClass.getName());
+        if (compactionStrategyOptions != null)
+        {
+            cf.compaction_strategy_options = new HashMap<CharSequence, CharSequence>();
+            for (Map.Entry<String, String> e : compactionStrategyOptions.entrySet())
+                cf.compaction_strategy_options.put(new Utf8(e.getKey()), new Utf8(e.getValue()));
+        }
         return cf;
     }
 
@@ -413,6 +450,22 @@ public final class CFMetaData
             }
         }
         if (cf.key_alias != null) { newCFMD.keyAlias(cf.key_alias); }
+        if (cf.compaction_strategy != null)
+        {
+            try
+            {
+                newCFMD.compactionStrategyClass((Class<? extends AbstractCompactionStrategy>)Class.forName(cf.compaction_strategy.toString()));
+            }
+            catch (Exception e)
+            {
+                throw new RuntimeException("Could not create Compaction Strategy of type " + cf.compaction_strategy.toString(), e);
+            }
+        }
+        if (cf.compaction_strategy_options != null)
+        {
+            for (Map.Entry<CharSequence, CharSequence> e : cf.compaction_strategy_options.entrySet())
+                newCFMD.compactionStrategyOptions.put(e.getKey().toString(), e.getValue().toString());
+        }
 
         return newCFMD.comment(cf.comment.toString())
                       .rowCacheSize(cf.row_cache_size)
@@ -562,6 +615,8 @@ public final class CFMetaData
             .append(memtableOperationsInMillions, rhs.memtableOperationsInMillions)
             .append(mergeShardsChance, rhs.mergeShardsChance)
             .append(keyAlias, rhs.keyAlias)
+            .append(compactionStrategyClass, rhs.compactionStrategyClass)
+            .append(compactionStrategyOptions, rhs.compactionStrategyOptions)
             .isEquals();
     }
 
@@ -592,6 +647,8 @@ public final class CFMetaData
             .append(memtableOperationsInMillions)
             .append(mergeShardsChance)
             .append(keyAlias)
+            .append(compactionStrategyClass)
+            .append(compactionStrategyOptions)
             .toHashCode();
     }
 
@@ -632,6 +689,10 @@ public final class CFMetaData
             cf_def.setMerge_shards_chance(CFMetaData.DEFAULT_MERGE_SHARDS_CHANCE);
         if (!cf_def.isSetRow_cache_provider())
             cf_def.setRow_cache_provider(CFMetaData.DEFAULT_ROW_CACHE_PROVIDER);
+        if (null == cf_def.compaction_strategy)
+            cf_def.compaction_strategy = DEFAULT_COMPACTION_STRATEGY_CLASS;
+        if (null == cf_def.compaction_strategy_options)
+            cf_def.compaction_strategy_options = Collections.<String, String>emptyMap();
     }
 
     public static CFMetaData fromThrift(org.apache.cassandra.thrift.CfDef cf_def) throws InvalidRequestException, ConfigurationException
@@ -760,8 +821,56 @@ public final class CFMetaData
                                                        def.index_name == null ? null : def.index_name.toString());
             column_metadata.put(cd.name, cd);
         }
+
+        if (cf_def.compaction_strategy != null)
+        {
+            try
+            {
+                compactionStrategyClass = (Class<? extends AbstractCompactionStrategy>)Class.forName(cf_def.compaction_strategy.toString());
+            }
+            catch (Exception e)
+            {
+                throw new RuntimeException("Could not create Compaction Strategy of type " + cf_def.compaction_strategy.toString(), e);
+            }
+        }
+
+        if (null != cf_def.compaction_strategy_options)
+        {
+            for (Map.Entry<CharSequence, CharSequence> e : cf_def.compaction_strategy_options.entrySet())
+                compactionStrategyOptions.put(e.getKey().toString(), e.getValue().toString());
+        }
     }
     
+    public AbstractCompactionStrategy createCompactionStrategyInstance(ColumnFamilyStore cfs)
+    {
+        try
+        {
+            Constructor constructor = compactionStrategyClass.getConstructor(new Class[] {
+                ColumnFamilyStore.class,
+                Map.class // options
+            });
+            return (AbstractCompactionStrategy)constructor.newInstance(new Object[] {
+                cfs,
+                compactionStrategyOptions});
+        }
+        catch (NoSuchMethodException e)
+        {
+            throw new RuntimeException(e);
+        }
+        catch (InstantiationException e)
+        {
+            throw new RuntimeException(e);
+        }
+        catch (IllegalAccessException e)
+        {
+            throw new RuntimeException(e);
+        }
+        catch (InvocationTargetException e)
+        {
+            throw new RuntimeException(e);
+        }
+    }
+
     // converts CFM to thrift CfDef
     public static org.apache.cassandra.thrift.CfDef convertToThrift(CFMetaData cfm)
     {
@@ -802,6 +911,9 @@ public final class CFMetaData
             column_meta.add(tcd);
         }
         def.setColumn_metadata(column_meta);
+        def.setCompaction_strategy(cfm.compactionStrategyClass.getName());
+        Map<String, String> compactionOptions = new HashMap<String, String>();
+        def.setCompaction_strategy_options(cfm.compactionStrategyOptions);
         return def;
     }
     
@@ -848,6 +960,10 @@ public final class CFMetaData
         }
         def.column_metadata = column_meta; 
         def.row_cache_provider = new Utf8(cfm.rowCacheProvider.getClass().getName());
+        def.compaction_strategy = new Utf8(cfm.compactionStrategyClass.getName());
+        def.compaction_strategy_options = new HashMap<CharSequence, CharSequence>();
+        for (Map.Entry<String, String> e : cfm.compactionStrategyOptions.entrySet())
+            def.compaction_strategy_options.put(new Utf8(e.getKey()), new Utf8(e.getValue()));
         return def;
     }
     
@@ -892,6 +1008,15 @@ public final class CFMetaData
             }
         }
         newDef.column_metadata = columnMeta;
+        if (def.isSetCompaction_strategy())
+            newDef.compaction_strategy = new Utf8(def.getCompaction_strategy());
+
+        if (def.isSetCompaction_strategy_options() && null != def.getCompaction_strategy_options())
+        {
+            newDef.compaction_strategy_options = new HashMap<CharSequence, CharSequence>();
+            for (Map.Entry<String, String> e : def.getCompaction_strategy_options().entrySet())
+                newDef.compaction_strategy_options.put(new Utf8(e.getKey()), new Utf8(e.getValue()));
+        }
         return newDef;
     }
 
@@ -999,6 +1124,8 @@ public final class CFMetaData
             .append("mergeShardsChance", mergeShardsChance)
             .append("keyAlias", keyAlias)
             .append("column_metadata", column_metadata)
+            .append("compactionStrategyClass", compactionStrategyClass)
+            .append("compactionStrategyOptions", compactionStrategyOptions)
             .toString();
     }
 }

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java?rev=1134460&r1=1134459&r2=1134460&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java Fri Jun 10 22:13:54 2011
@@ -53,6 +53,7 @@ import org.apache.cassandra.config.Datab
 import org.apache.cassandra.db.columniterator.IColumnIterator;
 import org.apache.cassandra.db.commitlog.CommitLog;
 import org.apache.cassandra.db.commitlog.ReplayPosition;
+import org.apache.cassandra.db.compaction.AbstractCompactionStrategy;
 import org.apache.cassandra.db.compaction.CompactionManager;
 import org.apache.cassandra.db.filter.*;
 import org.apache.cassandra.db.marshal.AbstractType;
@@ -151,6 +152,7 @@ public class ColumnFamilyStore implement
     /* These are locally held copies to be changed from the config during runtime */
     private volatile DefaultInteger minCompactionThreshold;
     private volatile DefaultInteger maxCompactionThreshold;
+    private volatile AbstractCompactionStrategy compactionStrategy;
     private volatile DefaultInteger memtime;
     private volatile DefaultInteger memsize;
     private volatile DefaultDouble memops;
@@ -251,6 +253,7 @@ public class ColumnFamilyStore implement
         this.metadata = metadata;
         this.minCompactionThreshold = new DefaultInteger(metadata.getMinCompactionThreshold());
         this.maxCompactionThreshold = new DefaultInteger(metadata.getMaxCompactionThreshold());
+        this.compactionStrategy = metadata.createCompactionStrategyInstance(this);
         this.memtime = new DefaultInteger(metadata.getMemtableFlushAfterMins());
         this.memsize = new DefaultInteger(metadata.getMemtableThroughputInMb());
         this.memops = new DefaultDouble(metadata.getMemtableOperationsInMillions());
@@ -1925,6 +1928,12 @@ public class ColumnFamilyStore implement
        - get/set rowCacheSavePeriodInSeconds
        - get/set keyCacheSavePeriodInSeconds
      */
+
+    public AbstractCompactionStrategy getCompactionStrategy()
+    {
+        return compactionStrategy;
+    }
+
     public int getMinimumCompactionThreshold()
     {
         return minCompactionThreshold.value();
@@ -1953,6 +1962,11 @@ public class ColumnFamilyStore implement
         this.maxCompactionThreshold.set(maxCompactionThreshold);
     }
 
+    public boolean isCompactionDisabled()
+    {
+        return getMinimumCompactionThreshold() <= 0 || getMaximumCompactionThreshold() <= 0;
+    }
+
     public int getMemtableFlushAfterMins()
     {
         return memtime.value();

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/DataTracker.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/DataTracker.java?rev=1134460&r1=1134459&r2=1134460&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/DataTracker.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/DataTracker.java Fri Jun 10 22:13:54 2011
@@ -33,6 +33,7 @@ import org.slf4j.LoggerFactory;
 
 import org.apache.cassandra.cache.AutoSavingCache;
 import org.apache.cassandra.config.DatabaseDescriptor;
+import org.apache.cassandra.db.compaction.AbstractCompactionTask;
 import org.apache.cassandra.io.sstable.Descriptor;
 import org.apache.cassandra.io.sstable.SSTableReader;
 import org.apache.cassandra.utils.Pair;
@@ -189,6 +190,41 @@ public class DataTracker
         return subset;
     }
 
+    public boolean markCompacting(AbstractCompactionTask task)
+    {
+        ColumnFamilyStore cfs = task.getColumnFamilyStore();
+        return markCompacting(task, cfs.getMinimumCompactionThreshold(), cfs.getMaximumCompactionThreshold());
+    }
+
+    public boolean markCompacting(AbstractCompactionTask task, int min, int max)
+    {
+        Collection<SSTableReader> sstablesToMark = task.getSSTables();
+        if (sstablesToMark == null || sstablesToMark.isEmpty())
+            return false;
+
+        if (max < min || max < 1)
+            return false;
+
+        View currentView, newView;
+        // order preserving set copy of the input
+        Set<SSTableReader> remaining = new LinkedHashSet<SSTableReader>(sstablesToMark);
+        do
+        {
+            currentView = view.get();
+
+            // find the subset that is active and not already compacting
+            remaining.removeAll(currentView.compacting);
+            remaining.retainAll(currentView.sstables);
+            if (remaining.size() < min || remaining.size() > max)
+                // cannot meet the min and max threshold
+                return false;
+
+            newView = currentView.markCompacting(sstablesToMark);
+        }
+        while (!view.compareAndSet(currentView, newView));
+        return true;
+    }
+
     /**
      * Removes files from compacting status: this is different from 'markCompacted'
      * because it should be run regardless of whether a compaction succeeded.
@@ -204,6 +240,11 @@ public class DataTracker
         while (!view.compareAndSet(currentView, newView));
     }
 
+    public void unmarkCompacting(AbstractCompactionTask task)
+    {
+        unmarkCompacting(task.getSSTables());
+    }
+
     public void markCompacted(Collection<SSTableReader> sstables)
     {
         replace(sstables, Collections.<SSTableReader>emptyList());

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/HintedHandOffManager.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/HintedHandOffManager.java?rev=1134460&r1=1134459&r2=1134460&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/HintedHandOffManager.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/HintedHandOffManager.java Fri Jun 10 22:13:54 2011
@@ -226,7 +226,7 @@ public class HintedHandOffManager implem
                     logger_.info("Deleting any stored hints for " + ipaddr);
                     rm.apply();
                     hintStore.forceFlush();
-                    CompactionManager.instance.submitMajor(hintStore, 0, Integer.MAX_VALUE);
+                    CompactionManager.instance.submitMajor(hintStore, Integer.MAX_VALUE);
                 }
                 catch (Exception e)
                 {
@@ -365,7 +365,7 @@ public class HintedHandOffManager implem
             hintStore.forceFlush();
             try
             {
-                CompactionManager.instance.submitMajor(hintStore, 0, Integer.MAX_VALUE).get();
+                CompactionManager.instance.submitMajor(hintStore, Integer.MAX_VALUE).get();
             }
             catch (Exception e)
             {

Added: cassandra/trunk/src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java?rev=1134460&view=auto
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java (added)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java Fri Jun 10 22:13:54 2011
@@ -0,0 +1,82 @@
+/**
+ * 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.
+ */
+
+package org.apache.cassandra.db.compaction;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.cassandra.config.CFMetaData;
+import org.apache.cassandra.db.Table;
+import org.apache.cassandra.db.ColumnFamilyStore;
+import org.apache.cassandra.io.sstable.SSTableReader;
+import org.apache.cassandra.utils.DefaultInteger;
+import org.apache.cassandra.utils.Pair;
+
+
+/**
+ * Pluggable compaction strategy determines how SSTables get merged.
+ *
+ * There are two main goals:
+ *  - perform background compaction constantly as needed; this typically makes a tradeoff between
+ *    i/o done by compaction, and merging done at read time.
+ *  - perform a full (maximum possible) compaction if requested by the user
+ */
+public abstract class AbstractCompactionStrategy
+{
+    protected final ColumnFamilyStore cfs;
+    protected final Map<String, String> options;
+
+    protected AbstractCompactionStrategy(ColumnFamilyStore cfs, Map<String, String> options)
+    {
+        this.cfs = cfs;
+        this.options = options;
+    }
+
+    /**
+     * @return a list of compaction tasks that should run in the background to get the sstable
+     * count down to desired parameters. Will not be null, but may be empty.
+     * @param gcBefore throw away tombstones older than this
+     */
+    public abstract List<AbstractCompactionTask> getBackgroundTasks(final int gcBefore);
+
+    /**
+     * @return a list of compaction tasks that should be run to compact this columnfamilystore
+     * as much as possible.  Will not be null, but may be empty.
+     * @param gcBefore throw away tombstones older than this
+     */
+    public abstract List<AbstractCompactionTask> getMaximalTasks(final int gcBefore);
+
+    /**
+     * @return a compaction task corresponding to the requested sstables.
+     * Will not be null. (Will throw if user requests an invalid compaction.)
+     * @param gcBefore throw away tombstones older than this
+     */
+    public abstract AbstractCompactionTask getUserDefinedTask(Collection<SSTableReader> sstables, final int gcBefore);
+
+    /**
+     * @return the number of background tasks estimated to still be needed for this columnfamilystore
+     */
+    public abstract int getEstimatedRemainingTasks();
+}

Added: cassandra/trunk/src/java/org/apache/cassandra/db/compaction/AbstractCompactionTask.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/compaction/AbstractCompactionTask.java?rev=1134460&view=auto
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/compaction/AbstractCompactionTask.java (added)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/compaction/AbstractCompactionTask.java Fri Jun 10 22:13:54 2011
@@ -0,0 +1,50 @@
+/**
+ * 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.
+ */
+
+package org.apache.cassandra.db.compaction;
+
+import java.util.Collection;
+import java.io.IOException;
+
+import org.apache.cassandra.io.sstable.SSTableReader;
+import org.apache.cassandra.db.ColumnFamilyStore;
+import org.apache.cassandra.db.compaction.CompactionManager.CompactionExecutorStatsCollector;
+
+public abstract class AbstractCompactionTask
+{
+    protected ColumnFamilyStore cfs;
+    protected Collection<SSTableReader> sstables;
+
+    public AbstractCompactionTask(ColumnFamilyStore cfs, Collection<SSTableReader> sstables)
+    {
+        this.cfs = cfs;
+        this.sstables = sstables;
+    }
+
+    public abstract int execute(CompactionExecutorStatsCollector collector) throws IOException;
+
+    public ColumnFamilyStore getColumnFamilyStore()
+    {
+        return cfs;
+    }
+
+    public Collection<SSTableReader> getSSTables()
+    {
+        return sstables;
+    }
+}