cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject svn commit: r1090842 [3/3] - in /cassandra/trunk: interface/ interface/thrift/gen-java/org/apache/cassandra/thrift/ src/java/org/apache/cassandra/cli/ src/java/org/apache/cassandra/db/ src/java/org/apache/cassandra/thrift/ test/system/ tools/stress/src...
Date Sun, 10 Apr 2011 17:31:15 GMT
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=1090842&r1=1090841&r2=1090842&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 Sun Apr 10 17:31:15 2011
@@ -306,8 +306,6 @@ public class CfDef implements org.apache
 
     this.read_repair_chance = 1;
 
-    this.replicate_on_write = false;
-
     this.row_cache_provider = "org.apache.cassandra.cache.ConcurrentLinkedHashCacheProvider";
 
   }
@@ -417,8 +415,8 @@ public class CfDef implements org.apache
     this.memtable_throughput_in_mb = 0;
     setMemtable_operations_in_millionsIsSet(false);
     this.memtable_operations_in_millions = 0.0;
+    setReplicate_on_writeIsSet(false);
     this.replicate_on_write = false;
-
     setMerge_shards_chanceIsSet(false);
     this.merge_shards_chance = 0.0;
     this.key_validation_class = null;

Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnOrSuperColumn.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnOrSuperColumn.java?rev=1090842&r1=1090841&r2=1090842&view=diff
==============================================================================
--- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnOrSuperColumn.java (original)
+++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnOrSuperColumn.java Sun Apr 10 17:31:15 2011
@@ -49,22 +49,33 @@ import org.slf4j.LoggerFactory;
  * in Columns, those values will be in the attribute column. This change was made between 0.3 and 0.4 to standardize on
  * single query methods that may return either a SuperColumn or Column.
  * 
+ * If the query was on a counter column family, you will either get a counter_column (instead of a column) or a
+ * counter_super_column (instead of a super_column)
+ * 
  * @param column. The Column returned by get() or get_slice().
  * @param super_column. The SuperColumn returned by get() or get_slice().
+ * @param counter_column. The Counterolumn returned by get() or get_slice().
+ * @param counter_super_column. The CounterSuperColumn returned by get() or get_slice().
  */
 public class ColumnOrSuperColumn implements org.apache.thrift.TBase<ColumnOrSuperColumn, ColumnOrSuperColumn._Fields>, java.io.Serializable, Cloneable {
   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ColumnOrSuperColumn");
 
   private static final org.apache.thrift.protocol.TField COLUMN_FIELD_DESC = new org.apache.thrift.protocol.TField("column", org.apache.thrift.protocol.TType.STRUCT, (short)1);
   private static final org.apache.thrift.protocol.TField SUPER_COLUMN_FIELD_DESC = new org.apache.thrift.protocol.TField("super_column", org.apache.thrift.protocol.TType.STRUCT, (short)2);
+  private static final org.apache.thrift.protocol.TField COUNTER_COLUMN_FIELD_DESC = new org.apache.thrift.protocol.TField("counter_column", org.apache.thrift.protocol.TType.STRUCT, (short)3);
+  private static final org.apache.thrift.protocol.TField COUNTER_SUPER_COLUMN_FIELD_DESC = new org.apache.thrift.protocol.TField("counter_super_column", org.apache.thrift.protocol.TType.STRUCT, (short)4);
 
   public Column column;
   public SuperColumn super_column;
+  public CounterColumn counter_column;
+  public CounterSuperColumn counter_super_column;
 
   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
     COLUMN((short)1, "column"),
-    SUPER_COLUMN((short)2, "super_column");
+    SUPER_COLUMN((short)2, "super_column"),
+    COUNTER_COLUMN((short)3, "counter_column"),
+    COUNTER_SUPER_COLUMN((short)4, "counter_super_column");
 
     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 
@@ -83,6 +94,10 @@ public class ColumnOrSuperColumn impleme
           return COLUMN;
         case 2: // SUPER_COLUMN
           return SUPER_COLUMN;
+        case 3: // COUNTER_COLUMN
+          return COUNTER_COLUMN;
+        case 4: // COUNTER_SUPER_COLUMN
+          return COUNTER_SUPER_COLUMN;
         default:
           return null;
       }
@@ -131,6 +146,10 @@ public class ColumnOrSuperColumn impleme
         new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Column.class)));
     tmpMap.put(_Fields.SUPER_COLUMN, new org.apache.thrift.meta_data.FieldMetaData("super_column", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, SuperColumn.class)));
+    tmpMap.put(_Fields.COUNTER_COLUMN, new org.apache.thrift.meta_data.FieldMetaData("counter_column", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CounterColumn.class)));
+    tmpMap.put(_Fields.COUNTER_SUPER_COLUMN, new org.apache.thrift.meta_data.FieldMetaData("counter_super_column", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CounterSuperColumn.class)));
     metaDataMap = Collections.unmodifiableMap(tmpMap);
     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ColumnOrSuperColumn.class, metaDataMap);
   }
@@ -148,6 +167,12 @@ public class ColumnOrSuperColumn impleme
     if (other.isSetSuper_column()) {
       this.super_column = new SuperColumn(other.super_column);
     }
+    if (other.isSetCounter_column()) {
+      this.counter_column = new CounterColumn(other.counter_column);
+    }
+    if (other.isSetCounter_super_column()) {
+      this.counter_super_column = new CounterSuperColumn(other.counter_super_column);
+    }
   }
 
   public ColumnOrSuperColumn deepCopy() {
@@ -158,6 +183,8 @@ public class ColumnOrSuperColumn impleme
   public void clear() {
     this.column = null;
     this.super_column = null;
+    this.counter_column = null;
+    this.counter_super_column = null;
   }
 
   public Column getColumn() {
@@ -208,6 +235,54 @@ public class ColumnOrSuperColumn impleme
     }
   }
 
+  public CounterColumn getCounter_column() {
+    return this.counter_column;
+  }
+
+  public ColumnOrSuperColumn setCounter_column(CounterColumn counter_column) {
+    this.counter_column = counter_column;
+    return this;
+  }
+
+  public void unsetCounter_column() {
+    this.counter_column = null;
+  }
+
+  /** Returns true if field counter_column is set (has been assigned a value) and false otherwise */
+  public boolean isSetCounter_column() {
+    return this.counter_column != null;
+  }
+
+  public void setCounter_columnIsSet(boolean value) {
+    if (!value) {
+      this.counter_column = null;
+    }
+  }
+
+  public CounterSuperColumn getCounter_super_column() {
+    return this.counter_super_column;
+  }
+
+  public ColumnOrSuperColumn setCounter_super_column(CounterSuperColumn counter_super_column) {
+    this.counter_super_column = counter_super_column;
+    return this;
+  }
+
+  public void unsetCounter_super_column() {
+    this.counter_super_column = null;
+  }
+
+  /** Returns true if field counter_super_column is set (has been assigned a value) and false otherwise */
+  public boolean isSetCounter_super_column() {
+    return this.counter_super_column != null;
+  }
+
+  public void setCounter_super_columnIsSet(boolean value) {
+    if (!value) {
+      this.counter_super_column = null;
+    }
+  }
+
   public void setFieldValue(_Fields field, Object value) {
     switch (field) {
     case COLUMN:
@@ -226,6 +301,22 @@ public class ColumnOrSuperColumn impleme
       }
       break;
 
+    case COUNTER_COLUMN:
+      if (value == null) {
+        unsetCounter_column();
+      } else {
+        setCounter_column((CounterColumn)value);
+      }
+      break;
+
+    case COUNTER_SUPER_COLUMN:
+      if (value == null) {
+        unsetCounter_super_column();
+      } else {
+        setCounter_super_column((CounterSuperColumn)value);
+      }
+      break;
+
     }
   }
 
@@ -237,6 +328,12 @@ public class ColumnOrSuperColumn impleme
     case SUPER_COLUMN:
       return getSuper_column();
 
+    case COUNTER_COLUMN:
+      return getCounter_column();
+
+    case COUNTER_SUPER_COLUMN:
+      return getCounter_super_column();
+
     }
     throw new IllegalStateException();
   }
@@ -252,6 +349,10 @@ public class ColumnOrSuperColumn impleme
       return isSetColumn();
     case SUPER_COLUMN:
       return isSetSuper_column();
