cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r948316 [5/5] - in /cassandra/trunk: interface/ interface/thrift/gen-java/org/apache/cassandra/thrift/ src/java/org/apache/cassandra/avro/ src/java/org/apache/cassandra/cli/ src/java/org/apache/cassandra/config/ src/java/org/apache/cassandr...
Date Wed, 26 May 2010 04:45:47 GMT
Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveSuperColumnTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveSuperColumnTest.java?rev=948316&r1=948315&r2=948316&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveSuperColumnTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveSuperColumnTest.java Wed May 26
04:45:44 2010
@@ -46,13 +46,13 @@ public class RemoveSuperColumnTest exten
 
         // add data
         rm = new RowMutation("Keyspace1", dk.key);
-        addMutation(rm, "Super1", "SC1", 1, "val1", 0);
+        addMutation(rm, "Super1", "SC1", 1, "val1", new TimestampClock(0));
         rm.apply();
         store.forceBlockingFlush();
 
         // remove
         rm = new RowMutation("Keyspace1", dk.key);
-        rm.delete(new QueryPath("Super1", "SC1".getBytes()), 1);
+        rm.delete(new QueryPath("Super1", "SC1".getBytes()), new TimestampClock(1));
         rm.apply();
 
         validateRemoveTwoSources(dk);
@@ -74,14 +74,14 @@ public class RemoveSuperColumnTest exten
 
         // add data
         rm = new RowMutation("Keyspace1", dk.key);
-        addMutation(rm, "Super3", "SC1", 1, "val1", 0);
-        addMutation(rm, "Super3", "SC1", 2, "val1", 0);
+        addMutation(rm, "Super3", "SC1", 1, "val1", new TimestampClock(0));
+        addMutation(rm, "Super3", "SC1", 2, "val1", new TimestampClock(0));
         rm.apply();
         store.forceBlockingFlush();
 
         // remove
         rm = new RowMutation("Keyspace1", dk.key);
-        rm.delete(new QueryPath("Super3", "SC1".getBytes(), Util.getBytes(1)), 1);
+        rm.delete(new QueryPath("Super3", "SC1".getBytes(), Util.getBytes(1)), new TimestampClock(1));
         rm.apply();
 
         validateRemoveSubColumn(dk);
@@ -101,7 +101,7 @@ public class RemoveSuperColumnTest exten
     {
         ColumnFamilyStore store = Table.open("Keyspace1").getColumnFamilyStore("Super1");
         ColumnFamily resolved = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new
QueryPath("Super1"), "SC1".getBytes()));
-        assert resolved.getSortedColumns().iterator().next().getMarkedForDeleteAt() == 1
: resolved;
+        assert ((TimestampClock)resolved.getSortedColumns().iterator().next().getMarkedForDeleteAt()).timestamp()
== 1 : resolved;
         assert resolved.getSortedColumns().iterator().next().getSubColumns().size() == 0
: resolved;
         assertNull(ColumnFamilyStore.removeDeleted(resolved, Integer.MAX_VALUE));
         assertNull(store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath("Super1"),
"SC1".getBytes()), Integer.MAX_VALUE));
@@ -113,7 +113,7 @@ public class RemoveSuperColumnTest exten
     {
         ColumnFamilyStore store = Table.open("Keyspace1").getColumnFamilyStore("Super1");
         ColumnFamily resolved = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new
QueryPath("Super1"), "SC1".getBytes()));
-        assert resolved.getSortedColumns().iterator().next().getMarkedForDeleteAt() == 1;
+        assert ((TimestampClock)resolved.getSortedColumns().iterator().next().getMarkedForDeleteAt()).timestamp()
== 1;
         Collection<IColumn> subColumns = resolved.getSortedColumns().iterator().next().getSubColumns();
         assert subColumns.size() == 0;
     }
@@ -127,18 +127,18 @@ public class RemoveSuperColumnTest exten
 
         // add data
         rm = new RowMutation("Keyspace1", dk.key);
-        addMutation(rm, "Super2", "SC1", 1, "val1", 0);
+        addMutation(rm, "Super2", "SC1", 1, "val1", new TimestampClock(0));
         rm.apply();
         store.forceBlockingFlush();
 
         // remove
         rm = new RowMutation("Keyspace1", dk.key);
-        rm.delete(new QueryPath("Super2", "SC1".getBytes()), 1);
+        rm.delete(new QueryPath("Super2", "SC1".getBytes()), new TimestampClock(1));
         rm.apply();
 
         // new data
         rm = new RowMutation("Keyspace1", dk.key);
-        addMutation(rm, "Super2", "SC1", 2, "val2", 2);
+        addMutation(rm, "Super2", "SC1", 2, "val2", new TimestampClock(2));
         rm.apply();
 
         validateRemoveWithNewData(dk);
