cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1022147 [1/3] - in /cassandra/trunk: ./ src/java/org/apache/cassandra/avro/ src/java/org/apache/cassandra/config/ src/java/org/apache/cassandra/db/ src/java/org/apache/cassandra/db/clock/ src/java/org/apache/cassandra/db/filter/ src/java/o...
Date Wed, 13 Oct 2010 15:43:25 GMT
Author: jbellis
Date: Wed Oct 13 15:43:18 2010
New Revision: 1022147

URL: http://svn.apache.org/viewvc?rev=1022147&view=rev
Log:
removed IClock & related classes from internals.
patch by Sylvain Lebresne; reviewed by jbellis for CASSANDRA-1502

Removed:
    cassandra/trunk/src/java/org/apache/cassandra/db/ClockType.java
    cassandra/trunk/src/java/org/apache/cassandra/db/IClock.java
    cassandra/trunk/src/java/org/apache/cassandra/db/TimestampClock.java
    cassandra/trunk/src/java/org/apache/cassandra/db/clock/AbstractReconciler.java
    cassandra/trunk/src/java/org/apache/cassandra/db/clock/TimestampReconciler.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/clock/TimestampReconcilerTest.java
Modified:
    cassandra/trunk/CHANGES.txt
    cassandra/trunk/src/java/org/apache/cassandra/avro/AvroValidation.java
    cassandra/trunk/src/java/org/apache/cassandra/avro/CassandraServer.java
    cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java
    cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
    cassandra/trunk/src/java/org/apache/cassandra/db/Column.java
    cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamily.java
    cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilySerializer.java
    cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
    cassandra/trunk/src/java/org/apache/cassandra/db/ColumnSerializer.java
    cassandra/trunk/src/java/org/apache/cassandra/db/DefsTable.java
    cassandra/trunk/src/java/org/apache/cassandra/db/DeletedColumn.java
    cassandra/trunk/src/java/org/apache/cassandra/db/ExpiringColumn.java
    cassandra/trunk/src/java/org/apache/cassandra/db/HintedHandOffManager.java
    cassandra/trunk/src/java/org/apache/cassandra/db/IColumn.java
    cassandra/trunk/src/java/org/apache/cassandra/db/IColumnContainer.java
    cassandra/trunk/src/java/org/apache/cassandra/db/Memtable.java
    cassandra/trunk/src/java/org/apache/cassandra/db/RowMutation.java
    cassandra/trunk/src/java/org/apache/cassandra/db/SuperColumn.java
    cassandra/trunk/src/java/org/apache/cassandra/db/SystemTable.java
    cassandra/trunk/src/java/org/apache/cassandra/db/Table.java
    cassandra/trunk/src/java/org/apache/cassandra/db/filter/QueryFilter.java
    cassandra/trunk/src/java/org/apache/cassandra/db/filter/SliceQueryFilter.java
    cassandra/trunk/src/java/org/apache/cassandra/db/migration/Migration.java
    cassandra/trunk/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java
    cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
    cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraServer.java
    cassandra/trunk/src/java/org/apache/cassandra/tools/SSTableExport.java
    cassandra/trunk/src/java/org/apache/cassandra/tools/SSTableImport.java
    cassandra/trunk/src/java/org/apache/cassandra/utils/FBUtilities.java
    cassandra/trunk/test/long/org/apache/cassandra/db/LongCompactionSpeedTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/Util.java
    cassandra/trunk/test/unit/org/apache/cassandra/config/DatabaseDescriptorTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/ColumnFamilyTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/CompactionsPurgeTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/CompactionsTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/DefsTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/MultitableTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/NameSortTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/OneCompactionTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/ReadMessageTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/RecoveryManager2Test.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/RecoveryManager3Test.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/RecoveryManagerTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/RecoveryManagerTruncateTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnFamilyTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush1Test.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush2Test.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveSubColumnTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveSuperColumnTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/RowIterationTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/RowTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/SuperColumnTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/TableTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/TimeSortTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/io/LazilyCompactedRowTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/io/sstable/SSTableUtils.java
    cassandra/trunk/test/unit/org/apache/cassandra/io/sstable/SSTableWriterTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/service/AntiEntropyServiceTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/service/ReadResponseResolverTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/tools/SSTableExportTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/utils/FBUtilitiesTest.java

Modified: cassandra/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/trunk/CHANGES.txt?rev=1022147&r1=1022146&r2=1022147&view=diff
==============================================================================
--- cassandra/trunk/CHANGES.txt (original)
+++ cassandra/trunk/CHANGES.txt Wed Oct 13 15:43:18 2010
@@ -30,6 +30,7 @@ dev
  * avoid blocking for dead nodes during removetoken (CASSANDRA-1605)
  * remove ConsistencyLevel.ZERO (CASSANDRA-1607)
  * expose in-progress compaction type in jmx (CASSANDRA-1586)
+ * removed IClock & related classes from internals (CASSANDRA-1502)
 
 
 0.7-beta2

Modified: cassandra/trunk/src/java/org/apache/cassandra/avro/AvroValidation.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/avro/AvroValidation.java?rev=1022147&r1=1022146&r2=1022147&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/avro/AvroValidation.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/avro/AvroValidation.java Wed Oct 13 15:43:18 2010
@@ -29,11 +29,9 @@ import java.util.Set;
 import org.apache.avro.util.Utf8;
 import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.db.ColumnFamily;
-import org.apache.cassandra.db.IClock;
 import org.apache.cassandra.db.IColumn;
 import org.apache.cassandra.db.ColumnFamilyType;
 import org.apache.cassandra.db.Table;
-import org.apache.cassandra.db.TimestampClock;
 import org.apache.cassandra.db.marshal.AbstractType;
 import org.apache.cassandra.db.marshal.MarshalException;
 import org.apache.cassandra.dht.IPartitioner;

Modified: cassandra/trunk/src/java/org/apache/cassandra/avro/CassandraServer.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/avro/CassandraServer.java?rev=1022147&r1=1022146&r2=1022147&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/avro/CassandraServer.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/avro/CassandraServer.java Wed Oct 13 15:43:18 2010
@@ -60,8 +60,6 @@ import org.apache.cassandra.config.Confi
 import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.config.KSMetaData;
 import org.apache.cassandra.db.*;
-import org.apache.cassandra.db.clock.AbstractReconciler;
-import org.apache.cassandra.db.clock.TimestampReconciler;
 import org.apache.cassandra.db.filter.QueryPath;
 import org.apache.cassandra.db.marshal.MarshalException;
 import org.apache.cassandra.db.migration.AddColumnFamily;
@@ -223,7 +221,7 @@ public class CassandraServer implements 
             if (column.isMarkedForDelete())
                 continue;
             
-            Column avroColumn = newColumn(column.name(), column.value(), ((TimestampClock)column.clock()).timestamp());
+            Column avroColumn = newColumn(column.name(), column.value(), column.timestamp());
             avroColumns.add(avroColumn);
         }
         
@@ -238,7 +236,7 @@ public class CassandraServer implements 
             if (column.isMarkedForDelete())
                 continue;
             
-            Column avroColumn = newColumn(column.name(), column.value(), ((TimestampClock)column.clock()).timestamp());
+            Column avroColumn = newColumn(column.name(), column.value(), column.timestamp());
             
             if (column instanceof ExpiringColumn)
                 avroColumn.ttl = ((ExpiringColumn)column).getTimeToLive();
@@ -407,7 +405,7 @@ public class CassandraServer implements 
                    parent.super_column == null ? null : parent.super_column.array(),
                    column.name.array()),
                    column.value.array(),
-                   unavronateClock(column.timestamp),
+                   column.timestamp,
                    column.ttl == null ? 0 : column.ttl);
         }
         catch (MarshalException e)
@@ -430,7 +428,7 @@ public class CassandraServer implements 
 
         RowMutation rm = new RowMutation(state().getKeyspace(), key.array());
         byte[] superName = columnPath.super_column == null ? null : columnPath.super_column.array();
-        rm.delete(new QueryPath(columnPath.column_family.toString(), superName), unavronateClock(timestamp));
+        rm.delete(new QueryPath(columnPath.column_family.toString(), superName), timestamp);
         
         doInsert(consistencyLevel, rm);
         
@@ -503,11 +501,6 @@ public class CassandraServer implements 
         return null;
     }
 
-    private static IClock unavronateClock(long timestamp)
-    {
-        return new org.apache.cassandra.db.TimestampClock(timestamp);
-    }
-    
     // FIXME: This is copypasta from o.a.c.db.RowMutation, (RowMutation.getRowMutation uses Thrift types directly).
     private static RowMutation getRowMutationFromMutations(String keyspace, byte[] key, Map<CharSequence, List<Mutation>> cfMap)
     {
@@ -535,11 +528,11 @@ public class CassandraServer implements 
         if (cosc.column == null)
         {
             for (Column column : cosc.super_column.columns)
-                rm.add(new QueryPath(cfName, cosc.super_column.name.array(), column.name.array()), column.value.array(), unavronateClock(column.timestamp));
+                rm.add(new QueryPath(cfName, cosc.super_column.name.array(), column.name.array()), column.value.array(), column.timestamp);
         }
         else
         {
-            rm.add(new QueryPath(cfName, null, cosc.column.name.array()), cosc.column.value.array(), unavronateClock(cosc.column.timestamp));
+            rm.add(new QueryPath(cfName, null, cosc.column.name.array()), cosc.column.value.array(), cosc.column.timestamp);
         }
     }
     
@@ -553,14 +546,14 @@ public class CassandraServer implements 
             for (ByteBuffer col : del.predicate.column_names)
             {
                 if (del.super_column == null && DatabaseDescriptor.getColumnFamilyType(rm.getTable(), cfName) == ColumnFamilyType.Super)
-                    rm.delete(new QueryPath(cfName, col.array()), unavronateClock(del.timestamp));
+                    rm.delete(new QueryPath(cfName, col.array()), del.timestamp);
                 else
-                    rm.delete(new QueryPath(cfName, superName, col.array()), unavronateClock(del.timestamp));
+                    rm.delete(new QueryPath(cfName, superName, col.array()), del.timestamp);
             }
         }
         else
         {
-            rm.delete(new QueryPath(cfName, superName), unavronateClock(del.timestamp));
+            rm.delete(new QueryPath(cfName, superName), del.timestamp);
         }
     }
     