+    case COUNTER_COLUMN:
+      return isSetCounter_column();
+    case COUNTER_SUPER_COLUMN:
+      return isSetCounter_super_column();
     }
     throw new IllegalStateException();
   }
@@ -287,6 +388,24 @@ public class ColumnOrSuperColumn impleme
         return false;
     }
 
+    boolean this_present_counter_column = true && this.isSetCounter_column();
+    boolean that_present_counter_column = true && that.isSetCounter_column();
+    if (this_present_counter_column || that_present_counter_column) {
+      if (!(this_present_counter_column && that_present_counter_column))
+        return false;
+      if (!this.counter_column.equals(that.counter_column))
+        return false;
+    }
+
+    boolean this_present_counter_super_column = true && this.isSetCounter_super_column();
+    boolean that_present_counter_super_column = true && that.isSetCounter_super_column();
+    if (this_present_counter_super_column || that_present_counter_super_column) {
+      if (!(this_present_counter_super_column && that_present_counter_super_column))
+        return false;
+      if (!this.counter_super_column.equals(that.counter_super_column))
+        return false;
+    }
+
     return true;
   }
 
@@ -304,6 +423,16 @@ public class ColumnOrSuperColumn impleme
     if (present_super_column)
       builder.append(super_column);
 
+    boolean present_counter_column = true && (isSetCounter_column());
+    builder.append(present_counter_column);
+    if (present_counter_column)
+      builder.append(counter_column);
+
+    boolean present_counter_super_column = true && (isSetCounter_super_column());
+    builder.append(present_counter_super_column);
+    if (present_counter_super_column)
+      builder.append(counter_super_column);
+
     return builder.toHashCode();
   }
 
@@ -335,6 +464,26 @@ public class ColumnOrSuperColumn impleme
         return lastComparison;
       }
     }
+    lastComparison = Boolean.valueOf(isSetCounter_column()).compareTo(typedOther.isSetCounter_column());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetCounter_column()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.counter_column, typedOther.counter_column);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetCounter_super_column()).compareTo(typedOther.isSetCounter_super_column());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetCounter_super_column()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.counter_super_column, typedOther.counter_super_column);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
     return 0;
   }
 
@@ -368,6 +517,22 @@ public class ColumnOrSuperColumn impleme
             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
           }
           break;
+        case 3: // COUNTER_COLUMN
+          if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
+            this.counter_column = new CounterColumn();
+            this.counter_column.read(iprot);
+          } else { 
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
+          }
+          break;
+        case 4: // COUNTER_SUPER_COLUMN
+          if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
+            this.counter_super_column = new CounterSuperColumn();
+            this.counter_super_column.read(iprot);
+          } else { 
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
+          }
+          break;
         default:
           org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
       }
@@ -397,6 +562,20 @@ public class ColumnOrSuperColumn impleme
         oprot.writeFieldEnd();
       }
     }
+    if (this.counter_column != null) {
+      if (isSetCounter_column()) {
+        oprot.writeFieldBegin(COUNTER_COLUMN_FIELD_DESC);
+        this.counter_column.write(oprot);
+        oprot.writeFieldEnd();
+      }
+    }
+    if (this.counter_super_column != null) {
+      if (isSetCounter_super_column()) {
+        oprot.writeFieldBegin(COUNTER_SUPER_COLUMN_FIELD_DESC);
+        this.counter_super_column.write(oprot);
+        oprot.writeFieldEnd();
+      }
+    }
     oprot.writeFieldStop();
     oprot.writeStructEnd();
   }
@@ -425,6 +604,26 @@ public class ColumnOrSuperColumn impleme
       }
       first = false;
     }
+    if (isSetCounter_column()) {
+      if (!first) sb.append(", ");
+      sb.append("counter_column:");
+      if (this.counter_column == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.counter_column);
+      }
+      first = false;
+    }
+    if (isSetCounter_super_column()) {
+      if (!first) sb.append(", ");
+      sb.append("counter_super_column:");
+      if (this.counter_super_column == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.counter_super_column);
+      }
+      first = false;
+    }
     sb.append(")");
     return sb.toString();
   }

Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Mutation.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Mutation.java?rev=1090842&r1=1090841&r2=1090842&view=diff
==============================================================================
--- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Mutation.java (original)
+++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Mutation.java Sun Apr 10 17:31:15 2011
@@ -43,9 +43,8 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * A Mutation is either an insert (represented by filling column_or_supercolumn), a deletion (represented by filling the deletion attribute),
- * a counter addition (represented by filling counter), or a counter deletion (represented by filling counter_deletion).
- * @param column_or_supercolumn. An insert to a column or supercolumn
+ * A Mutation is either an insert (represented by filling column_or_supercolumn) or a deletion (represented by filling the deletion attribute).
+ * @param column_or_supercolumn. An insert to a column or supercolumn (possibly counter column or supercolumn)
  * @param deletion. A deletion of a column or supercolumn
  */
 public class Mutation implements org.apache.thrift.TBase<Mutation, Mutation._Fields>, java.io.Serializable, Cloneable {
@@ -53,17 +52,14 @@ public class Mutation implements org.apa
 
   private static final org.apache.thrift.protocol.TField COLUMN_OR_SUPERCOLUMN_FIELD_DESC = new org.apache.thrift.protocol.TField("column_or_supercolumn", org.apache.thrift.protocol.TType.STRUCT, (short)1);
   private static final org.apache.thrift.protocol.TField DELETION_FIELD_DESC = new org.apache.thrift.protocol.TField("deletion", org.apache.thrift.protocol.TType.STRUCT, (short)2);
-  private static final org.apache.thrift.protocol.TField COUNTER_FIELD_DESC = new org.apache.thrift.protocol.TField("counter", org.apache.thrift.protocol.TType.STRUCT, (short)3);
 
   public ColumnOrSuperColumn column_or_supercolumn;
   public Deletion deletion;
-  public Counter counter;
 
   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
     COLUMN_OR_SUPERCOLUMN((short)1, "column_or_supercolumn"),
-    DELETION((short)2, "deletion"),
-    COUNTER((short)3, "counter");
+    DELETION((short)2, "deletion");
 
     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 
@@ -82,8 +78,6 @@ public class Mutation implements org.apa
           return COLUMN_OR_SUPERCOLUMN;
         case 2: // DELETION
           return DELETION;
-        case 3: // COUNTER
-          return COUNTER;
         default:
           return null;
       }
@@ -132,8 +126,6 @@ public class Mutation implements org.apa
         new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ColumnOrSuperColumn.class)));
     tmpMap.put(_Fields.DELETION, new org.apache.thrift.meta_data.FieldMetaData("deletion", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Deletion.class)));
-    tmpMap.put(_Fields.COUNTER, new org.apache.thrift.meta_data.FieldMetaData("counter", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
-        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Counter.class)));
     metaDataMap = Collections.unmodifiableMap(tmpMap);
     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Mutation.class, metaDataMap);
   }
@@ -151,9 +143,6 @@ public class Mutation implements org.apa
     if (other.isSetDeletion()) {
       this.deletion = new Deletion(other.deletion);
     }
-    if (other.isSetCounter()) {
-      this.counter = new Counter(other.counter);
-    }
   }
 
   public Mutation deepCopy() {
@@ -164,7 +153,6 @@ public class Mutation implements org.apa
   public void clear() {
     this.column_or_supercolumn = null;
     this.deletion = null;
-    this.counter = null;
   }
 
   public ColumnOrSuperColumn getColumn_or_supercolumn() {
@@ -215,30 +203,6 @@ public class Mutation implements org.apa
     }
   }
 
-  public Counter getCounter() {
-    return this.counter;
-  }
-
-  public Mutation setCounter(Counter counter) {
-    this.counter = counter;
-    return this;
-  }
-
-  public void unsetCounter() {
-    this.counter = null;
-  }
-
-  /** Returns true if field counter is set (has been assigned a value) and false otherwise */
-  public boolean isSetCounter() {
-    return this.counter != null;
-  }
-
-  public void setCounterIsSet(boolean value) {
-    if (!value) {
-      this.counter = null;
-    }
-  }
-
   public void setFieldValue(_Fields field, Object value) {
     switch (field) {
     case COLUMN_OR_SUPERCOLUMN:
@@ -257,14 +221,6 @@ public class Mutation implements org.apa
       }
       break;
 
-    case COUNTER:
-      if (value == null) {
-        unsetCounter();
-      } else {
-        setCounter((Counter)value);
-      }
-      break;
-
     }
   }
 