@@ -157,7 +157,7 @@ public class RemoveSuperColumnTest exten
         ColumnFamily resolved = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new
QueryPath("Super2", "SC1".getBytes()), getBytes(2)), Integer.MAX_VALUE);
         Collection<IColumn> subColumns = resolved.getSortedColumns().iterator().next().getSubColumns();
         assert subColumns.size() == 1;
-        assert subColumns.iterator().next().timestamp() == 2;
+        assert ((TimestampClock)subColumns.iterator().next().clock()).timestamp() == 2;
     }
 
     @Test
@@ -169,24 +169,24 @@ public class RemoveSuperColumnTest exten
 
         // add data
         rm = new RowMutation("Keyspace1", key.key);
-        addMutation(rm, "Super2", "SC1", 1, "val1", 0);
+        addMutation(rm, "Super2", "SC1", 1, "val1", new TimestampClock(0));
         rm.apply();
 
         // remove
         rm = new RowMutation("Keyspace1", key.key);
-        rm.delete(new QueryPath("Super2", "SC1".getBytes()), 1);
+        rm.delete(new QueryPath("Super2", "SC1".getBytes()), new TimestampClock(1));
         rm.apply();
         assertNull(store.getColumnFamily(QueryFilter.getNamesFilter(key, new QueryPath("Super2"),
"SC1".getBytes()), Integer.MAX_VALUE));
 
         // resurrect
         rm = new RowMutation("Keyspace1", key.key);
-        addMutation(rm, "Super2", "SC1", 1, "val2", 2);
+        addMutation(rm, "Super2", "SC1", 1, "val2", new TimestampClock(2));
         rm.apply();
 
         // validate
         ColumnFamily resolved = store.getColumnFamily(QueryFilter.getNamesFilter(key, new
QueryPath("Super2"), "SC1".getBytes()), Integer.MAX_VALUE);
         Collection<IColumn> subColumns = resolved.getSortedColumns().iterator().next().getSubColumns();
         assert subColumns.size() == 1;