@@ -842,10 +835,8 @@ public class CassandraServer implements 
         return new CFMetaData(cf_def.keyspace.toString(),
                               cf_def.name.toString(),
                               ColumnFamilyType.create(cfType),
-                              ClockType.Timestamp,
                               DatabaseDescriptor.getComparator(compare),
                               subCompare.length() == 0 ? null : DatabaseDescriptor.getComparator(subCompare),
-                              TimestampReconciler.instance,
                               cf_def.comment == null ? "" : cf_def.comment.toString(),
                               cf_def.row_cache_size == null ? CFMetaData.DEFAULT_ROW_CACHE_SIZE : cf_def.row_cache_size,
                               cf_def.preload_row_cache == null ? CFMetaData.DEFAULT_PRELOAD_ROW_CACHE : cf_def.preload_row_cache,

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=1022147&r1=1022146&r2=1022147&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java Wed Oct 13 15:43:18 2010
@@ -30,8 +30,6 @@ import org.apache.commons.lang.builder.H
 import org.apache.avro.util.Utf8;
 import org.apache.cassandra.avro.ColumnDef;
 import org.apache.cassandra.db.*;
-import org.apache.cassandra.db.clock.AbstractReconciler;
-import org.apache.cassandra.db.clock.TimestampReconciler;
 import org.apache.cassandra.db.marshal.AbstractType;
 import org.apache.cassandra.db.marshal.BytesType;
 import org.apache.cassandra.db.marshal.TimeUUIDType;
@@ -71,10 +69,8 @@ public final class CFMetaData
         return new CFMetaData(Table.SYSTEM_TABLE,
                               cfName,
                               subComparator == null ? ColumnFamilyType.Standard : ColumnFamilyType.Super,
-                              ClockType.Timestamp,
                               comparator,
                               subComparator,
-                              TimestampReconciler.instance,
                               comment,
                               0,
                               false,
@@ -117,10 +113,8 @@ public final class CFMetaData
     public final String tableName;                  // name of table which has this column family
     public final String cfName;                     // name of the column family
     public final ColumnFamilyType cfType;           // type: super, standard, etc.
-    public final ClockType clockType;               // clock type: timestamp, etc.
     public final AbstractType comparator;           // name sorted, time stamp sorted etc.
     public final AbstractType subcolumnComparator;  // like comparator, for supercolumns
-    public final AbstractReconciler reconciler;     // determine correct column from conflicting versions
     public final String comment;                    // for humans only
 
     public final double rowCacheSize;               // default 0
@@ -140,10 +134,8 @@ public final class CFMetaData
     private CFMetaData(String tableName,
                        String cfName,
                        ColumnFamilyType cfType,
-                       ClockType clockType,
                        AbstractType comparator,
                        AbstractType subcolumnComparator,
-                       AbstractReconciler reconciler,
                        String comment,
                        double rowCacheSize,
                        boolean preloadRowCache,
@@ -163,12 +155,10 @@ public final class CFMetaData
         this.tableName = tableName;
         this.cfName = cfName;
         this.cfType = cfType;
-        this.clockType = clockType;
         this.comparator = comparator;
         // the default subcolumncomparator is null per thrift spec, but only should be null if cfType == Standard. If
         // cfType == Super, subcolumnComparator should default to BytesType if not set.
         this.subcolumnComparator = subcolumnComparator == null && cfType == ColumnFamilyType.Super ? BytesType.instance : subcolumnComparator;
-        this.reconciler = reconciler;
         this.comment = comment == null ? "" : comment;
         this.rowCacheSize = rowCacheSize;
         this.preloadRowCache = preloadRowCache;
@@ -199,10 +189,8 @@ public final class CFMetaData
     public CFMetaData(String tableName,
                       String cfName,
                       ColumnFamilyType cfType,
-                      ClockType clockType,
                       AbstractType comparator,
                       AbstractType subcolumnComparator,
-                      AbstractReconciler reconciler,
                       String comment,
                       double rowCacheSize,
                       boolean preloadRowCache,
@@ -218,10 +206,8 @@ public final class CFMetaData
         this(tableName,
              cfName,
              cfType,
-             clockType,
              comparator,
              subcolumnComparator,
-             reconciler,
              comment,
              rowCacheSize,
              preloadRowCache,
@@ -242,10 +228,8 @@ public final class CFMetaData
         return new CFMetaData(table,
                               parentCf + "." + (info.index_name == null ? FBUtilities.bytesToHex(info.name) : info.index_name),
                               ColumnFamilyType.Standard,
-                              ClockType.Timestamp,
                               columnComparator,
                               null,
-                              TimestampReconciler.instance,
                               "",
                               0,
                               false,
@@ -264,10 +248,8 @@ public final class CFMetaData
         return new CFMetaData(cfm.tableName,
                               newName,
                               cfm.cfType,
-                              cfm.clockType,
                               cfm.comparator,
                               cfm.subcolumnComparator,
-                              cfm.reconciler,
                               cfm.comment,
                               cfm.rowCacheSize,
                               cfm.preloadRowCache,
@@ -289,10 +271,8 @@ public final class CFMetaData
         return new CFMetaData(tableName,
                               cfm.cfName,
                               cfm.cfType,
-                              cfm.clockType,
                               cfm.comparator,
                               cfm.subcolumnComparator,
-                              cfm.reconciler,
                               cfm.comment,
                               cfm.rowCacheSize,
                               cfm.preloadRowCache,
@@ -320,7 +300,6 @@ public final class CFMetaData
     {
         return tableName + "." + cfName + "\n"
                + "Column Family Type: " + cfType + "\n"
-               + "Column Family Clock Type: " + clockType + "\n"
                + "Columns Sorted By: " + comparator + "\n";
     }
 
@@ -384,10 +363,8 @@ public final class CFMetaData
         return new CFMetaData(cf.keyspace.toString(),
                               cf.name.toString(),
                               ColumnFamilyType.create(cf.column_type.toString()),
-                              ClockType.Timestamp,
                               comparator,
                               subcolumnComparator,
-                              TimestampReconciler.instance,
                               cf.comment.toString(),
                               cf.row_cache_size,
                               cf.preload_row_cache,
@@ -419,10 +396,8 @@ public final class CFMetaData
             .append(tableName, rhs.tableName)
             .append(cfName, rhs.cfName)
             .append(cfType, rhs.cfType)
-            .append(clockType, rhs.clockType)
             .append(comparator, rhs.comparator)
             .append(subcolumnComparator, rhs.subcolumnComparator)
-            .append(reconciler, rhs.reconciler)
             .append(comment, rhs.comment)
             .append(rowCacheSize, rhs.rowCacheSize)
             .append(keyCacheSize, rhs.keyCacheSize)
@@ -443,10 +418,8 @@ public final class CFMetaData
             .append(tableName)
             .append(cfName)
             .append(cfType)
-            .append(clockType)
             .append(comparator)
             .append(subcolumnComparator)
-            .append(reconciler)
             .append(comment)
             .append(rowCacheSize)
             .append(keyCacheSize)
@@ -503,10 +476,8 @@ public final class CFMetaData
         return new CFMetaData(tableName, 
                               cfName, 
                               cfType, 
-                              clockType, 
                               comparator, 
                               subcolumnComparator, 
-                              reconciler, 
                               cf_def.comment == null ? "" : cf_def.comment.toString(), 
                               cf_def.row_cache_size, 
                               cf_def.preload_row_cache, 
@@ -564,10 +535,8 @@ public final class CFMetaData
         return new CFMetaData(tableName, 
                               cfName, 
                               cfType, 
-                              clockType, 
                               comparator, 
                               subcolumnComparator, 
-                              reconciler, 
                               cf_def.comment, 
                               cf_def.row_cache_size, 
                               cf_def.preload_row_cache, 

Modified: cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java?rev=1022147&r1=1022146&r2=1022147&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java Wed Oct 13 15:43:18 2010
@@ -34,12 +34,9 @@ import org.apache.cassandra.auth.AllowAl
 import org.apache.cassandra.auth.IAuthenticator;
 import org.apache.cassandra.auth.IAuthority;
 import org.apache.cassandra.config.Config.RequestSchedulerId;
-import org.apache.cassandra.db.ClockType;
 import org.apache.cassandra.db.ColumnFamilyType;
 import org.apache.cassandra.db.DefsTable;
 import org.apache.cassandra.db.Table;
-import org.apache.cassandra.db.clock.AbstractReconciler;
-import org.apache.cassandra.db.clock.TimestampReconciler;
 import org.apache.cassandra.db.commitlog.CommitLog;
 import org.apache.cassandra.db.marshal.AbstractType;
 import org.apache.cassandra.db.migration.Migration;
@@ -590,10 +587,8 @@ public class    DatabaseDescriptor
                 cfDefs[j++] = new CFMetaData(keyspace.name, 
                                              cf.name, 
                                              cfType,
-                                             ClockType.Timestamp,
                                              comparator, 
                                              subcolumnComparator, 
-                                             TimestampReconciler.instance, 
                                              cf.comment, 
                                              cf.rows_cached,
                                              cf.preload_row_cache, 
@@ -648,30 +643,6 @@ public class    DatabaseDescriptor
         return FBUtilities.getComparator(compareWith);
     }
 
-    public static AbstractReconciler getReconciler(String reconcileWith) throws ConfigurationException
-    {
-        if (reconcileWith == null || reconcileWith.length() == 0)
-        {
-            return null;
-        }
-
-        String className = reconcileWith.indexOf('.') >= 0 ? reconcileWith : TimestampReconciler.class.getPackage().getName() + '.' + reconcileWith;
-        Class<? extends AbstractReconciler> reconcilerClass = FBUtilities.<AbstractReconciler>classForName(className, "reconciler");
-        try
-        {
-            Field field = reconcilerClass.getDeclaredField("instance");
-            return (AbstractReconciler) field.get(null);
-        }
-        catch (NoSuchFieldException e)
-        {
-            throw new ConfigurationException("Invalid reconciler: must define a public static instance field.", e);
-        }
-        catch (IllegalAccessException e)
-        {
-            throw new ConfigurationException("Invalid reconciler: must define a public static instance field.", e);
-        }
-    }
-
     /**
      * Creates all storage-related directories.
      * @throws IOException when a disk problem is encountered.
@@ -822,15 +793,6 @@ public class    DatabaseDescriptor
         return cfMetaData.cfType;
     }
 
-    public static ClockType getClockType(String tableName, String cfName)
-    {
-        assert tableName != null && cfName != null;
-        CFMetaData cfMetaData = getCFMetaData(tableName, cfName);
-
-        assert (cfMetaData != null);
-        return cfMetaData.clockType;
-    }
-
     public static Set<String> getTables()
     {
         return tables.keySet();
@@ -990,15 +952,6 @@ public class    DatabaseDescriptor
         return getCFMetaData(tableName, cfName).subcolumnComparator;
     }
 
-    public static AbstractReconciler getReconciler(String tableName, String cfName)
-    {
-        assert tableName != null;
-        CFMetaData cfmd = getCFMetaData(tableName, cfName);
-        if (cfmd == null)
-            throw new NullPointerException("Unknown ColumnFamily " + cfName + " in keyspace " + tableName);
-        return cfmd.reconciler;
-    }
-
     /**
      * @return The absolute number of keys that should be cached per table.
      */

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/Column.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/Column.java?rev=1022147&r1=1022146&r2=1022147&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/Column.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/Column.java Wed Oct 13 15:43:18 2010
@@ -28,7 +28,6 @@ import org.slf4j.LoggerFactory;
 import org.apache.commons.lang.ArrayUtils;
 
 import org.apache.cassandra.db.marshal.AbstractType;
-import org.apache.cassandra.db.IClock.ClockRelationship;
 import org.apache.cassandra.io.util.DataOutputBuffer;
 import org.apache.cassandra.utils.FBUtilities;
 
@@ -43,14 +42,14 @@ public class Column implements IColumn
 {
     private static Logger logger = LoggerFactory.getLogger(Column.class);
 
-    public static ColumnSerializer serializer(ClockType clockType)
+    public static ColumnSerializer serializer()
     {
-        return new ColumnSerializer(clockType);
+        return new ColumnSerializer();
     }
 
     protected final byte[] name;
     protected final byte[] value;
-    protected final IClock clock;
+    protected final long timestamp;
 
     Column(byte[] name)
     {
@@ -59,18 +58,17 @@ public class Column implements IColumn
 
     public Column(byte[] name, byte[] value)
     {
-        // safe to set to null, only used for filter comparisons
-        this(name, value, null);
+        this(name, value, 0);
     }
 
-    public Column(byte[] name, byte[] value, IClock clock)
+    public Column(byte[] name, byte[] value, long timestamp)
     {
         assert name != null;
         assert value != null;
         assert name.length <= IColumn.MAX_NAME_LENGTH;
         this.name = name;
         this.value = value;
-        this.clock = clock;
+        this.timestamp = timestamp;
     }
 
     public byte[] name()
@@ -93,9 +91,9 @@ public class Column implements IColumn
         throw new UnsupportedOperationException("This operation is unsupported on simple columns.");
     }
 
-    public IClock clock()
+    public long timestamp()
     {
-        return clock;
+        return timestamp;
     }
 
     public boolean isMarkedForDelete()
@@ -103,14 +101,14 @@ public class Column implements IColumn
         return false;
     }
 
-    public IClock getMarkedForDeleteAt()
+    public long getMarkedForDeleteAt()
     {
         throw new IllegalStateException("column is not marked for delete");
     }
 
-    public IClock mostRecentLiveChangeAt()
+    public long mostRecentLiveChangeAt()
     {
-        return clock;
+        return timestamp;
     }
 
     public int size()
@@ -119,11 +117,11 @@ public class Column implements IColumn
          * Size of a column is =
          *   size of a name (short + length of the string)
          * + 1 byte to indicate if the column has been deleted
-         * + x bytes depending on IClock size
+         * + 8 bytes for timestamp
          * + 4 bytes which basically indicates the size of the byte array
          * + entire byte array.
         */
-        return DBConstants.shortSize_ + name.length + DBConstants.boolSize_ + clock.size() + DBConstants.intSize_ + value.length;
+        return DBConstants.shortSize_ + name.length + DBConstants.boolSize_ + DBConstants.tsSize_ + DBConstants.intSize_ + value.length;
     }
 
     /*
@@ -142,7 +140,7 @@ public class Column implements IColumn
 
     public IColumn diff(IColumn column)
     {
-        if (ClockRelationship.GREATER_THAN == column.clock().compare(clock))
+        if (timestamp() < column.timestamp())
         {
             return column;
         }
@@ -156,7 +154,7 @@ public class Column implements IColumn
         DataOutputBuffer buffer = new DataOutputBuffer();
         try
         {
-            clock.serialize(buffer);
+            buffer.writeLong(timestamp);
             buffer.writeByte((isMarkedForDelete()) ? ColumnSerializer.DELETION_MASK : 0);
         }
         catch (IOException e)
@@ -171,6 +169,20 @@ public class Column implements IColumn
         throw new IllegalStateException("column is not marked for delete");
     }
 
+    public IColumn reconcile(IColumn column)
+    {
+        // tombstones take precedence.  (if both are tombstones, then it doesn't matter which one we use.)
+        if (isMarkedForDelete())
+            return timestamp() < column.timestamp() ? column : this;
+        if (column.isMarkedForDelete())
+            return timestamp() > column.timestamp() ? this : column;
+        // break ties by comparing values.
+        if (timestamp() == column.timestamp())
+            return FBUtilities.compareByteArrays(value(), column.value()) < 0 ? column : this;
+        // neither is tombstoned and timestamps are different
+        return timestamp() < column.timestamp() ? column : this;
+    }
+
     @Override
     public boolean equals(Object o)
     {
@@ -181,7 +193,7 @@ public class Column implements IColumn
 
         Column column = (Column)o;
 
-        if (clock != null ? !clock.equals(column.clock) : column.clock != null)
+        if (timestamp != column.timestamp)
             return false;
         if (!Arrays.equals(name, column.name))
             return false;
@@ -194,7 +206,7 @@ public class Column implements IColumn
     {
         int result = name != null ? Arrays.hashCode(name) : 0;
         result = 31 * result + (value != null ? Arrays.hashCode(value) : 0);
-        result = 31 * result + (clock != null ? clock.hashCode() : 0);
+        result = 31 * result + (int)(timestamp ^ (timestamp >>> 32));
         return result;
     }
 
@@ -207,7 +219,7 @@ public class Column implements IColumn
         sb.append(":");
         sb.append(value.length);
         sb.append("@");
-        sb.append(clock.toString());
+        sb.append(timestamp());
         return sb.toString();
     }
 }

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamily.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamily.java?rev=1022147&r1=1022146&r2=1022147&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamily.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamily.java Wed Oct 13 15:43:18 2010
@@ -23,12 +23,10 @@ import java.util.concurrent.ConcurrentSk
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicReference;
+import java.util.concurrent.atomic.AtomicLong;
 
 import org.apache.cassandra.config.CFMetaData;
 
-import org.apache.cassandra.db.IClock.ClockRelationship;
-import org.apache.cassandra.db.clock.AbstractReconciler;
 import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.dht.BytesToken;
 import org.apache.cassandra.dht.LocalPartitioner;
@@ -65,33 +63,28 @@ public class ColumnFamily implements ICo
     public static ColumnFamily create(CFMetaData cfm)
     {
         assert cfm != null;
-        return new ColumnFamily(cfm.cfType, cfm.clockType, cfm.comparator, cfm.subcolumnComparator, cfm.reconciler, cfm.cfId);
+        return new ColumnFamily(cfm.cfType, cfm.comparator, cfm.subcolumnComparator, cfm.cfId);
     }
 
     private final Integer cfid;
     private final ColumnFamilyType type;
-    private final ClockType clockType;
-    private final AbstractReconciler reconciler;
 
     private transient ICompactSerializer2<IColumn> columnSerializer;
-    final AtomicReference<IClock> markedForDeleteAt;
+    final AtomicLong markedForDeleteAt = new AtomicLong(Long.MIN_VALUE);
     final AtomicInteger localDeletionTime = new AtomicInteger(Integer.MIN_VALUE);
     private ConcurrentSkipListMap<byte[], IColumn> columns;
 
-    public ColumnFamily(ColumnFamilyType type, ClockType clockType, AbstractType comparator, AbstractType subcolumnComparator, AbstractReconciler reconciler, Integer cfid)
+    public ColumnFamily(ColumnFamilyType type, AbstractType comparator, AbstractType subcolumnComparator, Integer cfid)
     {
         this.type = type;
-        this.clockType = clockType;
-        this.reconciler = reconciler;
-        this.markedForDeleteAt = new AtomicReference<IClock>(clockType.minClock());
-        columnSerializer = type == ColumnFamilyType.Standard ? Column.serializer(clockType) : SuperColumn.serializer(subcolumnComparator, clockType, reconciler);
+        columnSerializer = type == ColumnFamilyType.Standard ? Column.serializer() : SuperColumn.serializer(subcolumnComparator);
         columns = new ConcurrentSkipListMap<byte[], IColumn>(comparator);
         this.cfid = cfid;
      }
     
     public ColumnFamily cloneMeShallow()
     {
-        ColumnFamily cf = new ColumnFamily(type, clockType, getComparator(), getSubComparator(), reconciler, cfid);
+        ColumnFamily cf = new ColumnFamily(type, getComparator(), getSubComparator(), cfid);
         cf.markedForDeleteAt.set(markedForDeleteAt.get());
         cf.localDeletionTime.set(localDeletionTime.get());
         return cf;
@@ -107,16 +100,6 @@ public class ColumnFamily implements ICo
         return type;
     }
 
-    public ClockType getClockType()
-    {
-        return clockType;
-    }
-    
-    public AbstractReconciler getReconciler()
-    {
-        return reconciler;
-    }
-
     public ColumnFamily cloneMe()
     {
         ColumnFamily cf = cloneMeShallow();
@@ -168,37 +151,38 @@ public class ColumnFamily implements ICo
         return type == ColumnFamilyType.Super;
     }
 
-    public void addColumn(QueryPath path, byte[] value, IClock clock)
+    public void addColumn(QueryPath path, byte[] value, long timestamp)
     {
         assert path.columnName != null : path;
-        addColumn(path.superColumnName, new Column(path.columnName, value, clock));
+        addColumn(path.superColumnName, new Column(path.columnName, value, timestamp));
     }
 
-    public void addTombstone(QueryPath path, byte[] localDeletionTime, IClock clock)
-    {
-        addColumn(path.superColumnName, new DeletedColumn(path.columnName, localDeletionTime, clock));
-    }
-
-    public void addColumn(QueryPath path, byte[] value, IClock clock, int timeToLive)
+    public void addColumn(QueryPath path, byte[] value, long timestamp, int timeToLive)
     {
         assert path.columnName != null : path;
         Column column;
         if (timeToLive > 0)
-            column = new ExpiringColumn(path.columnName, value, clock, timeToLive);
+            column = new ExpiringColumn(path.columnName, value, timestamp, timeToLive);
         else
-            column = new Column(path.columnName, value, clock);
+            column = new Column(path.columnName, value, timestamp);
         addColumn(path.superColumnName, column);
     }
 
-    public void deleteColumn(byte[] column, int localDeletionTime, IClock clock)
+    public void addTombstone(QueryPath path, byte[] localDeletionTime, long timestamp)
     {
-        addColumn(null, new DeletedColumn(column, localDeletionTime, clock));
+        assert path.columnName != null : path;
+        addColumn(path.superColumnName, new DeletedColumn(path.columnName, localDeletionTime, timestamp));
     }
 
-    public void deleteColumn(QueryPath path, int localDeletionTime, IClock clock)
+    public void addTombstone(QueryPath path, int localDeletionTime, long timestamp)
     {
         assert path.columnName != null : path;
-        addColumn(path.superColumnName, new DeletedColumn(path.columnName, localDeletionTime, clock));
+        addColumn(path.superColumnName, new DeletedColumn(path.columnName, localDeletionTime, timestamp));
+    }
+
+    public void addTombstone(byte[] name, int localDeletionTime, long timestamp)
+    {
+        addColumn(null, new DeletedColumn(name, localDeletionTime, timestamp));
     }
 
     public void addColumn(byte[] superColumnName, Column column)
@@ -211,7 +195,7 @@ public class ColumnFamily implements ICo
         else
         {
             assert isSuper();
-            c = new SuperColumn(superColumnName, getSubComparator(), clockType, reconciler);
+            c = new SuperColumn(superColumnName, getSubComparator());
             c.addColumn(column); // checks subcolumn name
         }
         addColumn(c);
@@ -239,13 +223,13 @@ public class ColumnFamily implements ICo
             else
             {
                 // calculate reconciled col from old (existing) col and new col
-                IColumn reconciledColumn = reconciler.reconcile((Column)column, (Column)oldColumn);
+                IColumn reconciledColumn = column.reconcile(oldColumn);
                 while (!columns.replace(name, oldColumn, reconciledColumn))
                 {
                     // if unable to replace, then get updated old (existing) col
                     oldColumn = columns.get(name);
                     // re-calculate reconciled col from updated old col and original new col
-                    reconciledColumn = reconciler.reconcile((Column)column, (Column)oldColumn);
+                    reconciledColumn = column.reconcile(oldColumn);
                     // try to re-update value, again
                 }
             }
@@ -283,10 +267,10 @@ public class ColumnFamily implements ICo
     }
 
     @Deprecated // TODO this is a hack to set initial value outside constructor
-    public void delete(int localtime, IClock clock)
+    public void delete(int localtime, long timestamp)
     {
         localDeletionTime.set(localtime);
-        markedForDeleteAt.set(clock);
+        markedForDeleteAt.set(timestamp);
     }
 
     public void delete(ColumnFamily cf2)
@@ -297,8 +281,7 @@ public class ColumnFamily implements ICo
 
     public boolean isMarkedForDelete()
     {
-        IClock _markedForDeleteAt = markedForDeleteAt.get();
-        return _markedForDeleteAt.compare(clockType.minClock()) == ClockRelationship.GREATER_THAN;
+        return markedForDeleteAt.get() > Long.MIN_VALUE;
     }
 
     /*
@@ -307,9 +290,8 @@ public class ColumnFamily implements ICo
      */
     public ColumnFamily diff(ColumnFamily cfComposite)
     {
-        ColumnFamily cfDiff = new ColumnFamily(cfComposite.type, cfComposite.clockType, getComparator(), getSubComparator(), cfComposite.reconciler, cfComposite.id());
-        ClockRelationship rel = cfComposite.getMarkedForDeleteAt().compare(getMarkedForDeleteAt());
-        if (ClockRelationship.GREATER_THAN == rel)
+        ColumnFamily cfDiff = new ColumnFamily(cfComposite.type, getComparator(), getSubComparator(), cfComposite.id());
+        if (cfComposite.getMarkedForDeleteAt() > getMarkedForDeleteAt())
         {
             cfDiff.delete(cfComposite.getLocalDeletionTime(), cfComposite.getMarkedForDeleteAt());
         }
@@ -374,7 +356,7 @@ public class ColumnFamily implements ICo
         sb.append(cfm == null ? "-deleted-" : cfm.cfName);
 
         if (isMarkedForDelete())
-            sb.append(" -deleted at " + getMarkedForDeleteAt().toString() + "-");
+            sb.append(" -deleted at " + getMarkedForDeleteAt() + "-");
 
         sb.append(" [").append(getComparator().getColumnsString(getSortedColumns())).append("])");
         return sb.toString();
@@ -403,7 +385,7 @@ public class ColumnFamily implements ICo
             column.updateDigest(digest);
     }
 
-    public IClock getMarkedForDeleteAt()
+    public long getMarkedForDeleteAt()
     {
         return markedForDeleteAt.get();
     }

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilySerializer.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilySerializer.java?rev=1022147&r1=1022146&r2=1022147&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilySerializer.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilySerializer.java Wed Oct 13 15:43:18 2010
@@ -92,8 +92,7 @@ public class ColumnFamilySerializer impl
     public void serializeCFInfo(ColumnFamily columnFamily, DataOutput dos) throws IOException
     {
         dos.writeInt(columnFamily.localDeletionTime.get());
-        IClock _markedForDeleteAt = columnFamily.markedForDeleteAt.get();
-        columnFamily.getClockType().serializer().serialize(_markedForDeleteAt, dos);
+        dos.writeLong(columnFamily.markedForDeleteAt.get());
     }
 
     public int serializeWithIndexes(ColumnFamily columnFamily, DataOutput dos)
@@ -129,7 +128,7 @@ public class ColumnFamilySerializer impl
 
     public ColumnFamily deserializeFromSSTableNoColumns(ColumnFamily cf, DataInput input) throws IOException
     {        
-        cf.delete(input.readInt(), cf.getClockType().serializer().deserialize(input));
+        cf.delete(input.readInt(), input.readLong());
         return cf;
     }
 }

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=1022147&r1=1022146&r2=1022147&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java Wed Oct 13 15:43:18 2010
@@ -41,7 +41,6 @@ import org.apache.cassandra.concurrent.S
 import org.apache.cassandra.config.CFMetaData;
 import org.apache.cassandra.config.ColumnDefinition;
 import org.apache.cassandra.config.DatabaseDescriptor;
-import org.apache.cassandra.db.IClock.ClockRelationship;
 import org.apache.cassandra.db.columniterator.IColumnIterator;
 import org.apache.cassandra.db.columniterator.IdentityQueryFilter;
 import org.apache.cassandra.db.commitlog.CommitLog;
@@ -721,18 +720,11 @@ public class ColumnFamilyStore implement
             // (a) the column itself is tombstoned or
             // (b) the CF is tombstoned and the column is not newer than it
             // (we split the test to avoid computing ClockRelationship if not necessary)
-            if ((c.isMarkedForDelete() && c.getLocalDeletionTime() <= gcBefore))
+            if ((c.isMarkedForDelete() && c.getLocalDeletionTime() <= gcBefore)
+                || c.timestamp() <= cf.getMarkedForDeleteAt())
             {
                 cf.remove(cname);
             }
-            else
-            {
-                ClockRelationship rel = c.clock().compare(cf.getMarkedForDeleteAt());
-                if ((ClockRelationship.LESS_THAN == rel) || (ClockRelationship.EQUAL == rel))
-                {
-                    cf.remove(cname);
-                }
-            }
         }
     }
 
@@ -744,26 +736,17 @@ public class ColumnFamilyStore implement
         for (Map.Entry<byte[], IColumn> entry : cf.getColumnsMap().entrySet())
         {
             SuperColumn c = (SuperColumn) entry.getValue();
-            List<IClock> clocks = Arrays.asList(cf.getMarkedForDeleteAt());
-            IClock minClock = c.getMarkedForDeleteAt().getSuperset(clocks);
+            long minTimestamp = Math.max(c.getMarkedForDeleteAt(), cf.getMarkedForDeleteAt());
             for (IColumn subColumn : c.getSubColumns())
             {
                 // remove subcolumns if
                 // (a) the subcolumn itself is tombstoned or
                 // (b) the supercolumn is tombstoned and the subcolumn is not newer than it
-                // (we split the test to avoid computing ClockRelationship if not necessary)
-                if (subColumn.isMarkedForDelete() && subColumn.getLocalDeletionTime() <= gcBefore)
+                if (subColumn.timestamp() <= minTimestamp
+                    || (subColumn.isMarkedForDelete() && subColumn.getLocalDeletionTime() <= gcBefore))
                 {
                     c.remove(subColumn.name());
                 }
-                else
-                {
-                    ClockRelationship subRel = subColumn.clock().compare(minClock);
-                    if ((ClockRelationship.LESS_THAN == subRel) || (ClockRelationship.EQUAL == subRel))
-                    {
-                        c.remove(subColumn.name());
-                    }
-                }
             }
             if (c.getSubColumns().isEmpty() && c.getLocalDeletionTime() <= gcBefore)
             {

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/ColumnSerializer.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnSerializer.java?rev=1022147&r1=1022146&r2=1022147&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/ColumnSerializer.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/ColumnSerializer.java Wed Oct 13 15:43:18 2010
@@ -33,13 +33,6 @@ public class ColumnSerializer implements
     public final static int DELETION_MASK = 0x01;
     public final static int EXPIRATION_MASK = 0x02;
 
-    private ClockType clockType;
-
-    public ColumnSerializer(ClockType clockType)
-    {
-        this.clockType = clockType;
-    }
-    
     public void serialize(IColumn column, DataOutput dos)
     {
         FBUtilities.writeShortByteArray(column.name(), dos);
@@ -52,7 +45,7 @@ public class ColumnSerializer implements
             } else {
               dos.writeByte((column.isMarkedForDelete()) ? DELETION_MASK : 0);
             }
-            clockType.serializer().serialize(column.clock(), dos);
+            dos.writeLong(column.timestamp());
             FBUtilities.writeByteArray(column.value(), dos);
         }
         catch (IOException e)
@@ -69,7 +62,7 @@ public class ColumnSerializer implements
         {
             int ttl = dis.readInt();
             int expiration = dis.readInt();
-            IClock clock = clockType.serializer().deserialize(dis);
+            long ts = dis.readLong();
             byte[] value = FBUtilities.readByteArray(dis);
             if ((int) (System.currentTimeMillis() / 1000 ) > expiration)
             {
@@ -77,22 +70,22 @@ public class ColumnSerializer implements
                 // tombstone
                 ByteBuffer bytes = ByteBuffer.allocate(4);
                 bytes.putInt(expiration);
-                return new DeletedColumn(name, bytes.array(), clock);
+                return new DeletedColumn(name, bytes.array(), ts);
             }
             else
             {
-                return new ExpiringColumn(name, value, clock, ttl, expiration);
+                return new ExpiringColumn(name, value, ts, ttl, expiration);
             }
         }
         else
         {
             boolean delete = (b & DELETION_MASK) != 0;
-            IClock clock = clockType.serializer().deserialize(dis);
+            long ts = dis.readLong();
             byte[] value = FBUtilities.readByteArray(dis);
             if ((b & DELETION_MASK) != 0) {
-                return new DeletedColumn(name, value, clock);
+                return new DeletedColumn(name, value, ts);
             } else {
-                return new Column(name, value, clock);
+                return new Column(name, value, ts);
             }
         }
     }

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/DefsTable.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/DefsTable.java?rev=1022147&r1=1022146&r2=1022147&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/DefsTable.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/DefsTable.java Wed Oct 13 15:43:18 2010
@@ -60,7 +60,7 @@ public class DefsTable
 
         // persist keyspaces under new version
         RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, versionKey);
-        TimestampClock now = new TimestampClock(System.currentTimeMillis());
+        long now = System.currentTimeMillis();
         for (String ksname : ksnames)
         {
             KSMetaData ksm = DatabaseDescriptor.getTableDefinition(ksname);

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/DeletedColumn.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/DeletedColumn.java?rev=1022147&r1=1022146&r2=1022147&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/DeletedColumn.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/DeletedColumn.java Wed Oct 13 15:43:18 2010
@@ -28,14 +28,14 @@ public class DeletedColumn extends Colum
 {
     private static Logger logger = LoggerFactory.getLogger(DeletedColumn.class);
     
-    public DeletedColumn(byte[] name, int localDeletionTime, IClock clock)
+    public DeletedColumn(byte[] name, int localDeletionTime, long timestamp)
     {
-        this(name, FBUtilities.toByteArray(localDeletionTime), clock);
+        this(name, FBUtilities.toByteArray(localDeletionTime), timestamp);
     }
 
-    public DeletedColumn(byte[] name, byte[] value, IClock clock)
+    public DeletedColumn(byte[] name, byte[] value, long timestamp)
     {
-        super(name, value, clock);
+        super(name, value, timestamp);
     }
 
     @Override
@@ -45,9 +45,9 @@ public class DeletedColumn extends Colum
     }
 
     @Override
-    public IClock getMarkedForDeleteAt()
+    public long getMarkedForDeleteAt()
     {
-        return clock;
+        return timestamp;
     }
 
     @Override

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/ExpiringColumn.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/ExpiringColumn.java?rev=1022147&r1=1022146&r2=1022147&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/ExpiringColumn.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/ExpiringColumn.java Wed Oct 13 15:43:18 2010
@@ -43,14 +43,14 @@ public class ExpiringColumn extends Colu
     private final int localExpirationTime;
     private final int timeToLive;
 
-    public ExpiringColumn(byte[] name, byte[] value, IClock clock, int timeToLive)
+    public ExpiringColumn(byte[] name, byte[] value, long timestamp, int timeToLive)
     {
-      this(name, value, clock, timeToLive, (int) (System.currentTimeMillis() / 1000) + timeToLive);
+      this(name, value, timestamp, timeToLive, (int) (System.currentTimeMillis() / 1000) + timeToLive);
     }
 
-    public ExpiringColumn(byte[] name, byte[] value, IClock clock, int timeToLive, int localExpirationTime)
+    public ExpiringColumn(byte[] name, byte[] value, long timestamp, int timeToLive, int localExpirationTime)
     {
-        super(name, value, clock);
+        super(name, value, timestamp);
         assert timeToLive > 0;
         assert localExpirationTime > 0;
         this.timeToLive = timeToLive;
@@ -87,7 +87,7 @@ public class ExpiringColumn extends Colu
         DataOutputBuffer buffer = new DataOutputBuffer();
         try
         {
-            clock.serialize(buffer);
+            buffer.writeLong(timestamp);
             buffer.writeByte(ColumnSerializer.EXPIRATION_MASK);
             buffer.writeInt(timeToLive);
         }
@@ -115,11 +115,11 @@ public class ExpiringColumn extends Colu
     }
 
     @Override
-    public IClock getMarkedForDeleteAt()
+    public long getMarkedForDeleteAt()
     {
         if (isMarkedForDelete())
         {
-            return clock;
+            return timestamp;
         }
         else
         {

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=1022147&r1=1022146&r2=1022147&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/HintedHandOffManager.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/HintedHandOffManager.java Wed Oct 13 15:43:18 2010
@@ -133,10 +133,10 @@ public class HintedHandOffManager
         return true;
     }
 
-    private static void deleteHintKey(byte[] endpointAddress, byte[] key, byte[] tableCF, IClock clock) throws IOException
+    private static void deleteHintKey(byte[] endpointAddress, byte[] key, byte[] tableCF, long timestamp) throws IOException
     {
         RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, endpointAddress);
-        rm.delete(new QueryPath(HINTS_CF, key, tableCF), clock);
+        rm.delete(new QueryPath(HINTS_CF, key, tableCF), timestamp);
         rm.apply();
     }                                                         
 
@@ -144,7 +144,7 @@ public class HintedHandOffManager
     {
         ColumnFamilyStore hintStore = Table.open(Table.SYSTEM_TABLE).getColumnFamilyStore(HINTS_CF);
         RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, endpoint.getAddress());
-        rm.delete(new QueryPath(HINTS_CF), new TimestampClock(System.currentTimeMillis()));
+        rm.delete(new QueryPath(HINTS_CF), System.currentTimeMillis());
         try {
             logger_.info("Deleting any stored hints for " + endpoint);
             rm.apply();
@@ -214,7 +214,7 @@ public class HintedHandOffManager
                         String[] parts = getTableAndCFNames(tableCF.name());
                         if (sendMessage(endpoint, parts[0], parts[1], keyColumn.name()))
                         {
-                            deleteHintKey(endpoint.getHostAddress().getBytes(UTF_8), keyColumn.name(), tableCF.name(), tableCF.clock());
+                            deleteHintKey(endpoint.getHostAddress().getBytes(UTF_8), keyColumn.name(), tableCF.name(), tableCF.timestamp());
                             rowsReplayed++;
                         }
                         else
@@ -269,7 +269,7 @@ public class HintedHandOffManager
             RowMutation drop = new RowMutation(Table.SYSTEM_TABLE, oldTableKey.key);
             for (byte[] key : cf.getColumnNames())
             {
-                drop.delete(new QueryPath(HINTS_CF, key), new TimestampClock(now));
+                drop.delete(new QueryPath(HINTS_CF, key), now);
                 startCol = key;
             }
             drop.apply();

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/IColumn.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/IColumn.java?rev=1022147&r1=1022146&r2=1022147&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/IColumn.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/IColumn.java Wed Oct 13 15:43:18 2010
@@ -29,17 +29,18 @@ public interface IColumn
     public static final int MAX_NAME_LENGTH = FBUtilities.MAX_UNSIGNED_SHORT;
 
     public boolean isMarkedForDelete();
-    public IClock getMarkedForDeleteAt();
-    public IClock mostRecentLiveChangeAt();
+    public long getMarkedForDeleteAt();
+    public long mostRecentLiveChangeAt();
     public byte[] name();
     public int size();
     public int serializedSize();
-    public IClock clock();
+    public long timestamp();
     public byte[] value();
     public Collection<IColumn> getSubColumns();
     public IColumn getSubColumn(byte[] columnName);
     public void addColumn(IColumn column);
     public IColumn diff(IColumn column);
+    public IColumn reconcile(IColumn column);
     public void updateDigest(MessageDigest digest);
     public int getLocalDeletionTime(); // for tombstone GC, so int is sufficient granularity
     public String getString(AbstractType comparator);

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/IColumnContainer.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/IColumnContainer.java?rev=1022147&r1=1022146&r2=1022147&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/IColumnContainer.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/IColumnContainer.java Wed Oct 13 15:43:18 2010
@@ -28,7 +28,7 @@ public interface IColumnContainer
     public void addColumn(IColumn column);
 
     public boolean isMarkedForDelete();
-    public IClock getMarkedForDeleteAt();
+    public long getMarkedForDeleteAt();
 
     public AbstractType getComparator();
 }

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/Memtable.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/Memtable.java?rev=1022147&r1=1022146&r2=1022147&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/Memtable.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/Memtable.java Wed Oct 13 15:43:18 2010
@@ -205,7 +205,7 @@ public class Memtable implements Compara
         final Collection<IColumn> filteredColumns = filter.reversed ? cf.getReverseSortedColumns() : cf.getSortedColumns();
 
         // ok to not have subcolumnComparator since we won't be adding columns to this object
-        IColumn startColumn = isSuper ? new SuperColumn(filter.start, null, cf.getClockType(), cf.getReconciler()) :  new Column(filter.start);
+        IColumn startColumn = isSuper ? new SuperColumn(filter.start, null) :  new Column(filter.start);
         Comparator<IColumn> comparator = filter.getColumnComparator(typeComparator);
 
         final PeekingIterator<IColumn> filteredIter = Iterators.peekingIterator(filteredColumns.iterator());

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=1022147&r1=1022146&r2=1022147&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/RowMutation.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/RowMutation.java Wed Oct 13 15:43:18 2010
@@ -101,7 +101,7 @@ public class RowMutation
         {
             byte[] combined = HintedHandOffManager.makeCombinedName(rm.getTable(), cf.metadata().cfName);
             QueryPath path = new QueryPath(HintedHandOffManager.HINTS_CF, rm.key(), combined);
-            add(path, ArrayUtils.EMPTY_BYTE_ARRAY, new TimestampClock(System.currentTimeMillis()), cf.metadata().gcGraceSeconds);
+            add(path, ArrayUtils.EMPTY_BYTE_ARRAY, System.currentTimeMillis(), cf.metadata().gcGraceSeconds);
         }
     }
 
@@ -135,10 +135,10 @@ public class RowMutation
      *
      * param @ cf - column name as <column family>:<column>
      * param @ value - value associated with the column
-     * param @ clock - clock associated with this data.
+     * param @ timestamp - timestamp associated with this data.
      * param @ timeToLive - ttl for the column, 0 for standard (non expiring) columns
     */
-    public void add(QueryPath path, byte[] value, IClock clock, int timeToLive)
+    public void add(QueryPath path, byte[] value, long timestamp, int timeToLive)
     {
         Integer id = CFMetaData.getId(table_, path.columnFamilyName);
         ColumnFamily columnFamily = modifications_.get(id);
@@ -147,15 +147,15 @@ public class RowMutation
             columnFamily = ColumnFamily.create(table_, path.columnFamilyName);
             modifications_.put(id, columnFamily);
         }
-        columnFamily.addColumn(path, value, clock, timeToLive);
+        columnFamily.addColumn(path, value, timestamp, timeToLive);
     }
 
-    public void add(QueryPath path, byte[] value, IClock clock)
+    public void add(QueryPath path, byte[] value, long timestamp)
     {
-        add(path, value, clock, 0);
+        add(path, value, timestamp, 0);
     }
 
-    public void delete(QueryPath path, IClock clock)
+    public void delete(QueryPath path, long timestamp)
     {
         Integer id = CFMetaData.getId(table_, path.columnFamilyName);
 
@@ -170,18 +170,17 @@ public class RowMutation
 
         if (path.superColumnName == null && path.columnName == null)
         {
-            columnFamily.delete(localDeleteTime, clock);
+            columnFamily.delete(localDeleteTime, timestamp);
         }
         else if (path.columnName == null)
         {
-            SuperColumn sc = new SuperColumn(path.superColumnName, columnFamily.getSubComparator(), 
-                    columnFamily.getClockType(), columnFamily.getReconciler());
-            sc.markForDeleteAt(localDeleteTime, clock);
+            SuperColumn sc = new SuperColumn(path.superColumnName, columnFamily.getSubComparator());
+            sc.markForDeleteAt(localDeleteTime, timestamp);
             columnFamily.addColumn(sc);
         }
         else
         {
-            columnFamily.deleteColumn(path, localDeleteTime, clock);
+            columnFamily.addTombstone(path, localDeleteTime, timestamp);
         }
     }
 
@@ -250,13 +249,13 @@ public class RowMutation
                     assert 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, new TimestampClock(column.timestamp), column.ttl);
+                        rm.add(new QueryPath(cfName, cosc.super_column.name, column.name), column.value, column.timestamp, column.ttl);
                     }
                 }
                 else
                 {
                     assert cosc.super_column == null;
-                    rm.add(new QueryPath(cfName, null, cosc.column.name), cosc.column.value, new TimestampClock(cosc.column.timestamp), cosc.column.ttl);
+                    rm.add(new QueryPath(cfName, null, cosc.column.name), cosc.column.value, cosc.column.timestamp, cosc.column.ttl);
                 }
             }
         }