@@ -276,9 +232,6 @@ public class Mutation implements org.apa
     case DELETION:
       return getDeletion();
 
-    case COUNTER:
-      return getCounter();
-
     }
     throw new IllegalStateException();
   }
@@ -294,8 +247,6 @@ public class Mutation implements org.apa
       return isSetColumn_or_supercolumn();
     case DELETION:
       return isSetDeletion();
-    case COUNTER:
-      return isSetCounter();
     }
     throw new IllegalStateException();
   }
@@ -331,15 +282,6 @@ public class Mutation implements org.apa
         return false;
     }
 
-    boolean this_present_counter = true && this.isSetCounter();
-    boolean that_present_counter = true && that.isSetCounter();
-    if (this_present_counter || that_present_counter) {
-      if (!(this_present_counter && that_present_counter))
-        return false;
-      if (!this.counter.equals(that.counter))
-        return false;
-    }
-
     return true;
   }
 
@@ -357,11 +299,6 @@ public class Mutation implements org.apa
     if (present_deletion)
       builder.append(deletion);
 
-    boolean present_counter = true && (isSetCounter());
-    builder.append(present_counter);
-    if (present_counter)
-      builder.append(counter);
-
     return builder.toHashCode();
   }
 
@@ -393,16 +330,6 @@ public class Mutation implements org.apa
         return lastComparison;
       }
     }
-    lastComparison = Boolean.valueOf(isSetCounter()).compareTo(typedOther.isSetCounter());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetCounter()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.counter, typedOther.counter);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
     return 0;
   }
 
@@ -436,14 +363,6 @@ public class Mutation implements org.apa
             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
           }
           break;
-        case 3: // COUNTER
-          if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
-            this.counter = new Counter();
-            this.counter.read(iprot);
-          } else { 
-            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
         default:
           org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
       }
@@ -473,13 +392,6 @@ public class Mutation implements org.apa
         oprot.writeFieldEnd();
       }
     }
-    if (this.counter != null) {
-      if (isSetCounter()) {
-        oprot.writeFieldBegin(COUNTER_FIELD_DESC);
-        this.counter.write(oprot);
-        oprot.writeFieldEnd();
-      }
-    }
     oprot.writeFieldStop();
     oprot.writeStructEnd();
   }
@@ -508,16 +420,6 @@ public class Mutation implements org.apa
       }
       first = false;
     }
-    if (isSetCounter()) {
-      if (!first) sb.append(", ");
-      sb.append("counter:");
-      if (this.counter == null) {
-        sb.append("null");
-      } else {
-        sb.append(this.counter);
-      }
-      first = false;
-    }
     sb.append(")");
     return sb.toString();
   }

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=1090842&r1=1090841&r2=1090842&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java Sun Apr 10 17:31:15 2011
@@ -339,12 +339,6 @@ public class CliClient extends CliUserHe
         CfDef cfDef = getCfDef(columnFamily);
         boolean isSuperCF = cfDef.column_type.equals("Super");
 
-        if (isCounterCF(cfDef))
-        {
-            doCounterSlice(keyspace, key, parent, predicate, isSuperCF);
-            return;
-        }
-
         List<ColumnOrSuperColumn> columns = thriftClient.get_slice(key, parent, predicate, consistencyLevel);
         AbstractType validator;
 
@@ -366,7 +360,7 @@ public class CliClient extends CliUserHe
                 
                 sessionState.out.println(")");
             }
-            else
+            else if (cosc.isSetColumn())
             {
                 Column column = cosc.column;
                 validator = getValidatorForValue(cfDef, column.getName());
@@ -381,23 +375,9 @@ public class CliClient extends CliUserHe
                                         column.timestamp,
                                         column.isSetTtl() ? String.format(", ttl=%d", column.getTtl()) : "");
             }
-        }
-        
-        sessionState.out.println("Returned " + columns.size() + " results.");
-    }
-
-    private void doCounterSlice(String keyspace, ByteBuffer key, ColumnParent parent, SlicePredicate predicate, boolean isSuperCF)
-            throws InvalidRequestException, UnavailableException, TimedOutException, TException, IllegalAccessException, NotFoundException, InstantiationException, NoSuchFieldException
-    {
-        String columnFamily = parent.column_family;
-        List<Counter> columns = thriftClient.get_counter_slice(key, parent, predicate, consistencyLevel);
-
-        // Print out super columns or columns.
-        for (Counter cosc : columns)
-        {
-            if (cosc.isSetSuper_column())
+            else if (cosc.isSetCounter_super_column())
             {
-                CounterSuperColumn superColumn = cosc.super_column;
+                CounterSuperColumn superColumn = cosc.counter_super_column;
 
                 sessionState.out.printf("=> (super_column=%s,", formatColumnName(keyspace, columnFamily, superColumn.name));
                 for (CounterColumn col : superColumn.getColumns())
@@ -406,9 +386,9 @@ public class CliClient extends CliUserHe
                 }
                 sessionState.out.println(")");
             }
-            else
+            else // cosc.isSetCounter_column()
             {
-                CounterColumn column = cosc.column;
+                CounterColumn column = cosc.counter_column;
                 String formattedName = isSuperCF
                                        ? formatSubcolumnName(keyspace, columnFamily, column.name)
                                        : formatColumnName(keyspace, columnFamily, column.name);
@@ -562,7 +542,7 @@ public class CliClient extends CliUserHe
         CounterColumn column;
         try
         {
-            column = thriftClient.get_counter(key, path, consistencyLevel).column;
+            column = thriftClient.get(key, path, consistencyLevel).counter_column;
         }
         catch (NotFoundException e)
         {

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/RowMutation.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/RowMutation.java?rev=1090842&r1=1090841&r2=1090842&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/RowMutation.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/RowMutation.java Sun Apr 10 17:31:15 2011
@@ -33,7 +33,6 @@ import org.apache.cassandra.io.ICompactS
 import org.apache.cassandra.net.Message;
 import org.apache.cassandra.service.StorageService;
 import org.apache.cassandra.thrift.ColumnOrSuperColumn;
-import org.apache.cassandra.thrift.Counter;
 import org.apache.cassandra.thrift.Deletion;
 import org.apache.cassandra.thrift.Mutation;
 import org.apache.cassandra.thrift.SlicePredicate;
@@ -243,10 +242,6 @@ public class RowMutation implements IMut
                 {
                     addColumnOrSuperColumnToRowMutation(rm, cfName, mutation.column_or_supercolumn);
                 }
-                if (mutation.counter != null)
-                {
-                    addCounterToRowMutation(rm, cfName, mutation.counter);
-                }
             }
         }
         return rm;
@@ -295,31 +290,27 @@ public class RowMutation implements IMut
 
     private static void addColumnOrSuperColumnToRowMutation(RowMutation rm, String cfName, ColumnOrSuperColumn cosc)
     {
-        if (cosc.column == null)
+        if (cosc.super_column != null)
         {
             for (org.apache.cassandra.thrift.Column column : cosc.super_column.columns)
             {
                 rm.add(new QueryPath(cfName, cosc.super_column.name, column.name), column.value, column.timestamp, column.ttl);
             }
         }
-        else
+        else if (cosc.column != null)
         {
             rm.add(new QueryPath(cfName, null, cosc.column.name), cosc.column.value, cosc.column.timestamp, cosc.column.ttl);
         }
-    }
-
-    private static void addCounterToRowMutation(RowMutation rm, String cfName, Counter counter)
-    {
-        if (counter.column == null)
+        else if (cosc.counter_super_column != null)
         {
-            for (org.apache.cassandra.thrift.CounterColumn column : counter.super_column.columns)
+            for (org.apache.cassandra.thrift.CounterColumn column : cosc.counter_super_column.columns)
             {
-                rm.addCounter(new QueryPath(cfName, counter.super_column.name, column.name), column.value);
+                rm.addCounter(new QueryPath(cfName, cosc.counter_super_column.name, column.name), column.value);
             }
         }
-        else
+        else // cosc.counter_column != null
         {
-            rm.addCounter(new QueryPath(cfName, null, counter.column.name), counter.column.value);
+            rm.addCounter(new QueryPath(cfName, null, cosc.counter_column.name), cosc.counter_column.value);
         }
     }
 

Modified: cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraServer.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraServer.java?rev=1090842&r1=1090841&r2=1090842&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraServer.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraServer.java Sun Apr 10 17:31:15 2011
@@ -65,6 +65,7 @@ public class CassandraServer implements 
 
     private final static List<ColumnOrSuperColumn> EMPTY_COLUMNS = Collections.emptyList();
     private final static List<Column> EMPTY_SUBCOLUMNS = Collections.emptyList();
+    private final static List<CounterColumn> EMPTY_COUNTER_SUBCOLUMNS = Collections.emptyList();
 
     // thread local state containing session information
     public final ThreadLocal<ClientState> clientState = new ThreadLocal<ClientState>()
@@ -157,6 +158,28 @@ public class CassandraServer implements 
         return thriftColumns;
     }
 