-        assert subColumns.iterator().next().timestamp() == 2;
+        assert ((TimestampClock)subColumns.iterator().next().clock()).timestamp() == 2;
     }
 }

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/RowTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/RowTest.java?rev=948316&r1=948315&r2=948316&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/RowTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/RowTest.java Wed May 26 04:45:44 2010
@@ -33,39 +33,39 @@ public class RowTest extends SchemaLoade
     public void testDiffColumnFamily()
     {
         ColumnFamily cf1 = ColumnFamily.create("Keyspace1", "Standard1");
-        cf1.addColumn(column("one", "onev", 0));
+        cf1.addColumn(column("one", "onev", new TimestampClock(0)));
 
         ColumnFamily cf2 = ColumnFamily.create("Keyspace1", "Standard1");
-        cf2.delete(0, 0);
+        cf2.delete(0, new TimestampClock(0));
 
         ColumnFamily cfDiff = cf1.diff(cf2);
         assertEquals(cfDiff.getColumnsMap().size(), 0);
-        assertEquals(cfDiff.getMarkedForDeleteAt(), 0);
+        assertEquals(((TimestampClock) cfDiff.getMarkedForDeleteAt()).timestamp(), 0);
     }
 
     @Test
     public void testDiffSuperColumn()
     {
-        SuperColumn sc1 = new SuperColumn("one".getBytes(), new AsciiType());
-        sc1.addColumn(column("subcolumn", "A", 0));
+        SuperColumn sc1 = new SuperColumn("one".getBytes(), new AsciiType(), ClockType.Timestamp);
+        sc1.addColumn(column("subcolumn", "A", new TimestampClock(0)));
 
-        SuperColumn sc2 = new SuperColumn("one".getBytes(), new AsciiType());
-        sc2.markForDeleteAt(0, 0);
+        SuperColumn sc2 = new SuperColumn("one".getBytes(), new AsciiType(), ClockType.Timestamp);
+        sc2.markForDeleteAt(0, new TimestampClock(0));
 
         SuperColumn scDiff = (SuperColumn)sc1.diff(sc2);
         assertEquals(scDiff.getSubColumns().size(), 0);
-        assertEquals(scDiff.getMarkedForDeleteAt(), 0);
+        assertEquals(((TimestampClock)scDiff.getMarkedForDeleteAt()).timestamp(), 0);
     }
 
     @Test
     public void testResolve()
     {
         ColumnFamily cf1 = ColumnFamily.create("Keyspace1", "Standard1");
-        cf1.addColumn(column("one", "A", 0));
+        cf1.addColumn(column("one", "A", new TimestampClock(0)));
 
         ColumnFamily cf2 = ColumnFamily.create("Keyspace1", "Standard1");
-        cf2.addColumn(column("one", "B", 1));
-        cf2.addColumn(column("two", "C", 1));
+        cf2.addColumn(column("one", "B", new TimestampClock(1)));
+        cf2.addColumn(column("two", "C", new TimestampClock(1)));
 
         cf1.resolve(cf2);
         assert Arrays.equals(cf1.getColumn("one".getBytes()).value(), "B".getBytes());

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/SuperColumnTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/SuperColumnTest.java?rev=948316&r1=948315&r2=948316&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/SuperColumnTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/SuperColumnTest.java Wed May 26 04:45:44
2010
@@ -1,6 +1,5 @@
 /*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
+* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license
agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
@@ -29,8 +28,8 @@ public class SuperColumnTest
 {   
     @Test
     public void testMissingSubcolumn() {
-    	SuperColumn sc = new SuperColumn("sc1".getBytes(), new LongType());
-    	sc.addColumn(new Column(getBytes(1), "value".getBytes(), 1));
+    	SuperColumn sc = new SuperColumn("sc1".getBytes(), new LongType(), ClockType.Timestamp);
+    	sc.addColumn(new Column(getBytes(1), "value".getBytes(), new TimestampClock(1)));
     	assertNotNull(sc.getSubColumn(getBytes(1)));
     	assertNull(sc.getSubColumn(getBytes(2)));
     }

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/TableTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/TableTest.java?rev=948316&r1=948315&r2=948316&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/TableTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/TableTest.java Wed May 26 04:45:44 2010
@@ -70,7 +70,7 @@ public class TableTest extends CleanupHe
 
         RowMutation rm = new RowMutation("Keyspace2", TEST_KEY.key);
         ColumnFamily cf = ColumnFamily.create("Keyspace2", "Standard3");
-        cf.addColumn(column("col1","val1", 1L));
+        cf.addColumn(column("col1","val1", new TimestampClock(1L)));
         rm.add(cf);
         rm.apply();
 
@@ -101,9 +101,9 @@ public class TableTest extends CleanupHe
 
         RowMutation rm = new RowMutation("Keyspace1", TEST_KEY.key);
         ColumnFamily cf = ColumnFamily.create("Keyspace1", "Standard1");
-        cf.addColumn(column("col1","val1", 1L));
-        cf.addColumn(column("col2","val2", 1L));
-        cf.addColumn(column("col3","val3", 1L));
+        cf.addColumn(column("col1","val1", new TimestampClock(1L)));
+        cf.addColumn(column("col2","val2", new TimestampClock(1L)));
+        cf.addColumn(column("col3","val3", new TimestampClock(1L)));
         rm.add(cf);
         rm.apply();
 
@@ -132,9 +132,9 @@ public class TableTest extends CleanupHe
     	RowMutation rm = new RowMutation("Keyspace1", key.key);
         ColumnFamily cf = ColumnFamily.create("Keyspace1", "Standard1");
         // First write "a", "b", "c"
-        cf.addColumn(column("a", "val1", 1L));
-        cf.addColumn(column("b", "val2", 1L));
-        cf.addColumn(column("c", "val3", 1L));
+        cf.addColumn(column("a", "val1", new TimestampClock(1L)));
+        cf.addColumn(column("b", "val2", new TimestampClock(1L)));
+        cf.addColumn(column("c", "val3", new TimestampClock(1L)));
         rm.add(cf);
         rm.apply();
         
@@ -157,7 +157,7 @@ public class TableTest extends CleanupHe
         Table table = Table.open("Keyspace1");
         RowMutation rm = new RowMutation("Keyspace1", "row1000".getBytes());
         ColumnFamily cf = ColumnFamily.create("Keyspace1", "Standard2");
-        cf.addColumn(column("col1", "val1", 1));
+        cf.addColumn(column("col1", "val1", new TimestampClock(1)));
         rm.add(cf);
         rm.apply();
 
@@ -185,7 +185,7 @@ public class TableTest extends CleanupHe
         // at this rate, we're getting 78-79 cos/block, assuming the blocks are set to be
about 4k.
         // so if we go to 300, we'll get at least 4 blocks, which is plenty for testing.
         for (int i = 0; i < 300; i++)
-            cf.addColumn(column("col" + fmt.format(i), "omg!thisisthevalue!"+i, 1L));
+            cf.addColumn(column("col" + fmt.format(i), "omg!thisisthevalue!"+i, new TimestampClock(1L)));
         rm.add(cf);
         rm.apply();
 
@@ -244,7 +244,7 @@ public class TableTest extends CleanupHe
         // at this rate, we're getting 78-79 cos/block, assuming the blocks are set to be
about 4k.
         // so if we go to 300, we'll get at least 4 blocks, which is plenty for testing.
         for (int i = 0; i < 300; i++)
-            cf.addColumn(column("col" + fmt.format(i), "omg!thisisthevalue!"+i, 1L));
+            cf.addColumn(column("col" + fmt.format(i), "omg!thisisthevalue!"+i, new TimestampClock(1L)));
         rm.add(cf);
         rm.apply();
 
@@ -318,17 +318,17 @@ public class TableTest extends CleanupHe
 
         RowMutation rm = new RowMutation("Keyspace1", ROW.key);
         ColumnFamily cf = ColumnFamily.create("Keyspace1", "Standard1");
-        cf.addColumn(column("col1", "val1", 1L));
-        cf.addColumn(column("col3", "val3", 1L));
-        cf.addColumn(column("col4", "val4", 1L));
-        cf.addColumn(column("col5", "val5", 1L));
-        cf.addColumn(column("col7", "val7", 1L));
-        cf.addColumn(column("col9", "val9", 1L));
+        cf.addColumn(column("col1", "val1", new TimestampClock(1L)));
+        cf.addColumn(column("col3", "val3", new TimestampClock(1L)));
+        cf.addColumn(column("col4", "val4", new TimestampClock(1L)));
+        cf.addColumn(column("col5", "val5", new TimestampClock(1L)));
+        cf.addColumn(column("col7", "val7", new TimestampClock(1L)));
+        cf.addColumn(column("col9", "val9", new TimestampClock(1L)));
         rm.add(cf);
         rm.apply();
 
         rm = new RowMutation("Keyspace1", ROW.key);
-        rm.delete(new QueryPath("Standard1", null, "col4".getBytes()), 2L);
+        rm.delete(new QueryPath("Standard1", null, "col4".getBytes()), new TimestampClock(2L));
         rm.apply();
 
         Runnable verify = new WrappedRunnable()
@@ -374,21 +374,21 @@ public class TableTest extends CleanupHe
 
         RowMutation rm = new RowMutation("Keyspace1", ROW.key);
         ColumnFamily cf = ColumnFamily.create("Keyspace1", "Standard1");
-        cf.addColumn(column("col1", "val1", 1L));
-        cf.addColumn(column("col2", "val2", 1L));
-        cf.addColumn(column("col3", "val3", 1L));
-        cf.addColumn(column("col4", "val4", 1L));
-        cf.addColumn(column("col5", "val5", 1L));
-        cf.addColumn(column("col6", "val6", 1L));
+        cf.addColumn(column("col1", "val1", new TimestampClock(1L)));
+        cf.addColumn(column("col2", "val2", new TimestampClock(1L)));
+        cf.addColumn(column("col3", "val3", new TimestampClock(1L)));
+        cf.addColumn(column("col4", "val4", new TimestampClock(1L)));
+        cf.addColumn(column("col5", "val5", new TimestampClock(1L)));
+        cf.addColumn(column("col6", "val6", new TimestampClock(1L)));
         rm.add(cf);
         rm.apply();
         cfStore.forceBlockingFlush();
 
         rm = new RowMutation("Keyspace1", ROW.key);
         cf = ColumnFamily.create("Keyspace1", "Standard1");
-        cf.addColumn(column("col1", "valx", 2L));
-        cf.addColumn(column("col2", "valx", 2L));
-        cf.addColumn(column("col3", "valx", 2L));
+        cf.addColumn(column("col1", "valx", new TimestampClock(2L)));
+        cf.addColumn(column("col2", "valx", new TimestampClock(2L)));
+        cf.addColumn(column("col3", "valx", new TimestampClock(2L)));
         rm.add(cf);
         rm.apply();
 
@@ -419,7 +419,7 @@ public class TableTest extends CleanupHe
         RowMutation rm = new RowMutation("Keyspace1", key.key);
         ColumnFamily cf = ColumnFamily.create("Keyspace1", "Standard1");
         for (int i = 1000; i < 2000; i++)
-            cf.addColumn(column("col" + i, ("v" + i), 1L));
+            cf.addColumn(column("col" + i, ("v" + i), new TimestampClock(1L)));
         rm.add(cf);
         rm.apply();
         cfStore.forceBlockingFlush();
@@ -497,8 +497,8 @@ public class TableTest extends CleanupHe
 
         RowMutation rm = new RowMutation("Keyspace1", ROW.key);
         ColumnFamily cf = ColumnFamily.create("Keyspace1", "Super1");
-        SuperColumn sc = new SuperColumn("sc1".getBytes(), new LongType());
-        sc.addColumn(new Column(getBytes(1), "val1".getBytes(), 1L));
+        SuperColumn sc = new SuperColumn("sc1".getBytes(), new LongType(), ClockType.Timestamp);
+        sc.addColumn(new Column(getBytes(1), "val1".getBytes(), new TimestampClock(1L)));
         cf.addColumn(sc);
         rm.add(cf);
         rm.apply();

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/TimeSortTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/TimeSortTest.java?rev=948316&r1=948315&r2=948316&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/TimeSortTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/TimeSortTest.java Wed May 26 04:45:44
2010
@@ -46,12 +46,12 @@ public class TimeSortTest extends Cleanu
         DecoratedKey key = Util.dk("key0");
 
         rm = new RowMutation("Keyspace1", key.key);
-        rm.add(new QueryPath("StandardLong1", null, getBytes(100)), "a".getBytes(), 100);
+        rm.add(new QueryPath("StandardLong1", null, getBytes(100)), "a".getBytes(), new TimestampClock(100));
         rm.apply();
         cfStore.forceBlockingFlush();
 
         rm = new RowMutation("Keyspace1", key.key);
-        rm.add(new QueryPath("StandardLong1", null, getBytes(0)), "b".getBytes(), 0);
+        rm.add(new QueryPath("StandardLong1", null, getBytes(0)), "b".getBytes(), new TimestampClock(0));
         rm.apply();
 
         ColumnFamily cf = cfStore.getColumnFamily(key, new QueryPath("StandardLong1"), getBytes(10),
ArrayUtils.EMPTY_BYTE_ARRAY, false, 1000);
@@ -70,7 +70,7 @@ public class TimeSortTest extends Cleanu
             RowMutation rm = new RowMutation("Keyspace1", Integer.toString(i).getBytes());
             for (int j = 0; j < 8; ++j)
             {
-                rm.add(new QueryPath("StandardLong1", null, getBytes(j * 2)), "a".getBytes(),
j * 2);
+                rm.add(new QueryPath("StandardLong1", null, getBytes(j * 2)), "a".getBytes(),
new TimestampClock(j * 2));
             }
             rm.apply();
         }
@@ -85,13 +85,13 @@ public class TimeSortTest extends Cleanu
         RowMutation rm = new RowMutation("Keyspace1", key.key);
         for (int j = 0; j < 4; ++j)
         {
-            rm.add(new QueryPath("StandardLong1", null, getBytes(j * 2 + 1)), "b".getBytes(),
j * 2 + 1);
+            rm.add(new QueryPath("StandardLong1", null, getBytes(j * 2 + 1)), "b".getBytes(),
new TimestampClock(j * 2 + 1));
         }
         rm.apply();
         // and some overwrites
         rm = new RowMutation("Keyspace1", key.key);
-        rm.add(new QueryPath("StandardLong1", null, getBytes(0)), "c".getBytes(), 100);
-        rm.add(new QueryPath("StandardLong1", null, getBytes(10)), "c".getBytes(), 100);
+        rm.add(new QueryPath("StandardLong1", null, getBytes(0)), "c".getBytes(), new TimestampClock(100));
+        rm.add(new QueryPath("StandardLong1", null, getBytes(10)), "c".getBytes(), new TimestampClock(100));
         rm.apply();
 
         // verify
@@ -126,7 +126,8 @@ public class TimeSortTest extends Cleanu
                 int k = j;
                 for (IColumn c : columns)
                 {
-                    assertEquals((k++) * 2, c.timestamp());
+                    assertEquals((k++) * 2, ((TimestampClock)c.clock()).timestamp());
+
                 }
             }
         }

Modified: cassandra/trunk/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java?rev=948316&r1=948315&r2=948316&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java Wed May
26 04:45:44 2010
@@ -35,7 +35,7 @@ public class SSTableReaderTest extends C
         {
             byte[] key = String.valueOf(j).getBytes();
             RowMutation rm = new RowMutation("Keyspace1", key);
-            rm.add(new QueryPath("Standard1", null, "0".getBytes()), new byte[0], j);
+            rm.add(new QueryPath("Standard1", null, "0".getBytes()), new byte[0], new TimestampClock(j));
             rm.apply();
         }
         store.forceBlockingFlush();

Modified: cassandra/trunk/test/unit/org/apache/cassandra/io/sstable/SSTableUtils.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/io/sstable/SSTableUtils.java?rev=948316&r1=948315&r2=948316&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/io/sstable/SSTableUtils.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/io/sstable/SSTableUtils.java Wed May 26
04:45:44 2010
@@ -34,7 +34,7 @@ public class SSTableUtils
     public static String TABLENAME = "Keyspace1";
     public static String CFNAME = "Standard1";
 
-    public static ColumnFamily createCF(long mfda, int ldt, IColumn... cols)
+    public static ColumnFamily createCF(IClock mfda, int ldt, IColumn... cols)
     {
         ColumnFamily cf = ColumnFamily.create(TABLENAME, CFNAME);
         cf.delete(ldt, mfda);
@@ -65,7 +65,7 @@ public class SSTableUtils
         for (String key : keys)
         {
             ColumnFamily cf = ColumnFamily.create(TABLENAME, CFNAME);
-            cf.addColumn(new Column(key.getBytes(), key.getBytes(), 0));
+            cf.addColumn(new Column(key.getBytes(), key.getBytes(), new TimestampClock(0)));
             map.put(key, cf);
         }
         return writeSSTable(map);

Modified: cassandra/trunk/test/unit/org/apache/cassandra/service/AntiEntropyServiceTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/service/AntiEntropyServiceTest.java?rev=948316&r1=948315&r2=948316&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/service/AntiEntropyServiceTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/service/AntiEntropyServiceTest.java Wed
May 26 04:45:44 2010
@@ -119,7 +119,7 @@ public class AntiEntropyServiceTest exte
         List<RowMutation> rms = new LinkedList<RowMutation>();
         RowMutation rm;
         rm = new RowMutation(tablename, "key1".getBytes());
-        rm.add(new QueryPath(cfname, null, "Column1".getBytes()), "asdf".getBytes(), 0);
+        rm.add(new QueryPath(cfname, null, "Column1".getBytes()), "asdf".getBytes(), new
TimestampClock(0));
         rms.add(rm);
         Util.writeColumnFamily(rms);
 
@@ -177,7 +177,7 @@ public class AntiEntropyServiceTest exte
         // populate column family
         List<RowMutation> rms = new LinkedList<RowMutation>();
         RowMutation rm = new RowMutation(tablename, "key".getBytes());
-        rm.add(new QueryPath(cfname, null, "Column1".getBytes()), "asdf".getBytes(), 0);
+        rm.add(new QueryPath(cfname, null, "Column1".getBytes()), "asdf".getBytes(), new
TimestampClock(0));
         rms.add(rm);
         // with two SSTables
         Util.writeColumnFamily(rms);

Modified: cassandra/trunk/test/unit/org/apache/cassandra/service/EmbeddedCassandraServiceTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/service/EmbeddedCassandraServiceTest.java?rev=948316&r1=948315&r2=948316&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/service/EmbeddedCassandraServiceTest.java
(original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/service/EmbeddedCassandraServiceTest.java
Wed May 26 04:45:44 2010
@@ -30,6 +30,7 @@ import org.apache.cassandra.config.Confi
 import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.config.KSMetaData;
 import org.apache.cassandra.thrift.Cassandra;
+import org.apache.cassandra.thrift.Clock;
 import org.apache.cassandra.thrift.Column;
 import org.apache.cassandra.thrift.ColumnOrSuperColumn;
 import org.apache.cassandra.thrift.Column;
@@ -111,8 +112,10 @@ public class EmbeddedCassandraServiceTes
         cp.setColumn("name".getBytes("utf-8"));
 
         // insert
+        Clock clock = new Clock();
+        clock.setTimestamp(timestamp);
         client.insert(key_user_id, par, new Column("name".getBytes("utf-8"),
-                "Ran".getBytes("UTF-8"), timestamp), ConsistencyLevel.ONE);
+                "Ran".getBytes("UTF-8"), clock), ConsistencyLevel.ONE);
 
         // read
         ColumnOrSuperColumn got = client.get(key_user_id, cp,

Modified: cassandra/trunk/test/unit/org/apache/cassandra/service/ReadResponseResolverTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/service/ReadResponseResolverTest.java?rev=948316&r1=948315&r2=948316&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/service/ReadResponseResolverTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/service/ReadResponseResolverTest.java Wed
May 26 04:45:44 2010
@@ -27,6 +27,7 @@ import org.apache.cassandra.SchemaLoader
 import org.junit.Test;
 
 import org.apache.cassandra.db.ColumnFamily;
+import org.apache.cassandra.db.TimestampClock;
 
 import static org.apache.cassandra.db.TableTest.assertColumns;
 import static org.apache.cassandra.Util.column;
@@ -38,10 +39,10 @@ public class ReadResponseResolverTest ex
     public void testResolveSupersetNewer()
     {
         ColumnFamily cf1 = ColumnFamily.create("Keyspace1", "Standard1");
-        cf1.addColumn(column("c1", "v1", 0));
+        cf1.addColumn(column("c1", "v1", new TimestampClock(0)));
 
         ColumnFamily cf2 = ColumnFamily.create("Keyspace1", "Standard1");
-        cf2.addColumn(column("c1", "v2", 1));
+        cf2.addColumn(column("c1", "v2", new TimestampClock(1)));
 
         ColumnFamily resolved = ReadResponseResolver.resolveSuperset(Arrays.asList(cf1, cf2));
         assertColumns(resolved, "c1");
@@ -53,10 +54,10 @@ public class ReadResponseResolverTest ex
     public void testResolveSupersetDisjoint()
     {
         ColumnFamily cf1 = ColumnFamily.create("Keyspace1", "Standard1");
-        cf1.addColumn(column("c1", "v1", 0));
+        cf1.addColumn(column("c1", "v1", new TimestampClock(0)));
 
         ColumnFamily cf2 = ColumnFamily.create("Keyspace1", "Standard1");
-        cf2.addColumn(column("c2", "v2", 1));
+        cf2.addColumn(column("c2", "v2", new TimestampClock(1)));
 
         ColumnFamily resolved = ReadResponseResolver.resolveSuperset(Arrays.asList(cf1, cf2));
         assertColumns(resolved, "c1", "c2");
@@ -68,7 +69,7 @@ public class ReadResponseResolverTest ex
     public void testResolveSupersetNullOne()
     {
         ColumnFamily cf2 = ColumnFamily.create("Keyspace1", "Standard1");
-        cf2.addColumn(column("c2", "v2", 1));
+        cf2.addColumn(column("c2", "v2", new TimestampClock(1)));
 
         ColumnFamily resolved = ReadResponseResolver.resolveSuperset(Arrays.asList(null,
cf2));
         assertColumns(resolved, "c2");
@@ -80,7 +81,7 @@ public class ReadResponseResolverTest ex
     public void testResolveSupersetNullTwo()
     {
         ColumnFamily cf1 = ColumnFamily.create("Keyspace1", "Standard1");
-        cf1.addColumn(column("c1", "v1", 0));
+        cf1.addColumn(column("c1", "v1", new TimestampClock(0)));
 
         ColumnFamily resolved = ReadResponseResolver.resolveSuperset(Arrays.asList(cf1, null));
         assertColumns(resolved, "c1");

Modified: cassandra/trunk/test/unit/org/apache/cassandra/tools/SSTableExportTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/tools/SSTableExportTest.java?rev=948316&r1=948315&r2=948316&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/tools/SSTableExportTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/tools/SSTableExportTest.java Wed May 26
04:45:44 2010
@@ -27,6 +27,7 @@ import java.util.Arrays;
 import org.apache.cassandra.SchemaLoader;
 import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.db.ColumnFamily;
+import org.apache.cassandra.db.TimestampClock;
 import org.apache.cassandra.db.filter.QueryFilter;
 import org.apache.cassandra.db.filter.QueryPath;
 import org.apache.cassandra.dht.IPartitioner;
@@ -63,14 +64,14 @@ public class SSTableExportTest extends S
         SSTableWriter writer = new SSTableWriter(tempSS.getPath(), 2, partitioner);
         
         // Add rowA
-        cfamily.addColumn(new QueryPath("Standard1", null, "colA".getBytes()), "valA".getBytes(),
1);
+        cfamily.addColumn(new QueryPath("Standard1", null, "colA".getBytes()), "valA".getBytes(),
new TimestampClock(1));
         ColumnFamily.serializer().serializeWithIndexes(cfamily, dob);
         writer.append(Util.dk("rowA"), dob);
         dob.reset();
         cfamily.clear();
         
         // Add rowB
-        cfamily.addColumn(new QueryPath("Standard1", null, "colB".getBytes()), "valB".getBytes(),
1);
+        cfamily.addColumn(new QueryPath("Standard1", null, "colB".getBytes()), "valB".getBytes(),
new TimestampClock(1));
         ColumnFamily.serializer().serializeWithIndexes(cfamily, dob);
         writer.append(Util.dk("rowB"), dob);
         dob.reset();
@@ -101,21 +102,21 @@ public class SSTableExportTest extends S
         SSTableWriter writer = new SSTableWriter(tempSS.getPath(), 2, partitioner);
         
         // Add rowA
-        cfamily.addColumn(new QueryPath("Standard1", null, "colA".getBytes()), "valA".getBytes(),
1);
+        cfamily.addColumn(new QueryPath("Standard1", null, "colA".getBytes()), "valA".getBytes(),
new TimestampClock(1));
         ColumnFamily.serializer().serializeWithIndexes(cfamily, dob);
         writer.append(Util.dk("rowA"), dob);
         dob.reset();
         cfamily.clear();
         
         // Add rowB
-        cfamily.addColumn(new QueryPath("Standard1", null, "colB".getBytes()), "valB".getBytes(),
1);
+        cfamily.addColumn(new QueryPath("Standard1", null, "colB".getBytes()), "valB".getBytes(),
new TimestampClock(1));
         ColumnFamily.serializer().serializeWithIndexes(cfamily, dob);
         writer.append(Util.dk("rowB"), dob);
         dob.reset();
         cfamily.clear();
 
         // Add rowExclude
-        cfamily.addColumn(new QueryPath("Standard1", null, "colX".getBytes()), "valX".getBytes(),
1);
+        cfamily.addColumn(new QueryPath("Standard1", null, "colX".getBytes()), "valX".getBytes(),
new TimestampClock(1));
         ColumnFamily.serializer().serializeWithIndexes(cfamily, dob);
         writer.append(Util.dk("rowExclude"), dob);
         dob.reset();
@@ -151,21 +152,21 @@ public class SSTableExportTest extends S
         SSTableWriter writer = new SSTableWriter(tempSS.getPath(), 2, partitioner);
         
         // Add rowA
-        cfamily.addColumn(new QueryPath("Super4", "superA".getBytes(), "colA".getBytes()),
"valA".getBytes(), 1);
+        cfamily.addColumn(new QueryPath("Super4", "superA".getBytes(), "colA".getBytes()),
"valA".getBytes(), new TimestampClock(1));
         ColumnFamily.serializer().serializeWithIndexes(cfamily, dob);
         writer.append(Util.dk("rowA"), dob);
         dob.reset();
         cfamily.clear();
         
         // Add rowB
-        cfamily.addColumn(new QueryPath("Super4", "superB".getBytes(), "colB".getBytes()),
"valB".getBytes(), 1);
+        cfamily.addColumn(new QueryPath("Super4", "superB".getBytes(), "colB".getBytes()),
"valB".getBytes(), new TimestampClock(1));
         ColumnFamily.serializer().serializeWithIndexes(cfamily, dob);
         writer.append(Util.dk("rowB"), dob);
         dob.reset();
         cfamily.clear();
 
         // Add rowExclude
-        cfamily.addColumn(new QueryPath("Super4", "superX".getBytes(), "colX".getBytes()),
"valX".getBytes(), 1);
+        cfamily.addColumn(new QueryPath("Super4", "superX".getBytes(), "colX".getBytes()),
"valX".getBytes(), new TimestampClock(1));
         ColumnFamily.serializer().serializeWithIndexes(cfamily, dob);
         writer.append(Util.dk("rowExclude"), dob);
         dob.reset();
@@ -199,14 +200,14 @@ public class SSTableExportTest extends S
         SSTableWriter writer = new SSTableWriter(tempSS.getPath(), 2, partitioner);
         
         // Add rowA
-        cfamily.addColumn(new QueryPath("Standard1", null, "name".getBytes()), "val".getBytes(),
1);
+        cfamily.addColumn(new QueryPath("Standard1", null, "name".getBytes()), "val".getBytes(),
new TimestampClock(1));
         ColumnFamily.serializer().serializeWithIndexes(cfamily, dob);
         writer.append(Util.dk("rowA"), dob);
         dob.reset();
         cfamily.clear();
 
         // Add rowExclude
-        cfamily.addColumn(new QueryPath("Standard1", null, "name".getBytes()), "val".getBytes(),
1);
+        cfamily.addColumn(new QueryPath("Standard1", null, "name".getBytes()), "val".getBytes(),
new TimestampClock(1));
         ColumnFamily.serializer().serializeWithIndexes(cfamily, dob);
         writer.append(Util.dk("rowExclude"), dob);
         dob.reset();

Modified: cassandra/trunk/test/unit/org/apache/cassandra/utils/FBUtilitiesTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/utils/FBUtilitiesTest.java?rev=948316&r1=948315&r2=948316&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/utils/FBUtilitiesTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/utils/FBUtilitiesTest.java Wed May 26 04:45:44
2010
@@ -21,6 +21,12 @@ package org.apache.cassandra.utils;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.apache.cassandra.db.IClock;
+import org.apache.cassandra.db.TimestampClock;
+
+
 import org.junit.Test;
 
 public class FBUtilitiesTest 
@@ -53,4 +59,25 @@ public class FBUtilitiesTest 
             assertEquals(i, actual);
         }
     }
+    
+    @Test
+    public void testAtomicSetMaxIClock()
+    {
+        AtomicReference<IClock> atomicClock = new AtomicReference<IClock>(null);
+        
+        // atomic < new
+        atomicClock.set(TimestampClock.MIN_VALUE);
+        FBUtilities.atomicSetMax(atomicClock, new TimestampClock(1L));
+        assert ((TimestampClock)atomicClock.get()).timestamp() == 1L;
+        
+        // atomic == new
+        atomicClock.set(new TimestampClock(3L));
+        FBUtilities.atomicSetMax(atomicClock, new TimestampClock(3L));
+        assert ((TimestampClock)atomicClock.get()).timestamp() == 3L;
+
+        // atomic > new
+        atomicClock.set(new TimestampClock(9L));
+        FBUtilities.atomicSetMax(atomicClock, new TimestampClock(3L));
+        assert ((TimestampClock)atomicClock.get()).timestamp() == 9L;
+    } 
 }



Mime
View raw message