@@ -302,12 +301,12 @@ public class RowMutation
         {
             for (org.apache.cassandra.thrift.Column column : cosc.super_column.columns)
             {
-                rm.add(new QueryPath(cfName, cosc.super_column.name, column.name), column.value, new TimestampClock(column.timestamp), column.ttl);
+                rm.add(new QueryPath(cfName, cosc.super_column.name, column.name), column.value, column.timestamp, column.ttl);
             }
         }
         else
         {
-            rm.add(new QueryPath(cfName, null, cosc.column.name), cosc.column.value, new TimestampClock(cosc.column.timestamp), cosc.column.ttl);
+            rm.add(new QueryPath(cfName, null, cosc.column.name), cosc.column.value, cosc.column.timestamp, cosc.column.ttl);
         }
     }
 
@@ -318,14 +317,14 @@ public class RowMutation
             for(byte[] c : del.predicate.column_names)
             {
                 if (del.super_column == null && DatabaseDescriptor.getColumnFamilyType(rm.table_, cfName) == ColumnFamilyType.Super)
-                    rm.delete(new QueryPath(cfName, c), new TimestampClock(del.timestamp));
+                    rm.delete(new QueryPath(cfName, c), del.timestamp);
                 else
-                    rm.delete(new QueryPath(cfName, del.super_column, c), new TimestampClock(del.timestamp));
+                    rm.delete(new QueryPath(cfName, del.super_column, c), del.timestamp);
             }
         }
         else
         {
-            rm.delete(new QueryPath(cfName, del.super_column), new TimestampClock(del.timestamp));
+            rm.delete(new QueryPath(cfName, del.super_column), del.timestamp);
         }
     }
 }

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/SuperColumn.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/SuperColumn.java?rev=1022147&r1=1022146&r2=1022147&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/SuperColumn.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/SuperColumn.java Wed Oct 13 15:43:18 2010
@@ -25,16 +25,14 @@ import java.util.List;
 import java.util.concurrent.ConcurrentSkipListMap;
 import java.security.MessageDigest;
 import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicReference;