+    public List<CounterColumn> thriftifyCounterSubColumns(Collection<IColumn> columns)
+    {
+        if (columns == null || columns.isEmpty())
+        {
+            return EMPTY_COUNTER_SUBCOLUMNS;
+        }
+
+        ArrayList<CounterColumn> thriftColumns = new ArrayList<CounterColumn>(columns.size());
+        for (IColumn column : columns)
+        {
+            if (column.isMarkedForDelete())
+            {
+                continue;
+            }
+            assert column instanceof org.apache.cassandra.db.CounterColumn;
+            CounterColumn thrift_column = new CounterColumn(column.name(), CounterContext.instance().total(column.value()));
+            thriftColumns.add(thrift_column);
+        }
+
+        return thriftColumns;
+    }
+
     public List<ColumnOrSuperColumn> thriftifyColumns(Collection<IColumn> columns, boolean reverseOrder)
     {
         ArrayList<ColumnOrSuperColumn> thriftColumns = new ArrayList<ColumnOrSuperColumn>(columns.size());
@@ -166,12 +189,20 @@ public class CassandraServer implements 
             {
                 continue;
             }
-            Column thrift_column = new Column(column.name(), column.value(), column.timestamp());
-            if (column instanceof ExpiringColumn)
+            if (column instanceof org.apache.cassandra.db.CounterColumn)
             {
-                thrift_column.setTtl(((ExpiringColumn) column).getTimeToLive());
+                CounterColumn thrift_column = new CounterColumn(column.name(), CounterContext.instance().total(column.value()));
+                thriftColumns.add(new ColumnOrSuperColumn().setCounter_column(thrift_column));
+            }
+            else
+            {
+                Column thrift_column = new Column(column.name(), column.value(), column.timestamp());
+                if (column instanceof ExpiringColumn)
+                {
+                    thrift_column.setTtl(((ExpiringColumn) column).getTimeToLive());
+                }
+                thriftColumns.add(new ColumnOrSuperColumn().setColumn(thrift_column));
             }
-            thriftColumns.add(new ColumnOrSuperColumn().setColumn(thrift_column));
         }
 
         // we have to do the reversing here, since internally we pass results around in ColumnFamily
@@ -182,6 +213,14 @@ public class CassandraServer implements 
         return thriftColumns;
     }
 
+    private List<ColumnOrSuperColumn> thriftifySuperColumns(Collection<IColumn> columns, boolean reverseOrder, boolean isCounterCF)
+    {
+        if (isCounterCF)
+            return thriftifyCounterSuperColumns(columns, reverseOrder);
+        else
+            return thriftifySuperColumns(columns, reverseOrder);
+    }
+
     private List<ColumnOrSuperColumn> thriftifySuperColumns(Collection<IColumn> columns, boolean reverseOrder)
     {
         ArrayList<ColumnOrSuperColumn> thriftSuperColumns = new ArrayList<ColumnOrSuperColumn>(columns.size());
@@ -202,6 +241,26 @@ public class CassandraServer implements 
         return thriftSuperColumns;
     }
 
+    private List<ColumnOrSuperColumn> thriftifyCounterSuperColumns(Collection<IColumn> columns, boolean reverseOrder)
+    {
+        ArrayList<ColumnOrSuperColumn> thriftSuperColumns = new ArrayList<ColumnOrSuperColumn>(columns.size());
+        for (IColumn column : columns)
+        {
+            List<CounterColumn> subcolumns = thriftifyCounterSubColumns(column.getSubColumns());
+            if (subcolumns.isEmpty())
+            {
+                continue;
+            }
+            CounterSuperColumn superColumn = new CounterSuperColumn(column.name(), subcolumns);
+            thriftSuperColumns.add(new ColumnOrSuperColumn().setCounter_super_column(superColumn));
+        }
+
+        if (reverseOrder)
+            Collections.reverse(thriftSuperColumns);
+
+        return thriftSuperColumns;
+    }
+
     private Map<ByteBuffer, List<ColumnOrSuperColumn>> getSlice(List<ReadCommand> commands, ConsistencyLevel consistency_level)
     throws InvalidRequestException, UnavailableException, TimedOutException
     {
@@ -232,9 +291,14 @@ public class CassandraServer implements 
                 return thriftifyColumns(subcolumns, reverseOrder);
         }
         if (cf.isSuper())
-            return thriftifySuperColumns(cf.getSortedColumns(), reverseOrder);        
+        {
+            boolean isCounterCF = cf.metadata().getDefaultValidator().isCommutative();
+            return thriftifySuperColumns(cf.getSortedColumns(), reverseOrder, isCounterCF);
+        }
         else
+        {
             return thriftifyColumns(cf.getSortedColumns(), reverseOrder);
+        }
     }
 
     public List<ColumnOrSuperColumn> get_slice(ByteBuffer key, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level)
@@ -243,7 +307,7 @@ public class CassandraServer implements 
         logger.debug("get_slice");
         
         state().hasColumnFamilyAccess(column_parent.column_family, Permission.READ);
-        return multigetSliceInternal(state().getKeyspace(), Collections.singletonList(key), column_parent, predicate, consistency_level, false).get(key);
+        return multigetSliceInternal(state().getKeyspace(), Collections.singletonList(key), column_parent, predicate, consistency_level).get(key);
     }
     
     public Map<ByteBuffer, List<ColumnOrSuperColumn>> multiget_slice(List<ByteBuffer> keys, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level)
@@ -252,13 +316,13 @@ public class CassandraServer implements 
         logger.debug("multiget_slice");
 
         state().hasColumnFamilyAccess(column_parent.column_family, Permission.READ);
-        return multigetSliceInternal(state().getKeyspace(), keys, column_parent, predicate, consistency_level, false);
+        return multigetSliceInternal(state().getKeyspace(), keys, column_parent, predicate, consistency_level);
     }
 
-    private Map<ByteBuffer, List<ColumnOrSuperColumn>> multigetSliceInternal(String keyspace, List<ByteBuffer> keys, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level, boolean isCommutativeOp)
+    private Map<ByteBuffer, List<ColumnOrSuperColumn>> multigetSliceInternal(String keyspace, List<ByteBuffer> keys, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level)
     throws InvalidRequestException, UnavailableException, TimedOutException
     {
-        CFMetaData metadata = ThriftValidation.validateColumnFamily(keyspace, column_parent.column_family, isCommutativeOp);
+        CFMetaData metadata = ThriftValidation.validateColumnFamily(keyspace, column_parent.column_family);
         ThriftValidation.validateColumnParent(metadata, column_parent);
         ThriftValidation.validatePredicate(metadata, column_parent, predicate);
 
@@ -284,13 +348,13 @@ public class CassandraServer implements 
         return getSlice(commands, consistency_level);
     }
 
-    private ColumnOrSuperColumn internal_get(ByteBuffer key, ColumnPath column_path, ConsistencyLevel consistency_level, boolean isCommutativeOp)
+    private ColumnOrSuperColumn internal_get(ByteBuffer key, ColumnPath column_path, ConsistencyLevel consistency_level)
     throws InvalidRequestException, NotFoundException, UnavailableException, TimedOutException
     {
         state().hasColumnFamilyAccess(column_path.column_family, Permission.READ);
         String keyspace = state().getKeyspace();
 
-        CFMetaData metadata = ThriftValidation.validateColumnFamily(keyspace, column_path.column_family, isCommutativeOp);
+        CFMetaData metadata = ThriftValidation.validateColumnFamily(keyspace, column_path.column_family);
         ThriftValidation.validateColumnPath(metadata, column_path);
 
         QueryPath path = new QueryPath(column_path.column_family, column_path.column == null ? null : column_path.super_column);
@@ -316,7 +380,7 @@ public class CassandraServer implements 
     {
         logger.debug("get");
 
-        return internal_get(key, column_path, consistency_level, false);
+        return internal_get(key, column_path, consistency_level);
     }
 
     public int get_count(ByteBuffer key, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level)
@@ -338,7 +402,7 @@ public class CassandraServer implements 
         String keyspace = state().getKeyspace();
 
         Map<ByteBuffer, Integer> counts = new HashMap<ByteBuffer, Integer>();
-        Map<ByteBuffer, List<ColumnOrSuperColumn>> columnFamiliesMap = multigetSliceInternal(keyspace, keys, column_parent, predicate, consistency_level, false);
+        Map<ByteBuffer, List<ColumnOrSuperColumn>> columnFamiliesMap = multigetSliceInternal(keyspace, keys, column_parent, predicate, consistency_level);
 
         for (Map.Entry<ByteBuffer, List<ColumnOrSuperColumn>> cf : columnFamiliesMap.entrySet()) {
           counts.put(cf.getKey(), cf.getValue().size());
@@ -398,8 +462,6 @@ public class CassandraServer implements 
                     cfamsSeen.add(cfName);
                 }
 
-                boolean isCommutativeOp = false;
-                boolean isOnlyDeletion = true;
                 CFMetaData metadata = ThriftValidation.validateColumnFamily(keyspace, cfName);
                 ThriftValidation.validateKey(metadata, key);
 
@@ -1028,73 +1090,6 @@ public class CassandraServer implements 
         doInsert(consistency_level, Arrays.asList(rm));
     }
 
-    private Counter getCounter(ColumnOrSuperColumn cosc)
-    {
-        if (cosc.isSetColumn()) {
-            return new Counter().setColumn(new CounterColumn(cosc.column.name, CounterContext.instance().total(cosc.column.value)));
-        } else if(cosc.isSetSuper_column()) {
-            List<CounterColumn> cc = new ArrayList<CounterColumn>(cosc.super_column.columns.size());
-            for (Column col : cosc.super_column.columns)
-            {
-                cc.add(new CounterColumn(col.name, CounterContext.instance().total(col.value)));
-            }
-            return new Counter().setSuper_column(new CounterSuperColumn(cosc.super_column.name, cc));
-        }
-        return null;
-    }
-
-    public Counter get_counter(ByteBuffer key, ColumnPath path, ConsistencyLevel consistency_level)
-            throws InvalidRequestException, NotFoundException, UnavailableException, TimedOutException, TException
-    {
-        logger.debug("get_counter");
-
-        String keyspace = state().getKeyspace();
-
-        return getCounter(internal_get(key, path, consistency_level, true));
-    }
-    
-    private List<Counter> getCounters(List<ColumnOrSuperColumn> cosc)
-    {
-        List<Counter> rv = new ArrayList<Counter>(cosc.size());
-        for (ColumnOrSuperColumn columnOrSuperColumn : cosc)
-        {
-            Counter c = getCounter(columnOrSuperColumn);
-            if (c != null) {
-                rv.add(c);                
-            }
-        }
-        return rv;
-    }
-
-    public List<Counter> get_counter_slice(ByteBuffer key, ColumnParent column_parent, SlicePredicate predicate,
-            ConsistencyLevel consistency_level) throws InvalidRequestException, UnavailableException, TimedOutException,
-            TException
-    {
-        if (logger.isDebugEnabled())
-            logger.debug("get_counter_slice");
-
-        state().hasColumnFamilyAccess(column_parent.column_family, Permission.READ);
-        List<ColumnOrSuperColumn> cosc = multigetSliceInternal(state().getKeyspace(), Collections.singletonList(key), column_parent, predicate, consistency_level, true).get(key);
-        return getCounters(cosc);
-    }
-
-    public Map<ByteBuffer, List<Counter>> multiget_counter_slice(List<ByteBuffer> keys, ColumnParent column_parent,
-            SlicePredicate predicate, ConsistencyLevel consistency_level) throws InvalidRequestException,
-            UnavailableException, TimedOutException, TException
-    {
-        if (logger.isDebugEnabled())
-            logger.debug("multiget_counter_slice");
-
-        state().hasColumnFamilyAccess(column_parent.column_family, Permission.READ);
-        Map<ByteBuffer, List<ColumnOrSuperColumn>> slices = multigetSliceInternal(state().getKeyspace(), keys, column_parent, predicate, consistency_level, true);
-        Map<ByteBuffer, List<Counter>> rv = new HashMap<ByteBuffer, List<Counter>>(slices.size());
-        for (Entry<ByteBuffer, List<ColumnOrSuperColumn>> entry : slices.entrySet())
-        {
-            rv.put(entry.getKey(), getCounters(entry.getValue()));
-        }
-        return rv;
-    }
-
     public void remove_counter(ByteBuffer key, ColumnPath path, ConsistencyLevel consistency_level)
             throws InvalidRequestException, UnavailableException, TimedOutException, TException
     {

Modified: cassandra/trunk/src/java/org/apache/cassandra/thrift/ThriftValidation.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/thrift/ThriftValidation.java?rev=1090842&r1=1090841&r2=1090842&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/thrift/ThriftValidation.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/thrift/ThriftValidation.java Sun Apr 10 17:31:15 2011
@@ -96,7 +96,7 @@ public class ThriftValidation
         return metadata;
     }
 