+import java.util.concurrent.atomic.AtomicLong;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.apache.cassandra.db.IClock.ClockRelationship;
 import org.apache.cassandra.io.ICompactSerializer2;
 import org.apache.cassandra.io.util.DataOutputBuffer;
 import org.apache.cassandra.db.marshal.AbstractType;
-import org.apache.cassandra.db.clock.AbstractReconciler;
 import org.apache.cassandra.utils.FBUtilities;
 
 
@@ -42,30 +40,27 @@ public class SuperColumn implements ICol
 {
 	private static Logger logger_ = LoggerFactory.getLogger(SuperColumn.class);
 
-    public static SuperColumnSerializer serializer(AbstractType comparator, ClockType clockType, AbstractReconciler reconciler)
+    public static SuperColumnSerializer serializer(AbstractType comparator)
     {
-        return new SuperColumnSerializer(comparator, clockType, reconciler);
+        return new SuperColumnSerializer(comparator);
     }
 
     private byte[] name_;
     private ConcurrentSkipListMap<byte[], IColumn> columns_;
     private AtomicInteger localDeletionTime = new AtomicInteger(Integer.MIN_VALUE);
-    private AtomicReference<IClock> markedForDeleteAt;
-    private AbstractReconciler reconciler;
+    private AtomicLong markedForDeleteAt = new AtomicLong(Long.MIN_VALUE);
 
-    public SuperColumn(byte[] name, AbstractType comparator, ClockType clockType, AbstractReconciler reconciler)
+    public SuperColumn(byte[] name, AbstractType comparator)
     {
-        this(name, new ConcurrentSkipListMap<byte[], IColumn>(comparator), clockType, reconciler);
+        this(name, new ConcurrentSkipListMap<byte[], IColumn>(comparator));
     }
 
-    private SuperColumn(byte[] name, ConcurrentSkipListMap<byte[], IColumn> columns, ClockType clockType, AbstractReconciler reconciler)
+    private SuperColumn(byte[] name, ConcurrentSkipListMap<byte[], IColumn> columns)
     {
         assert name != null;
         assert name.length <= IColumn.MAX_NAME_LENGTH;
         name_ = name;
         columns_ = columns;
-        this.reconciler = reconciler;
-        markedForDeleteAt = new AtomicReference<IClock>(clockType.minClock());
     }
 
     public AbstractType getComparator()
@@ -75,24 +70,21 @@ public class SuperColumn implements ICol
 
     public SuperColumn cloneMeShallow()
     {
-        IClock _markedForDeleteAt = markedForDeleteAt.get();
-        SuperColumn sc = new SuperColumn(name_, getComparator(), _markedForDeleteAt.type(), reconciler);
-        sc.markForDeleteAt(localDeletionTime.get(), _markedForDeleteAt);
+        SuperColumn sc = new SuperColumn(name_, getComparator());
+        sc.markForDeleteAt(localDeletionTime.get(), markedForDeleteAt.get());
         return sc;
     }
 
     public IColumn cloneMe()
     {
-        IClock _markedForDeleteAt = markedForDeleteAt.get();
-        SuperColumn sc = new SuperColumn(name_, new ConcurrentSkipListMap<byte[], IColumn>(columns_), _markedForDeleteAt.type(), reconciler);
-        sc.markForDeleteAt(localDeletionTime.get(), _markedForDeleteAt);
+        SuperColumn sc = new SuperColumn(name_, new ConcurrentSkipListMap<byte[], IColumn>(columns_));
+        sc.markForDeleteAt(localDeletionTime.get(), markedForDeleteAt.get());
         return sc;
     }
 
 	public boolean isMarkedForDelete()
 	{
-        IClock _markedForDeleteAt = markedForDeleteAt.get();
-        return _markedForDeleteAt.compare(_markedForDeleteAt.type().minClock()) == ClockRelationship.GREATER_THAN;
+        return markedForDeleteAt.get() > Long.MIN_VALUE;
 	}
 
     public byte[] name()
@@ -135,8 +127,7 @@ public class SuperColumn implements ICol
     	 * We need to keep the way we are calculating the column size in sync with the
     	 * way we are calculating the size for the column family serializer.
     	 */
-      IClock _markedForDeleteAt = markedForDeleteAt.get();
-      return DBConstants.shortSize_ + name_.length + DBConstants.intSize_ + _markedForDeleteAt.size() + DBConstants.intSize_ + size();
+      return DBConstants.shortSize_ + name_.length + DBConstants.intSize_ + DBConstants.longSize_ + DBConstants.intSize_ + size();
     }
 
     public void remove(byte[] columnName)
@@ -144,22 +135,22 @@ public class SuperColumn implements ICol
     	columns_.remove(columnName);
     }
 
-    public IClock clock()
+    public long timestamp()
     {
     	throw new UnsupportedOperationException("This operation is not supported for Super Columns.");
     }
 
-    public IClock mostRecentLiveChangeAt()
+    public long mostRecentLiveChangeAt()
     {
-        List<IClock> clocks = new LinkedList<IClock>();
+        long max = Long.MIN_VALUE;
         for (IColumn column : columns_.values())
         {
-            if (!column.isMarkedForDelete())
+            if (!column.isMarkedForDelete() && column.timestamp() > max)
             {
-                clocks.add(column.clock());
+                max = column.timestamp();
             }
         }
-        return markedForDeleteAt.get().type().minClock().getSuperset(clocks);
+        return max;
     }
 
     public byte[] value()
@@ -175,13 +166,13 @@ public class SuperColumn implements ICol
         IColumn oldColumn = columns_.putIfAbsent(name, column);
         if (oldColumn != null)
         {
-            IColumn reconciledColumn = reconciler.reconcile((Column)column, (Column)oldColumn);
+            IColumn reconciledColumn = column.reconcile(oldColumn);
             while (!columns_.replace(name, oldColumn, reconciledColumn))
             {
                 // if unable to replace, then get updated old (existing) col
                 oldColumn = columns_.get(name);
                 // re-calculate reconciled col from updated old col and original new col
-                reconciledColumn = reconciler.reconcile((Column)column, (Column)oldColumn);
+                reconciledColumn = column.reconcile(oldColumn);
                 // try to re-update value, again
             }
     	}