-    // This should only be used when the operation should be authorized whether this is a counter CF or not
+    // To be used when the operation should be authorized whether this is a counter CF or not
     public static CFMetaData validateColumnFamily(String tablename, String cfName) throws InvalidRequestException
     {
         validateTable(tablename);
@@ -249,8 +249,22 @@ public class ThriftValidation
     public static void validateColumnOrSuperColumn(CFMetaData metadata, ColumnOrSuperColumn cosc)
             throws InvalidRequestException
     {
+        boolean isCommutative = metadata.getDefaultValidator().isCommutative();
+
+        int nulls = 0;
+        if (cosc.column == null) nulls++;
+        if (cosc.super_column == null) nulls++;
+        if (cosc.counter_column == null) nulls++;
+        if (cosc.counter_super_column == null) nulls++;
+
+        if (nulls != 3)
+            throw new InvalidRequestException("ColumnOrSuperColumn must have one (and only one) of column, super_column, counter and counter_super_column");
+
         if (cosc.column != null)
         {
+            if (isCommutative)
+                throw new InvalidRequestException("invalid operation for commutative columnfamily " + metadata.cfName);
+
             validateTtl(cosc.column);
             validateColumnPath(metadata, new ColumnPath(metadata.cfName).setSuper_column((ByteBuffer)null).setColumn(cosc.column.name));
             validateColumnData(metadata, cosc.column);
@@ -258,6 +272,9 @@ public class ThriftValidation
 
         if (cosc.super_column != null)
         {
+            if (isCommutative)
+                throw new InvalidRequestException("invalid operation for commutative columnfamily " + metadata.cfName);
+
             for (Column c : cosc.super_column.columns)
             {
                 validateColumnPath(metadata, new ColumnPath(metadata.cfName).setSuper_column(cosc.super_column.name).setColumn(c.name));
@@ -265,24 +282,22 @@ public class ThriftValidation
             }
         }
 
-        if (cosc.column == null && cosc.super_column == null)
-            throw new InvalidRequestException("ColumnOrSuperColumn must have one or both of Column or SuperColumn");
-    }
+        if (cosc.counter_column != null)
+        {
+            if (!isCommutative)
+                throw new InvalidRequestException("invalid operation for non commutative columnfamily " + metadata.cfName);
 
-    public static void validateCounter(CFMetaData metadata, Counter counter)
-            throws InvalidRequestException
-    {
-        if (counter.column != null)
-            validateColumnPath(metadata, new ColumnPath(metadata.cfName).setSuper_column((ByteBuffer)null).setColumn(counter.column.name));
+            validateColumnPath(metadata, new ColumnPath(metadata.cfName).setSuper_column((ByteBuffer)null).setColumn(cosc.counter_column.name));
+        }
 
-        if (counter.super_column != null)
+        if (cosc.counter_super_column != null)
         {
-            for (CounterColumn c : counter.super_column.columns)
-                validateColumnPath(metadata, new ColumnPath(metadata.cfName).setSuper_column(counter.super_column.name).setColumn(c.name));
-        }
+            if (!isCommutative)
+                throw new InvalidRequestException("invalid operation for non commutative columnfamily " + metadata.cfName);
 
-        if (counter.column == null && counter.super_column == null)
-            throw new InvalidRequestException("Counter must have one or both of column or super_column");
+            for (CounterColumn c : cosc.counter_super_column.columns)
+                validateColumnPath(metadata, new ColumnPath(metadata.cfName).setSuper_column(cosc.counter_super_column.name).setColumn(c.name));
+        }
     }
 
     private static void validateTtl(Column column) throws InvalidRequestException
@@ -300,34 +315,21 @@ public class ThriftValidation
     {
         ColumnOrSuperColumn cosc = mut.column_or_supercolumn;
         Deletion del = mut.deletion;
-        Counter counter = mut.counter;
 
-        boolean isCommutative = metadata.getDefaultValidator().isCommutative();
         int nulls = 0;
         if (cosc == null) nulls++;
         if (del == null) nulls++;
-        if (counter == null) nulls++;
 
-        if (nulls != 2)
+        if (nulls != 1)
         {
-            throw new InvalidRequestException("mutation must have one and only one of column_or_supercolumn, deletion, counter or counter_deletion");
+            throw new InvalidRequestException("mutation must have one and only one of column_or_supercolumn or deletion");
         }
 
         if (cosc != null)
         {
-            if (isCommutative)
-                throw new InvalidRequestException("invalid operation for commutative columnfamily " + metadata.cfName);
-
             validateColumnOrSuperColumn(metadata, cosc);
         }
-        if (counter != null)
-        {
-            if (!isCommutative)
-                throw new InvalidRequestException("invalid operation for non commutative columnfamily " + metadata.cfName);
-
-            validateCounter(metadata, counter);
-        }
-        if (del != null)
+        else
         {
             validateDeletion(metadata, del);
         }

Modified: cassandra/trunk/test/system/test_thrift_server.py
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/system/test_thrift_server.py?rev=1090842&r1=1090841&r2=1090842&view=diff
==============================================================================
--- cassandra/trunk/test/system/test_thrift_server.py (original)
+++ cassandra/trunk/test/system/test_thrift_server.py Sun Apr 10 17:31:15 2011
@@ -55,13 +55,6 @@ def _assert_no_columnpath(key, column_pa
     except NotFoundException:
         assert True, 'column did not exist'
 
-def _assert_no_columnpath_counter(key, column_path):
-    try:
-        client.get_counter(key, column_path, ConsistencyLevel.ONE)
-        assert False, ('columnpath %s existed in %s when it should not' % (column_path, key))
-    except NotFoundException:
-        assert True, 'column did not exist'
-
 def _insert_simple(block=True):
    return _insert_multi(['key1'])
 
@@ -1504,18 +1497,18 @@ class TestMutations(ThriftTester):
         # insert positive and negative values and check the counts
         client.add('key1', ColumnParent(column_family='Counter1'), CounterColumn('c1', d1), ConsistencyLevel.ONE)
         time.sleep(0.1)
-        rv1 = client.get_counter('key1', ColumnPath(column_family='Counter1', column='c1'), ConsistencyLevel.ONE)
-        assert rv1.column.value == d1
+        rv1 = client.get('key1', ColumnPath(column_family='Counter1', column='c1'), ConsistencyLevel.ONE)
+        assert rv1.counter_column.value == d1
 
         client.add('key1', ColumnParent(column_family='Counter1'), CounterColumn('c1', d2), ConsistencyLevel.ONE)
         time.sleep(0.1)
-        rv2 = client.get_counter('key1', ColumnPath(column_family='Counter1', column='c1'), ConsistencyLevel.ONE)
-        assert rv2.column.value == (d1+d2)
+        rv2 = client.get('key1', ColumnPath(column_family='Counter1', column='c1'), ConsistencyLevel.ONE)
+        assert rv2.counter_column.value == (d1+d2)
 
         client.add('key1', ColumnParent(column_family='Counter1'), CounterColumn('c1', d3), ConsistencyLevel.ONE)
         time.sleep(0.1)
-        rv3 = client.get_counter('key1', ColumnPath(column_family='Counter1', column='c1'), ConsistencyLevel.ONE)
-        assert rv3.column.value == (d1+d2+d3)
+        rv3 = client.get('key1', ColumnPath(column_family='Counter1', column='c1'), ConsistencyLevel.ONE)
+        assert rv3.counter_column.value == (d1+d2+d3)
 
     def test_incr_decr_super_add(self):
         _set_keyspace('Keyspace1')
@@ -1527,19 +1520,19 @@ class TestMutations(ThriftTester):
         client.add('key1', ColumnParent(column_family='SuperCounter1', super_column='sc1'),  CounterColumn('c1', d1), ConsistencyLevel.ONE)
         client.add('key1', ColumnParent(column_family='SuperCounter1', super_column='sc1'),  CounterColumn('c2', d2), ConsistencyLevel.ONE)
         time.sleep(0.1)
-        rv1 = client.get_counter('key1', ColumnPath(column_family='SuperCounter1', super_column='sc1'), ConsistencyLevel.ONE)
-        assert rv1.super_column.columns[0].value == d1
-        assert rv1.super_column.columns[1].value == d2
+        rv1 = client.get('key1', ColumnPath(column_family='SuperCounter1', super_column='sc1'), ConsistencyLevel.ONE)
+        assert rv1.counter_super_column.columns[0].value == d1
+        assert rv1.counter_super_column.columns[1].value == d2
 
         client.add('key1', ColumnParent(column_family='SuperCounter1', super_column='sc1'),  CounterColumn('c1', d2), ConsistencyLevel.ONE)
         time.sleep(0.1)
-        rv2 = client.get_counter('key1', ColumnPath('SuperCounter1', 'sc1', 'c1'), ConsistencyLevel.ONE)
-        assert rv2.column.value == (d1+d2)
+        rv2 = client.get('key1', ColumnPath('SuperCounter1', 'sc1', 'c1'), ConsistencyLevel.ONE)
+        assert rv2.counter_column.value == (d1+d2)
 
         client.add('key1', ColumnParent(column_family='SuperCounter1', super_column='sc1'),  CounterColumn('c1', d3), ConsistencyLevel.ONE)
         time.sleep(0.1)
-        rv3 = client.get_counter('key1', ColumnPath(column_family='SuperCounter1', super_column='sc1', column='c1'), ConsistencyLevel.ONE)
-        assert rv3.column.value == (d1+d2+d3)
+        rv3 = client.get('key1', ColumnPath(column_family='SuperCounter1', super_column='sc1', column='c1'), ConsistencyLevel.ONE)
+        assert rv3.counter_column.value == (d1+d2+d3)
 
     def test_incr_standard_remove(self):
         _set_keyspace('Keyspace1')
@@ -1549,22 +1542,22 @@ class TestMutations(ThriftTester):
         # insert value and check it exists
         client.add('key1', ColumnParent(column_family='Counter1'), CounterColumn('c1', d1), ConsistencyLevel.ONE)
         time.sleep(5)
-        rv1 = client.get_counter('key1', ColumnPath(column_family='Counter1', column='c1'), ConsistencyLevel.ONE)
-        assert rv1.column.value == d1
+        rv1 = client.get('key1', ColumnPath(column_family='Counter1', column='c1'), ConsistencyLevel.ONE)
+        assert rv1.counter_column.value == d1
 
         # remove the previous column and check that it is gone
         client.remove_counter('key1', ColumnPath(column_family='Counter1', column='c1'), ConsistencyLevel.ONE)
         time.sleep(5)
-        _assert_no_columnpath_counter('key1', ColumnPath(column_family='Counter1', column='c1'))
+        _assert_no_columnpath('key1', ColumnPath(column_family='Counter1', column='c1'))
 
         # insert again and this time delete the whole row, check that it is gone
         client.add('key1', ColumnParent(column_family='Counter1'), CounterColumn('c1', d1), ConsistencyLevel.ONE)
         time.sleep(5)
-        rv2 = client.get_counter('key1', ColumnPath(column_family='Counter1', column='c1'), ConsistencyLevel.ONE)
-        assert rv2.column.value == d1
+        rv2 = client.get('key1', ColumnPath(column_family='Counter1', column='c1'), ConsistencyLevel.ONE)
+        assert rv2.counter_column.value == d1
         client.remove_counter('key1', ColumnPath(column_family='Counter1'), ConsistencyLevel.ONE)
         time.sleep(5)
-        _assert_no_columnpath_counter('key1', ColumnPath(column_family='Counter1', column='c1'))
+        _assert_no_columnpath('key1', ColumnPath(column_family='Counter1', column='c1'))
 
     def test_incr_super_remove(self):
         _set_keyspace('Keyspace1')
@@ -1574,22 +1567,22 @@ class TestMutations(ThriftTester):
         # insert value and check it exists
         client.add('key1', ColumnParent(column_family='SuperCounter1', super_column='sc1'), CounterColumn('c1', d1), ConsistencyLevel.ONE)
         time.sleep(5)
-        rv1 = client.get_counter('key1', ColumnPath(column_family='SuperCounter1', super_column='sc1', column='c1'), ConsistencyLevel.ONE)
-        assert rv1.column.value == d1
+        rv1 = client.get('key1', ColumnPath(column_family='SuperCounter1', super_column='sc1', column='c1'), ConsistencyLevel.ONE)
+        assert rv1.counter_column.value == d1
 
         # remove the previous column and check that it is gone
         client.remove_counter('key1', ColumnPath(column_family='SuperCounter1', super_column='sc1', column='c1'), ConsistencyLevel.ONE)
         time.sleep(5)
-        _assert_no_columnpath_counter('key1', ColumnPath(column_family='SuperCounter1', super_column='sc1', column='c1'))
+        _assert_no_columnpath('key1', ColumnPath(column_family='SuperCounter1', super_column='sc1', column='c1'))
 
         # insert again and this time delete the whole row, check that it is gone
         client.add('key1', ColumnParent(column_family='SuperCounter1', super_column='sc1'), CounterColumn('c1', d1), ConsistencyLevel.ONE)
         time.sleep(5)
-        rv2 = client.get_counter('key1', ColumnPath(column_family='SuperCounter1', super_column='sc1', column='c1'), ConsistencyLevel.ONE)
-        assert rv2.column.value == d1
+        rv2 = client.get('key1', ColumnPath(column_family='SuperCounter1', super_column='sc1', column='c1'), ConsistencyLevel.ONE)
+        assert rv2.counter_column.value == d1
         client.remove_counter('key1', ColumnPath(column_family='SuperCounter1', super_column='sc1'), ConsistencyLevel.ONE)
         time.sleep(5)
-        _assert_no_columnpath_counter('key1', ColumnPath(column_family='SuperCounter1', super_column='sc1', column='c1'))
+        _assert_no_columnpath('key1', ColumnPath(column_family='SuperCounter1', super_column='sc1', column='c1'))
 
     def test_incr_decr_standard_remove(self):
         _set_keyspace('Keyspace1')
@@ -1599,22 +1592,22 @@ class TestMutations(ThriftTester):
         # insert value and check it exists
         client.add('key1', ColumnParent(column_family='Counter1'), CounterColumn('c1', d1), ConsistencyLevel.ONE)
         time.sleep(5)
-        rv1 = client.get_counter('key1', ColumnPath(column_family='Counter1', column='c1'), ConsistencyLevel.ONE)
-        assert rv1.column.value == d1
+        rv1 = client.get('key1', ColumnPath(column_family='Counter1', column='c1'), ConsistencyLevel.ONE)
+        assert rv1.counter_column.value == d1
 
         # remove the previous column and check that it is gone
         client.remove_counter('key1', ColumnPath(column_family='Counter1', column='c1'), ConsistencyLevel.ONE)
         time.sleep(5)
-        _assert_no_columnpath_counter('key1', ColumnPath(column_family='Counter1', column='c1'))
+        _assert_no_columnpath('key1', ColumnPath(column_family='Counter1', column='c1'))
 
         # insert again and this time delete the whole row, check that it is gone
         client.add('key1', ColumnParent(column_family='Counter1'), CounterColumn('c1', d1), ConsistencyLevel.ONE)
         time.sleep(5)
-        rv2 = client.get_counter('key1', ColumnPath(column_family='Counter1', column='c1'), ConsistencyLevel.ONE)
-        assert rv2.column.value == d1
+        rv2 = client.get('key1', ColumnPath(column_family='Counter1', column='c1'), ConsistencyLevel.ONE)
+        assert rv2.counter_column.value == d1
         client.remove_counter('key1', ColumnPath(column_family='Counter1'), ConsistencyLevel.ONE)
         time.sleep(5)
-        _assert_no_columnpath_counter('key1', ColumnPath(column_family='Counter1', column='c1'))
+        _assert_no_columnpath('key1', ColumnPath(column_family='Counter1', column='c1'))
 
     def test_incr_decr_super_remove(self):
         _set_keyspace('Keyspace1')
@@ -1624,22 +1617,22 @@ class TestMutations(ThriftTester):
         # insert value and check it exists
         client.add('key1', ColumnParent(column_family='SuperCounter1', super_column='sc1'), CounterColumn('c1', d1), ConsistencyLevel.ONE)
         time.sleep(5)
-        rv1 = client.get_counter('key1', ColumnPath(column_family='SuperCounter1', super_column='sc1', column='c1'), ConsistencyLevel.ONE)
-        assert rv1.column.value == d1
+        rv1 = client.get('key1', ColumnPath(column_family='SuperCounter1', super_column='sc1', column='c1'), ConsistencyLevel.ONE)
+        assert rv1.counter_column.value == d1
 
         # remove the previous column and check that it is gone
         client.remove_counter('key1', ColumnPath(column_family='SuperCounter1', super_column='sc1', column='c1'), ConsistencyLevel.ONE)
         time.sleep(5)
-        _assert_no_columnpath_counter('key1', ColumnPath(column_family='SuperCounter1', super_column='sc1', column='c1'))
+        _assert_no_columnpath('key1', ColumnPath(column_family='SuperCounter1', super_column='sc1', column='c1'))
 
         # insert again and this time delete the whole row, check that it is gone
         client.add('key1', ColumnParent(column_family='SuperCounter1', super_column='sc1'), CounterColumn('c1', d1), ConsistencyLevel.ONE)
         time.sleep(5)
-        rv2 = client.get_counter('key1', ColumnPath(column_family='SuperCounter1', super_column='sc1', column='c1'), ConsistencyLevel.ONE)
-        assert rv2.column.value == d1
+        rv2 = client.get('key1', ColumnPath(column_family='SuperCounter1', super_column='sc1', column='c1'), ConsistencyLevel.ONE)
+        assert rv2.counter_column.value == d1
         client.remove_counter('key1', ColumnPath(column_family='SuperCounter1', super_column='sc1'), ConsistencyLevel.ONE)
         time.sleep(5)
-        _assert_no_columnpath_counter('key1', ColumnPath(column_family='SuperCounter1', super_column='sc1', column='c1'))
+        _assert_no_columnpath('key1', ColumnPath(column_family='SuperCounter1', super_column='sc1', column='c1'))
         
     def test_incr_decr_standard_batch_add(self):
         _set_keyspace('Keyspace1')
@@ -1647,15 +1640,15 @@ class TestMutations(ThriftTester):
         d1 = 12
         d2 = -21
         update_map = {'key1': {'Counter1': [
-            Mutation(counter=Counter(column=CounterColumn('c1', d1))),
-            Mutation(counter=Counter(column=CounterColumn('c1', d2))),
+            Mutation(column_or_supercolumn=ColumnOrSuperColumn(counter_column=CounterColumn('c1', d1))),
+            Mutation(column_or_supercolumn=ColumnOrSuperColumn(counter_column=CounterColumn('c1', d2))),
             ]}}
         
         # insert positive and negative values and check the counts
         client.batch_mutate(update_map, ConsistencyLevel.ONE)
         time.sleep(0.1)
-        rv1 = client.get_counter('key1', ColumnPath(column_family='Counter1', column='c1'), ConsistencyLevel.ONE)
-        assert rv1.column.value == d1+d2
+        rv1 = client.get('key1', ColumnPath(column_family='Counter1', column='c1'), ConsistencyLevel.ONE)
+        assert rv1.counter_column.value == d1+d2
 
     def test_incr_decr_standard_batch_remove(self):
         _set_keyspace('Keyspace1')
@@ -1665,13 +1658,13 @@ class TestMutations(ThriftTester):
 
         # insert positive and negative values and check the counts
         update_map = {'key1': {'Counter1': [
-            Mutation(counter=Counter(column=CounterColumn('c1', d1))),
-            Mutation(counter=Counter(column=CounterColumn('c1', d2))),
+            Mutation(column_or_supercolumn=ColumnOrSuperColumn(counter_column=CounterColumn('c1', d1))),
+            Mutation(column_or_supercolumn=ColumnOrSuperColumn(counter_column=CounterColumn('c1', d2))),
             ]}}
         client.batch_mutate(update_map, ConsistencyLevel.ONE)
         time.sleep(5)
-        rv1 = client.get_counter('key1', ColumnPath(column_family='Counter1', column='c1'), ConsistencyLevel.ONE)
-        assert rv1.column.value == d1+d2
+        rv1 = client.get('key1', ColumnPath(column_family='Counter1', column='c1'), ConsistencyLevel.ONE)
+        assert rv1.counter_column.value == d1+d2
 
         # remove the previous column and check that it is gone
         update_map = {'key1': {'Counter1': [
@@ -1679,24 +1672,24 @@ class TestMutations(ThriftTester):
             ]}}
         client.batch_mutate(update_map, ConsistencyLevel.ONE)
         time.sleep(5)
-        _assert_no_columnpath_counter('key1', ColumnPath(column_family='Counter1', column='c1'))
+        _assert_no_columnpath('key1', ColumnPath(column_family='Counter1', column='c1'))
 
         # insert again and this time delete the whole row, check that it is gone
         update_map = {'key1': {'Counter1': [
-            Mutation(counter=Counter(column=CounterColumn('c1', d1))),
-            Mutation(counter=Counter(column=CounterColumn('c1', d2))),
+            Mutation(column_or_supercolumn=ColumnOrSuperColumn(counter_column=CounterColumn('c1', d1))),
+            Mutation(column_or_supercolumn=ColumnOrSuperColumn(counter_column=CounterColumn('c1', d2))),
             ]}}
         client.batch_mutate(update_map, ConsistencyLevel.ONE)
         time.sleep(5)
-        rv2 = client.get_counter('key1', ColumnPath(column_family='Counter1', column='c1'), ConsistencyLevel.ONE)
-        assert rv2.column.value == d1+d2
+        rv2 = client.get('key1', ColumnPath(column_family='Counter1', column='c1'), ConsistencyLevel.ONE)
+        assert rv2.counter_column.value == d1+d2
 
         update_map = {'key1': {'Counter1': [
             Mutation(deletion=Deletion()),
             ]}}
         client.batch_mutate(update_map, ConsistencyLevel.ONE)
         time.sleep(5)
-        _assert_no_columnpath_counter('key1', ColumnPath(column_family='Counter1', column='c1'))
+        _assert_no_columnpath('key1', ColumnPath(column_family='Counter1', column='c1'))
         
     def test_incr_decr_standard_slice(self):
         _set_keyspace('Keyspace1')
@@ -1712,10 +1705,10 @@ class TestMutations(ThriftTester):
 
         time.sleep(0.1)
         # insert positive and negative values and check the counts
-        counters = client.get_counter_slice('key1', ColumnParent('Counter1'), SlicePredicate(['c3', 'c4']), ConsistencyLevel.ONE)
+        counters = client.get_slice('key1', ColumnParent('Counter1'), SlicePredicate(['c3', 'c4']), ConsistencyLevel.ONE)
         
-        assert counters[0].column.value == d1+d2
-        assert counters[1].column.value == d1
+        assert counters[0].counter_column.value == d1+d2
+        assert counters[1].counter_column.value == d1
          
     def test_incr_decr_standard_muliget_slice(self):
         _set_keyspace('Keyspace1')
@@ -1737,12 +1730,12 @@ class TestMutations(ThriftTester):
 
         time.sleep(0.1)
         # insert positive and negative values and check the counts
-        counters = client.multiget_counter_slice(['key1', 'key2'], ColumnParent('Counter1'), SlicePredicate(['c3', 'c4']), ConsistencyLevel.ONE)
+        counters = client.multiget_slice(['key1', 'key2'], ColumnParent('Counter1'), SlicePredicate(['c3', 'c4']), ConsistencyLevel.ONE)
         
-        assert counters['key1'][0].column.value == d1+d2
-        assert counters['key1'][1].column.value == d1   
-        assert counters['key2'][0].column.value == d1+d2
-        assert counters['key2'][1].column.value == d1
+        assert counters['key1'][0].counter_column.value == d1+d2
+        assert counters['key1'][1].counter_column.value == d1   
+        assert counters['key2'][0].counter_column.value == d1+d2
+        assert counters['key2'][1].counter_column.value == d1
 
     def test_index_scan(self):
         _set_keyspace('Keyspace1')

Modified: cassandra/trunk/tools/stress/src/org/apache/cassandra/stress/operations/CounterAdder.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/tools/stress/src/org/apache/cassandra/stress/operations/CounterAdder.java?rev=1090842&r1=1090841&r2=1090842&view=diff
==============================================================================
--- cassandra/trunk/tools/stress/src/org/apache/cassandra/stress/operations/CounterAdder.java (original)
+++ cassandra/trunk/tools/stress/src/org/apache/cassandra/stress/operations/CounterAdder.java Sun Apr 10 17:31:15 2011
@@ -111,8 +111,8 @@ public class CounterAdder extends Operat
 
         for (CounterSuperColumn s : superColumns)
         {
-            Counter counter = new Counter().setSuper_column(s);
-            mutations.add(new Mutation().setCounter(counter));
+            ColumnOrSuperColumn cosc = new ColumnOrSuperColumn().setCounter_super_column(s);
+            mutations.add(new Mutation().setColumn_or_supercolumn(cosc));
         }
 
         mutationMap.put("SuperCounter1", mutations);
@@ -127,8 +127,8 @@ public class CounterAdder extends Operat
 
         for (CounterColumn c : columns)
         {
-            Counter counter = new Counter().setColumn(c);
-            mutations.add(new Mutation().setCounter(counter));
+            ColumnOrSuperColumn cosc = new ColumnOrSuperColumn().setCounter_column(c);
+            mutations.add(new Mutation().setColumn_or_supercolumn(cosc));
         }
 
         mutationMap.put("Counter1", mutations);

Modified: cassandra/trunk/tools/stress/src/org/apache/cassandra/stress/operations/CounterGetter.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/tools/stress/src/org/apache/cassandra/stress/operations/CounterGetter.java?rev=1090842&r1=1090841&r2=1090842&view=diff
==============================================================================
--- cassandra/trunk/tools/stress/src/org/apache/cassandra/stress/operations/CounterGetter.java (original)
+++ cassandra/trunk/tools/stress/src/org/apache/cassandra/stress/operations/CounterGetter.java Sun Apr 10 17:31:15 2011
@@ -77,8 +77,8 @@ public class CounterGetter extends Opera
 
                 try
                 {
-                    List<Counter> counters;
-                    counters = client.get_counter_slice(key, parent, predicate, session.getConsistencyLevel());
+                    List<ColumnOrSuperColumn> counters;
+                    counters = client.get_slice(key, parent, predicate, session.getConsistencyLevel());
                     success = (counters.size() != 0);
                 }
                 catch (Exception e)
@@ -122,8 +122,8 @@ public class CounterGetter extends Opera
 
             try
             {
-                List<Counter> counters;
-                counters = client.get_counter_slice(keyBuffer, parent, predicate, session.getConsistencyLevel());
+                List<ColumnOrSuperColumn> counters;
+                counters = client.get_slice(keyBuffer, parent, predicate, session.getConsistencyLevel());
                 success = (counters.size() != 0);
             }
             catch (Exception e)



Mime
View raw message