@@ -203,17 +194,15 @@ public class SuperColumn implements ICol
         FBUtilities.atomicSetMax(markedForDeleteAt, column.getMarkedForDeleteAt());
     }
 
-    public IClock getMarkedForDeleteAt()
+    public long getMarkedForDeleteAt()
     {
         return markedForDeleteAt.get();
     }
 
     public IColumn diff(IColumn columnNew)
     {
-        IClock _markedForDeleteAt = markedForDeleteAt.get();
-        IColumn columnDiff = new SuperColumn(columnNew.name(), ((SuperColumn)columnNew).getComparator(), _markedForDeleteAt.type(), reconciler);
-        ClockRelationship rel = columnNew.getMarkedForDeleteAt().compare(_markedForDeleteAt);
-        if (ClockRelationship.GREATER_THAN == rel)
+    	IColumn columnDiff = new SuperColumn(columnNew.name(), ((SuperColumn)columnNew).getComparator());
+        if (columnNew.getMarkedForDeleteAt() > getMarkedForDeleteAt())
         {
             ((SuperColumn)columnDiff).markForDeleteAt(columnNew.getLocalDeletionTime(), columnNew.getMarkedForDeleteAt());
         }
@@ -251,8 +240,7 @@ public class SuperColumn implements ICol
         DataOutputBuffer buffer = new DataOutputBuffer();
         try
         {
-            IClock _markedForDeleteAt = markedForDeleteAt.get();
-            _markedForDeleteAt.serialize(buffer);
+            buffer.writeLong(markedForDeleteAt.get());
         }
         catch (IOException e)
         {
@@ -272,7 +260,7 @@ public class SuperColumn implements ICol
     	sb.append(comparator.getString(name_));
 
         if (isMarkedForDelete()) {
-            sb.append(" -delete at ").append(getMarkedForDeleteAt().toString()).append("-");
+            sb.append(" -delete at ").append(getMarkedForDeleteAt()).append("-");
         }
 
         sb.append(" [");
@@ -288,24 +276,25 @@ public class SuperColumn implements ICol
     }
 
     @Deprecated // TODO this is a hack to set initial value outside constructor
-    public void markForDeleteAt(int localDeleteTime, IClock clock)
+    public void markForDeleteAt(int localDeleteTime, long timestamp)
     {
         this.localDeletionTime.set(localDeleteTime);
-        this.markedForDeleteAt.set(clock);
+        this.markedForDeleteAt.set(timestamp);
+    }
+
+    public IColumn reconcile(IColumn c)
+    {
+        throw new UnsupportedOperationException("This operation is unsupported on super columns.");
     }
 }
 
 class SuperColumnSerializer implements ICompactSerializer2<IColumn>
 {
     private AbstractType comparator;
-    private ClockType clockType;
-    private AbstractReconciler reconciler;
 
-    public SuperColumnSerializer(AbstractType comparator, ClockType clockType, AbstractReconciler reconciler)
+    public SuperColumnSerializer(AbstractType comparator)
     {
         this.comparator = comparator;
-        this.clockType = clockType;
-        this.reconciler = reconciler;
     }
 
     public AbstractType getComparator()
@@ -320,14 +309,13 @@ class SuperColumnSerializer implements I
         try
         {
             dos.writeInt(superColumn.getLocalDeletionTime());
-            IClock _markedForDeleteAt = superColumn.getMarkedForDeleteAt();
-            clockType.serializer().serialize(_markedForDeleteAt, dos);
+            dos.writeLong(superColumn.getMarkedForDeleteAt());
 
             Collection<IColumn> columns = column.getSubColumns();
             dos.writeInt(columns.size());
             for (IColumn subColumn : columns)
             {
-                Column.serializer(clockType).serialize(subColumn, dos);
+                Column.serializer().serialize(subColumn, dos);
             }
         }
         catch (IOException e)
@@ -339,19 +327,19 @@ class SuperColumnSerializer implements I
     public IColumn deserialize(DataInput dis) throws IOException
     {
         byte[] name = FBUtilities.readShortByteArray(dis);
-        SuperColumn superColumn = new SuperColumn(name, comparator, clockType, reconciler);
+        SuperColumn superColumn = new SuperColumn(name, comparator);
         int localDeleteTime = dis.readInt();
         if (localDeleteTime != Integer.MIN_VALUE && localDeleteTime <= 0)
         {
             throw new IOException("Invalid localDeleteTime read: " + localDeleteTime);
         }
-        superColumn.markForDeleteAt(localDeleteTime, clockType.serializer().deserialize(dis));
+        superColumn.markForDeleteAt(localDeleteTime, dis.readLong());
 
         /* read the number of columns */
         int size = dis.readInt();
         for ( int i = 0; i < size; ++i )
         {
-            IColumn subColumn = Column.serializer(clockType).deserialize(dis);
+            IColumn subColumn = Column.serializer().deserialize(dis);
             superColumn.addColumn(subColumn);
         }
         return superColumn;

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/SystemTable.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/SystemTable.java?rev=1022147&r1=1022146&r2=1022147&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/SystemTable.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/SystemTable.java Wed Oct 13 15:43:18 2010
@@ -79,7 +79,7 @@ public class SystemTable
             logger.info("Upgrading to 0.7. Purging hints if there are any. Old hints will be snapshotted.");
             new Truncation(Table.SYSTEM_TABLE, HintedHandOffManager.HINTS_CF).apply();
             RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, COOKIE_KEY);
-            rm.add(new QueryPath(STATUS_CF, null, hintsPurged6to7), "oh yes, it they were purged.".getBytes(), new TimestampClock(System.currentTimeMillis()));
+            rm.add(new QueryPath(STATUS_CF, null, hintsPurged6to7), "oh yes, it they were purged.".getBytes(), System.currentTimeMillis());
             rm.apply();
         }
     }
@@ -91,7 +91,7 @@ public class SystemTable
     {
         IPartitioner p = StorageService.getPartitioner();
         ColumnFamily cf = ColumnFamily.create(Table.SYSTEM_TABLE, STATUS_CF);
-        cf.addColumn(new Column(p.getTokenFactory().toByteArray(token), ep.getAddress(), new TimestampClock(System.currentTimeMillis())));
+        cf.addColumn(new Column(p.getTokenFactory().toByteArray(token), ep.getAddress(), System.currentTimeMillis()));
         RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, RING_KEY);
         rm.add(cf);
         try
@@ -111,7 +111,7 @@ public class SystemTable
     {
         IPartitioner p = StorageService.getPartitioner();
         RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, RING_KEY);
-        rm.delete(new QueryPath(STATUS_CF, null, p.getTokenFactory().toByteArray(token)), new TimestampClock(System.currentTimeMillis()));
+        rm.delete(new QueryPath(STATUS_CF, null, p.getTokenFactory().toByteArray(token)), System.currentTimeMillis());
         try
         {
             rm.apply();
@@ -129,7 +129,7 @@ public class SystemTable
     {
         IPartitioner p = StorageService.getPartitioner();
         ColumnFamily cf = ColumnFamily.create(Table.SYSTEM_TABLE, STATUS_CF);
-        cf.addColumn(new Column(SystemTable.TOKEN, p.getTokenFactory().toByteArray(token), new TimestampClock(System.currentTimeMillis())));
+        cf.addColumn(new Column(SystemTable.TOKEN, p.getTokenFactory().toByteArray(token), System.currentTimeMillis()));
         RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, LOCATION_KEY);
         rm.add(cf);
         try
@@ -235,8 +235,8 @@ public class SystemTable
             // no system files.  this is a new node.
             RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, LOCATION_KEY);
             cf = ColumnFamily.create(Table.SYSTEM_TABLE, SystemTable.STATUS_CF);
-            cf.addColumn(new Column(PARTITIONER, DatabaseDescriptor.getPartitioner().getClass().getName().getBytes(UTF_8), new TimestampClock(FBUtilities.timestampMicros())));
-            cf.addColumn(new Column(CLUSTERNAME, DatabaseDescriptor.getClusterName().getBytes(), new TimestampClock(FBUtilities.timestampMicros())));
+            cf.addColumn(new Column(PARTITIONER, DatabaseDescriptor.getPartitioner().getClass().getName().getBytes(UTF_8), FBUtilities.timestampMicros()));
+            cf.addColumn(new Column(CLUSTERNAME, DatabaseDescriptor.getClusterName().getBytes(), FBUtilities.timestampMicros()));
             rm.add(cf);
             rm.apply();
 
@@ -284,8 +284,7 @@ public class SystemTable
 
         RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, LOCATION_KEY);
         cf = ColumnFamily.create(Table.SYSTEM_TABLE, SystemTable.STATUS_CF);
-        TimestampClock genClock = new TimestampClock(FBUtilities.timestampMicros());
-        cf.addColumn(new Column(GENERATION, FBUtilities.toByteArray(generation), genClock));
+        cf.addColumn(new Column(GENERATION, FBUtilities.toByteArray(generation), FBUtilities.timestampMicros()));
         rm.add(cf);
         rm.apply();
         forceBlockingFlush(STATUS_CF);
@@ -306,7 +305,7 @@ public class SystemTable
     public static void setBootstrapped(boolean isBootstrapped)
     {
         ColumnFamily cf = ColumnFamily.create(Table.SYSTEM_TABLE, STATUS_CF);
-        cf.addColumn(new Column(BOOTSTRAP, new byte[] { (byte) (isBootstrapped ? 1 : 0) }, new TimestampClock(System.currentTimeMillis())));
+        cf.addColumn(new Column(BOOTSTRAP, new byte[] { (byte) (isBootstrapped ? 1 : 0) }, System.currentTimeMillis()));
         RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, BOOTSTRAP_KEY);
         rm.add(cf);
         try
@@ -331,7 +330,7 @@ public class SystemTable
     public static void setIndexBuilt(String table, String indexName)
     {
         ColumnFamily cf = ColumnFamily.create(Table.SYSTEM_TABLE, INDEX_CF);
-        cf.addColumn(new Column(indexName.getBytes(UTF_8), ArrayUtils.EMPTY_BYTE_ARRAY, new TimestampClock(System.currentTimeMillis())));
+        cf.addColumn(new Column(indexName.getBytes(UTF_8), ArrayUtils.EMPTY_BYTE_ARRAY, System.currentTimeMillis()));
         RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, table.getBytes(UTF_8));
         rm.add(cf);
         try
@@ -349,7 +348,7 @@ public class SystemTable
     public static void setIndexRemoved(String table, String indexName)
     {
         RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, table.getBytes(UTF_8));
-        rm.delete(new QueryPath(INDEX_CF, null, indexName.getBytes(UTF_8)), new TimestampClock(System.currentTimeMillis()));
+        rm.delete(new QueryPath(INDEX_CF, null, indexName.getBytes(UTF_8)), System.currentTimeMillis());
         try
         {
             rm.apply();

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/Table.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/Table.java?rev=1022147&r1=1022146&r2=1022147&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/Table.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/Table.java Wed Oct 13 15:43:18 2010
@@ -36,7 +36,6 @@ import org.slf4j.LoggerFactory;
 
 import org.apache.cassandra.config.CFMetaData;
 import org.apache.cassandra.config.DatabaseDescriptor;
-import org.apache.cassandra.db.clock.AbstractReconciler;
 import org.apache.cassandra.db.commitlog.CommitLog;
 import org.apache.cassandra.db.filter.QueryFilter;
 import org.apache.cassandra.db.filter.QueryPath;
@@ -81,8 +80,6 @@ public class Table
     public final String name;
     /* ColumnFamilyStore per column family */
     public final Map<Integer, ColumnFamilyStore> columnFamilyStores = new HashMap<Integer, ColumnFamilyStore>(); // TODO make private again
-    // cache application CFs since Range queries ask for them a _lot_
-    private SortedSet<String> applicationColumnFamilies;
     private final Object[] indexLocks;
     private ScheduledFuture<?> flushTask;
 
@@ -464,11 +461,11 @@ public class Table
             if (column instanceof ExpiringColumn)
             {
                 ExpiringColumn ec = (ExpiringColumn)column;
-                cfi.addColumn(new ExpiringColumn(key, ArrayUtils.EMPTY_BYTE_ARRAY, ec.clock(), ec.getTimeToLive(), ec.getLocalDeletionTime()));
+                cfi.addColumn(new ExpiringColumn(key, ArrayUtils.EMPTY_BYTE_ARRAY, ec.timestamp, ec.getTimeToLive(), ec.getLocalDeletionTime()));
             }
             else
             {
-                cfi.addColumn(new Column(key, ArrayUtils.EMPTY_BYTE_ARRAY, column.clock()));
+                cfi.addColumn(new Column(key, ArrayUtils.EMPTY_BYTE_ARRAY, column.timestamp()));
             }
             Memtable fullMemtable = cfs.getIndexedColumnFamilyStore(columnName).apply(valueKey, cfi);
             if (fullMemtable != null)
@@ -487,7 +484,7 @@ public class Table
                     continue;
                 DecoratedKey<LocalToken> valueKey = cfs.getIndexKeyFor(columnName, column.value());
                 ColumnFamily cfi = cfs.newIndexedColumnFamily(columnName);
-                cfi.deleteColumn(key, localDeletionTime, column.clock());
+                cfi.addTombstone(key, localDeletionTime, column.timestamp());
                 Memtable fullMemtable = cfs.getIndexedColumnFamilyStore(columnName).apply(valueKey, cfi);
                 if (fullMemtable != null)
                     fullMemtables = addFullMemtable(fullMemtables, fullMemtable);

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/filter/QueryFilter.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/filter/QueryFilter.java?rev=1022147&r1=1022146&r2=1022147&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/filter/QueryFilter.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/filter/QueryFilter.java Wed Oct 13 15:43:18 2010
@@ -32,7 +32,6 @@ import org.apache.cassandra.thrift.Slice
 import org.apache.cassandra.utils.ReducingIterator;
 import org.apache.cassandra.db.*;
 import org.apache.cassandra.db.marshal.AbstractType;
-import org.apache.cassandra.db.IClock.ClockRelationship;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -122,8 +121,8 @@ public class QueryFilter
                     // filterSuperColumn only looks at immediate parent (the supercolumn) when determining if a subcolumn
                     // is still live, i.e., not shadowed by the parent's tombstone.  so, bump it up temporarily to the tombstone
                     // time of the cf, if that is greater.
-                    IClock deletedAt = c.getMarkedForDeleteAt();
-                    if (returnCF.getMarkedForDeleteAt().compare(deletedAt) == ClockRelationship.GREATER_THAN)
+                    long deletedAt = c.getMarkedForDeleteAt();
+                    if (returnCF.getMarkedForDeleteAt() > deletedAt)
                         ((SuperColumn)c).markForDeleteAt(c.getLocalDeletionTime(), returnCF.getMarkedForDeleteAt());
 
                     c = filter.filterSuperColumn((SuperColumn)c, gcBefore);
@@ -147,9 +146,9 @@ public class QueryFilter
         // the column itself must be not gc-able (it is live, or a still relevant tombstone, or has live subcolumns), (1)
         // and if its container is deleted, the column must be changed more recently than the container tombstone (2)
         // (since otherwise, the only thing repair cares about is the container tombstone)
-        IClock maxChange = column.mostRecentLiveChangeAt();
-        return (!column.isMarkedForDelete() || column.getLocalDeletionTime() > gcBefore || (ClockRelationship.GREATER_THAN == maxChange.compare(column.getMarkedForDeleteAt()))) // (1)
-               && (!container.isMarkedForDelete() || (ClockRelationship.GREATER_THAN == maxChange.compare(container.getMarkedForDeleteAt()))); // (2)
+        long maxChange = column.mostRecentLiveChangeAt();
+        return (!column.isMarkedForDelete() || column.getLocalDeletionTime() > gcBefore || maxChange > column.getMarkedForDeleteAt()) // (1)
+               && (!container.isMarkedForDelete() || maxChange > container.getMarkedForDeleteAt()); // (2)
     }
 
     /**



Mime
View raw message