You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sl...@apache.org on 2013/01/02 13:41:16 UTC
[1/9] Replace supercolumns internally by composites
http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a005df3/test/unit/org/apache/cassandra/db/compaction/CompactionsPurgeTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/compaction/CompactionsPurgeTest.java b/test/unit/org/apache/cassandra/db/compaction/CompactionsPurgeTest.java
index deac172..7511002 100644
--- a/test/unit/org/apache/cassandra/db/compaction/CompactionsPurgeTest.java
+++ b/test/unit/org/apache/cassandra/db/compaction/CompactionsPurgeTest.java
@@ -28,15 +28,13 @@ import junit.framework.Assert;
import org.junit.Test;
import org.apache.cassandra.SchemaLoader;
-import org.apache.cassandra.db.IColumn;
+import org.apache.cassandra.db.Column;
import org.apache.cassandra.db.Table;
import org.apache.cassandra.db.DecoratedKey;
import org.apache.cassandra.db.RowMutation;
import org.apache.cassandra.db.ColumnFamily;
import org.apache.cassandra.db.ColumnFamilyStore;
-import org.apache.cassandra.db.SuperColumn;
import org.apache.cassandra.db.filter.QueryFilter;
-import org.apache.cassandra.db.filter.QueryPath;
import org.apache.cassandra.io.sstable.SSTableReader;
import org.apache.cassandra.Util;
@@ -66,7 +64,7 @@ public class CompactionsPurgeTest extends SchemaLoader
rm = new RowMutation(TABLE1, key.key);
for (int i = 0; i < 10; i++)
{
- rm.add(new QueryPath(cfName, null, ByteBufferUtil.bytes(String.valueOf(i))), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
+ rm.add(cfName, ByteBufferUtil.bytes(String.valueOf(i)), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
}
rm.apply();
cfs.forceBlockingFlush();
@@ -75,21 +73,21 @@ public class CompactionsPurgeTest extends SchemaLoader
for (int i = 0; i < 10; i++)
{
rm = new RowMutation(TABLE1, key.key);
- rm.delete(new QueryPath(cfName, null, ByteBufferUtil.bytes(String.valueOf(i))), 1);
+ rm.delete(cfName, ByteBufferUtil.bytes(String.valueOf(i)), 1);
rm.apply();
}
cfs.forceBlockingFlush();
// resurrect one column
rm = new RowMutation(TABLE1, key.key);
- rm.add(new QueryPath(cfName, null, ByteBufferUtil.bytes(String.valueOf(5))), ByteBufferUtil.EMPTY_BYTE_BUFFER, 2);
+ rm.add(cfName, ByteBufferUtil.bytes(String.valueOf(5)), ByteBufferUtil.EMPTY_BYTE_BUFFER, 2);
rm.apply();
cfs.forceBlockingFlush();
// major compact and test that all columns but the resurrected one is completely gone
CompactionManager.instance.submitMaximal(cfs, Integer.MAX_VALUE).get();
cfs.invalidateCachedRow(key);
- ColumnFamily cf = cfs.getColumnFamily(QueryFilter.getIdentityFilter(key, new QueryPath(cfName)));
+ ColumnFamily cf = cfs.getColumnFamily(QueryFilter.getIdentityFilter(key, cfName));
assertColumns(cf, "5");
assert cf.getColumn(ByteBufferUtil.bytes(String.valueOf(5))) != null;
}
@@ -111,7 +109,7 @@ public class CompactionsPurgeTest extends SchemaLoader
rm = new RowMutation(TABLE2, key.key);
for (int i = 0; i < 10; i++)
{
- rm.add(new QueryPath(cfName, null, ByteBufferUtil.bytes(String.valueOf(i))), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
+ rm.add(cfName, ByteBufferUtil.bytes(String.valueOf(i)), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
}
rm.apply();
cfs.forceBlockingFlush();
@@ -120,7 +118,7 @@ public class CompactionsPurgeTest extends SchemaLoader
for (int i = 0; i < 10; i++)
{
rm = new RowMutation(TABLE2, key.key);
- rm.delete(new QueryPath(cfName, null, ByteBufferUtil.bytes(String.valueOf(i))), 1);
+ rm.delete(cfName, ByteBufferUtil.bytes(String.valueOf(i)), 1);
rm.apply();
}
cfs.forceBlockingFlush();
@@ -134,19 +132,19 @@ public class CompactionsPurgeTest extends SchemaLoader
cfs.forceBlockingFlush();
Collection<SSTableReader> sstablesIncomplete = cfs.getSSTables();
rm = new RowMutation(TABLE2, key1.key);
- rm.add(new QueryPath(cfName, null, ByteBufferUtil.bytes(String.valueOf(5))), ByteBufferUtil.EMPTY_BYTE_BUFFER, 2);
+ rm.add(cfName, ByteBufferUtil.bytes(String.valueOf(5)), ByteBufferUtil.EMPTY_BYTE_BUFFER, 2);
rm.apply();
cfs.forceBlockingFlush();
new CompactionTask(cfs, sstablesIncomplete, Integer.MAX_VALUE).execute(null);
// verify that minor compaction does not GC when key is present
// in a non-compacted sstable
- ColumnFamily cf = cfs.getColumnFamily(QueryFilter.getIdentityFilter(key1, new QueryPath(cfName)));
+ ColumnFamily cf = cfs.getColumnFamily(QueryFilter.getIdentityFilter(key1, cfName));
Assert.assertEquals(10, cf.getColumnCount());
// verify that minor compaction does GC when key is provably not
// present in a non-compacted sstable
- cf = cfs.getColumnFamily(QueryFilter.getIdentityFilter(key2, new QueryPath(cfName)));
+ cf = cfs.getColumnFamily(QueryFilter.getIdentityFilter(key2, cfName));
assert cf == null;
}
@@ -162,25 +160,25 @@ public class CompactionsPurgeTest extends SchemaLoader
DecoratedKey key3 = Util.dk("key3");
// inserts
rm = new RowMutation(TABLE2, key3.key);
- rm.add(new QueryPath(cfName, null, ByteBufferUtil.bytes("c1")), ByteBufferUtil.EMPTY_BYTE_BUFFER, 8);
- rm.add(new QueryPath(cfName, null, ByteBufferUtil.bytes("c2")), ByteBufferUtil.EMPTY_BYTE_BUFFER, 8);
+ rm.add(cfName, ByteBufferUtil.bytes("c1"), ByteBufferUtil.EMPTY_BYTE_BUFFER, 8);
+ rm.add(cfName, ByteBufferUtil.bytes("c2"), ByteBufferUtil.EMPTY_BYTE_BUFFER, 8);
rm.apply();
cfs.forceBlockingFlush();
// deletes
rm = new RowMutation(TABLE2, key3.key);
- rm.delete(new QueryPath(cfName, null, ByteBufferUtil.bytes("c1")), 10);
+ rm.delete(cfName, ByteBufferUtil.bytes("c1"), 10);
rm.apply();
cfs.forceBlockingFlush();
Collection<SSTableReader> sstablesIncomplete = cfs.getSSTables();
// delete so we have new delete in a diffrent SST.
rm = new RowMutation(TABLE2, key3.key);
- rm.delete(new QueryPath(cfName, null, ByteBufferUtil.bytes("c2")), 9);
+ rm.delete(cfName, ByteBufferUtil.bytes("c2"), 9);
rm.apply();
cfs.forceBlockingFlush();
new CompactionTask(cfs, sstablesIncomplete, Integer.MAX_VALUE).execute(null);
- ColumnFamily cf = cfs.getColumnFamily(QueryFilter.getIdentityFilter(key3, new QueryPath(cfName)));
+ ColumnFamily cf = cfs.getColumnFamily(QueryFilter.getIdentityFilter(key3, cfName));
Assert.assertTrue(!cf.getColumn(ByteBufferUtil.bytes("c2")).isLive());
Assert.assertEquals(1, cf.getColumnCount());
}
@@ -201,7 +199,7 @@ public class CompactionsPurgeTest extends SchemaLoader
rm = new RowMutation(TABLE1, key.key);
for (int i = 0; i < 5; i++)
{
- rm.add(new QueryPath(cfName, null, ByteBufferUtil.bytes(String.valueOf(i))), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
+ rm.add(cfName, ByteBufferUtil.bytes(String.valueOf(i)), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
}
rm.apply();
@@ -209,7 +207,7 @@ public class CompactionsPurgeTest extends SchemaLoader
for (int i = 0; i < 5; i++)
{
rm = new RowMutation(TABLE1, key.key);
- rm.delete(new QueryPath(cfName, null, ByteBufferUtil.bytes(String.valueOf(i))), 1);
+ rm.delete(cfName, ByteBufferUtil.bytes(String.valueOf(i)), 1);
rm.apply();
}
cfs.forceBlockingFlush();
@@ -218,7 +216,7 @@ public class CompactionsPurgeTest extends SchemaLoader
// compact and test that the row is completely gone
Util.compactAll(cfs).get();
assert cfs.getSSTables().isEmpty();
- ColumnFamily cf = table.getColumnFamilyStore(cfName).getColumnFamily(QueryFilter.getIdentityFilter(key, new QueryPath(cfName)));
+ ColumnFamily cf = table.getColumnFamilyStore(cfName).getColumnFamily(QueryFilter.getIdentityFilter(key, cfName));
assert cf == null : cf;
}
@@ -239,16 +237,16 @@ public class CompactionsPurgeTest extends SchemaLoader
rm = new RowMutation(tableName, key.key);
for (int i = 0; i < 10; i++)
{
- rm.add(new QueryPath(cfName, null, ByteBufferUtil.bytes(String.valueOf(i))), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
+ rm.add(cfName, ByteBufferUtil.bytes(String.valueOf(i)), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
}
rm.apply();
// move the key up in row cache
- cfs.getColumnFamily(QueryFilter.getIdentityFilter(key, new QueryPath(cfName)));
+ cfs.getColumnFamily(QueryFilter.getIdentityFilter(key, cfName));
// deletes row
rm = new RowMutation(tableName, key.key);
- rm.delete(new QueryPath(cfName, null, null), 1);
+ rm.delete(cfName, 1);
rm.apply();
// flush and major compact
@@ -259,14 +257,14 @@ public class CompactionsPurgeTest extends SchemaLoader
rm = new RowMutation(tableName, key.key);
for (int i = 0; i < 10; i++)
{
- rm.add(new QueryPath(cfName, null, ByteBufferUtil.bytes(String.valueOf(i))), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
+ rm.add(cfName, ByteBufferUtil.bytes(String.valueOf(i)), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
}
rm.apply();
// Check that the second insert did went in
- ColumnFamily cf = cfs.getColumnFamily(QueryFilter.getIdentityFilter(key, new QueryPath(cfName)));
+ ColumnFamily cf = cfs.getColumnFamily(QueryFilter.getIdentityFilter(key, cfName));
assertEquals(10, cf.getColumnCount());
- for (IColumn c : cf)
+ for (Column c : cf)
assert !c.isMarkedForDelete();
}
@@ -287,13 +285,13 @@ public class CompactionsPurgeTest extends SchemaLoader
rm = new RowMutation(tableName, key.key);
for (int i = 0; i < 10; i++)
{
- rm.add(new QueryPath(cfName, null, ByteBufferUtil.bytes(String.valueOf(i))), ByteBufferUtil.EMPTY_BYTE_BUFFER, i);
+ rm.add(cfName, ByteBufferUtil.bytes(String.valueOf(i)), ByteBufferUtil.EMPTY_BYTE_BUFFER, i);
}
rm.apply();
// deletes row with timestamp such that not all columns are deleted
rm = new RowMutation(tableName, key.key);
- rm.delete(new QueryPath(cfName, null, null), 4);
+ rm.delete(cfName, 4);
rm.apply();
// flush and major compact (with tombstone purging)
@@ -304,61 +302,14 @@ public class CompactionsPurgeTest extends SchemaLoader
rm = new RowMutation(tableName, key.key);
for (int i = 0; i < 5; i++)
{
- rm.add(new QueryPath(cfName, null, ByteBufferUtil.bytes(String.valueOf(i))), ByteBufferUtil.EMPTY_BYTE_BUFFER, i);
+ rm.add(cfName, ByteBufferUtil.bytes(String.valueOf(i)), ByteBufferUtil.EMPTY_BYTE_BUFFER, i);
}
rm.apply();
// Check that the second insert did went in
- ColumnFamily cf = cfs.getColumnFamily(QueryFilter.getIdentityFilter(key, new QueryPath(cfName)));
+ ColumnFamily cf = cfs.getColumnFamily(QueryFilter.getIdentityFilter(key, cfName));
assertEquals(10, cf.getColumnCount());
- for (IColumn c : cf)
+ for (Column c : cf)
assert !c.isMarkedForDelete();
}
-
- @Test
- public void testCompactionPurgeTombstonedSuperColumn() throws IOException, ExecutionException, InterruptedException
- {
- CompactionManager.instance.disableAutoCompaction();
-
- String tableName = "Keyspace1";
- String cfName = "Super5";
- Table table = Table.open(tableName);
- ColumnFamilyStore cfs = table.getColumnFamilyStore(cfName);
-
- DecoratedKey key = Util.dk("key5");
- RowMutation rm;
-
- ByteBuffer scName = ByteBufferUtil.bytes("sc");
-
- // inserts
- rm = new RowMutation(tableName, key.key);
- for (int i = 0; i < 10; i++)
- {
- rm.add(new QueryPath(cfName, scName, ByteBuffer.wrap(String.valueOf(i).getBytes())), ByteBufferUtil.EMPTY_BYTE_BUFFER, i);
- }
- rm.apply();
-
- // deletes supercolumn with timestamp such that not all columns go
- rm = new RowMutation(tableName, key.key);
- rm.delete(new QueryPath(cfName, scName, null), 4);
- rm.apply();
-
- // flush and major compact
- cfs.forceBlockingFlush();
- Util.compactAll(cfs).get();
-
- // re-inserts with timestamp lower than delete
- rm = new RowMutation(tableName, key.key);
- for (int i = 0; i < 5; i++)
- {
- rm.add(new QueryPath(cfName, scName, ByteBuffer.wrap(String.valueOf(i).getBytes())), ByteBufferUtil.EMPTY_BYTE_BUFFER, i);
- }
- rm.apply();
-
- // Check that the second insert did went in
- ColumnFamily cf = cfs.getColumnFamily(QueryFilter.getIdentityFilter(key, new QueryPath(cfName)));
- SuperColumn sc = (SuperColumn)cf.getColumn(scName);
- assert sc != null;
- assertEquals(10, sc.getColumnCount());
- }
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a005df3/test/unit/org/apache/cassandra/db/compaction/CompactionsTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/compaction/CompactionsTest.java b/test/unit/org/apache/cassandra/db/compaction/CompactionsTest.java
index b013d6d..efef7bd 100644
--- a/test/unit/org/apache/cassandra/db/compaction/CompactionsTest.java
+++ b/test/unit/org/apache/cassandra/db/compaction/CompactionsTest.java
@@ -36,7 +36,7 @@ import org.apache.cassandra.db.*;
import org.apache.cassandra.db.columniterator.IdentityQueryFilter;
import org.apache.cassandra.db.columniterator.OnDiskAtomIterator;
import org.apache.cassandra.db.filter.QueryFilter;
-import org.apache.cassandra.db.filter.QueryPath;
+import org.apache.cassandra.db.marshal.CompositeType;
import org.apache.cassandra.io.sstable.SSTableReader;
import org.apache.cassandra.io.sstable.SSTableScanner;
import org.apache.cassandra.io.util.FileUtils;
@@ -78,7 +78,7 @@ public class CompactionsTest extends SchemaLoader
DecoratedKey key = Util.dk(Integer.toString(i));
RowMutation rm = new RowMutation(TABLE1, key.key);
for (int j = 0; j < 10; j++)
- rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes(Integer.toString(j))),
+ rm.add("Standard1", ByteBufferUtil.bytes(Integer.toString(j)),
ByteBufferUtil.EMPTY_BYTE_BUFFER,
timestamp,
j > 0 ? 3 : 0); // let first column never expire, since deleting all columns does not produce sstable
@@ -138,7 +138,7 @@ public class CompactionsTest extends SchemaLoader
// a subcolumn
RowMutation rm = new RowMutation(TABLE1, key.key);
- rm.add(new QueryPath("Super1", scName, ByteBufferUtil.bytes(0)),
+ rm.add("Super1", CompositeType.build(scName, ByteBufferUtil.bytes(0)),
ByteBufferUtil.EMPTY_BYTE_BUFFER,
FBUtilities.timestampMicros());
rm.apply();
@@ -146,7 +146,7 @@ public class CompactionsTest extends SchemaLoader
// shadow the subcolumn with a supercolumn tombstone
rm = new RowMutation(TABLE1, key.key);
- rm.delete(new QueryPath("Super1", scName), FBUtilities.timestampMicros());
+ rm.deleteRange("Super1", SuperColumns.startOf(scName), SuperColumns.endOf(scName), FBUtilities.timestampMicros());
rm.apply();
cfs.forceBlockingFlush();
@@ -155,12 +155,12 @@ public class CompactionsTest extends SchemaLoader
// check that the shadowed column is gone
SSTableReader sstable = cfs.getSSTables().iterator().next();
- SSTableScanner scanner = sstable.getScanner(new QueryFilter(null, new QueryPath("Super1", scName), new IdentityQueryFilter()));
+ SSTableScanner scanner = sstable.getScanner(new QueryFilter(null, "Super1", new IdentityQueryFilter()));
scanner.seekTo(key);
OnDiskAtomIterator iter = scanner.next();
assertEquals(key, iter.getKey());
- SuperColumn sc = (SuperColumn) iter.next();
- assert sc.getSubColumns().isEmpty();
+ assert iter.next() instanceof RangeTombstone;
+ assert !iter.hasNext();
}
public static void assertMaxTimestamp(ColumnFamilyStore cfs, long maxTimestampExpected)
@@ -188,7 +188,7 @@ public class CompactionsTest extends SchemaLoader
{
DecoratedKey key = Util.dk(String.valueOf(i));
RowMutation rm = new RowMutation(TABLE1, key.key);
- rm.add(new QueryPath("Standard2", null, ByteBufferUtil.bytes(String.valueOf(i))), ByteBufferUtil.EMPTY_BYTE_BUFFER, i);
+ rm.add("Standard2", ByteBufferUtil.bytes(String.valueOf(i)), ByteBufferUtil.EMPTY_BYTE_BUFFER, i);
rm.apply();
if (i % 2 == 0)
@@ -203,7 +203,7 @@ public class CompactionsTest extends SchemaLoader
{
DecoratedKey key = Util.dk(String.valueOf(i));
RowMutation rm = new RowMutation(TABLE1, key.key);
- rm.add(new QueryPath("Standard2", null, ByteBufferUtil.bytes(String.valueOf(i))), ByteBufferUtil.EMPTY_BYTE_BUFFER, i);
+ rm.add("Standard2", ByteBufferUtil.bytes(String.valueOf(i)), ByteBufferUtil.EMPTY_BYTE_BUFFER, i);
rm.apply();
}
cfs.forceBlockingFlush();
@@ -250,19 +250,19 @@ public class CompactionsTest extends SchemaLoader
// Add test row
DecoratedKey key = Util.dk(k);
RowMutation rm = new RowMutation(TABLE1, key.key);
- rm.add(new QueryPath(cfname, ByteBufferUtil.bytes("sc"), ByteBufferUtil.bytes("c")), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
+ rm.add(cfname, CompositeType.build(ByteBufferUtil.bytes("sc"), ByteBufferUtil.bytes("c")), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
rm.apply();
cfs.forceBlockingFlush();
Collection<SSTableReader> sstablesBefore = cfs.getSSTables();
- QueryFilter filter = QueryFilter.getIdentityFilter(key, new QueryPath(cfname, null, null));
+ QueryFilter filter = QueryFilter.getIdentityFilter(key, cfname);
assert !cfs.getColumnFamily(filter).isEmpty();
// Remove key
rm = new RowMutation(TABLE1, key.key);
- rm.delete(new QueryPath(cfname, null, null), 2);
+ rm.delete(cfname, 2);
rm.apply();
ColumnFamily cf = cfs.getColumnFamily(filter);
@@ -306,7 +306,7 @@ public class CompactionsTest extends SchemaLoader
DecoratedKey key = Util.dk(String.valueOf(i % 2));
RowMutation rm = new RowMutation(TABLE1, key.key);
long timestamp = j * ROWS_PER_SSTABLE + i;
- rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes(String.valueOf(i / 2))),
+ rm.add("Standard1", ByteBufferUtil.bytes(String.valueOf(i / 2)),
ByteBufferUtil.EMPTY_BYTE_BUFFER,
timestamp);
maxTimestampExpected = Math.max(timestamp, maxTimestampExpected);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a005df3/test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java b/test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java
index 6a329c3..e9cf236 100644
--- a/test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java
+++ b/test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java
@@ -28,7 +28,6 @@ import org.apache.cassandra.db.ColumnFamilyStore;
import org.apache.cassandra.db.DecoratedKey;
import org.apache.cassandra.db.RowMutation;
import org.apache.cassandra.db.Table;
-import org.apache.cassandra.db.filter.QueryPath;
import org.apache.cassandra.dht.Range;
import org.apache.cassandra.dht.Token;
import org.apache.cassandra.io.sstable.SSTable;
@@ -63,7 +62,7 @@ public class LeveledCompactionStrategyTest extends SchemaLoader
RowMutation rm = new RowMutation(ksname, key.key);
for (int c = 0; c < columns; c++)
{
- rm.add(new QueryPath(cfname, null, ByteBufferUtil.bytes("column" + c)), value, 0);
+ rm.add(cfname, ByteBufferUtil.bytes("column" + c), value, 0);
}
rm.apply();
store.forceBlockingFlush();
@@ -105,7 +104,7 @@ public class LeveledCompactionStrategyTest extends SchemaLoader
RowMutation rm = new RowMutation(ksname, key.key);
for (int c = 0; c < columns; c++)
{
- rm.add(new QueryPath(cfname, null, ByteBufferUtil.bytes("column" + c)), value, 0);
+ rm.add(cfname, ByteBufferUtil.bytes("column" + c), value, 0);
}
rm.apply();
store.forceBlockingFlush();
http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a005df3/test/unit/org/apache/cassandra/db/compaction/OneCompactionTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/compaction/OneCompactionTest.java b/test/unit/org/apache/cassandra/db/compaction/OneCompactionTest.java
index 67906c5..fb5ee93 100644
--- a/test/unit/org/apache/cassandra/db/compaction/OneCompactionTest.java
+++ b/test/unit/org/apache/cassandra/db/compaction/OneCompactionTest.java
@@ -33,7 +33,6 @@ import org.apache.cassandra.db.DecoratedKey;
import org.apache.cassandra.db.RowMutation;
import org.apache.cassandra.db.ColumnFamilyStore;
-import org.apache.cassandra.db.filter.QueryPath;
import org.apache.cassandra.SchemaLoader;
import org.apache.cassandra.utils.ByteBufferUtil;
@@ -51,7 +50,7 @@ public class OneCompactionTest extends SchemaLoader
for (int j = 0; j < insertsPerTable; j++) {
DecoratedKey key = Util.dk(String.valueOf(j));
RowMutation rm = new RowMutation("Keyspace1", key.key);
- rm.add(new QueryPath(columnFamilyName, null, ByteBufferUtil.bytes("0")), ByteBufferUtil.EMPTY_BYTE_BUFFER, j);
+ rm.add(columnFamilyName, ByteBufferUtil.bytes("0"), ByteBufferUtil.EMPTY_BYTE_BUFFER, j);
rm.apply();
inserted.add(key);
store.forceBlockingFlush();
http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a005df3/test/unit/org/apache/cassandra/db/marshal/CompositeTypeTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/marshal/CompositeTypeTest.java b/test/unit/org/apache/cassandra/db/marshal/CompositeTypeTest.java
index 2ed715e..5fd98a9 100644
--- a/test/unit/org/apache/cassandra/db/marshal/CompositeTypeTest.java
+++ b/test/unit/org/apache/cassandra/db/marshal/CompositeTypeTest.java
@@ -35,7 +35,6 @@ import org.apache.cassandra.exceptions.ConfigurationException;
import org.apache.cassandra.exceptions.SyntaxException;
import org.apache.cassandra.db.*;
import org.apache.cassandra.db.filter.QueryFilter;
-import org.apache.cassandra.db.filter.QueryPath;
import org.apache.cassandra.utils.*;
public class CompositeTypeTest extends SchemaLoader
@@ -182,9 +181,9 @@ public class CompositeTypeTest extends SchemaLoader
addColumn(rm, cname3);
rm.apply();
- ColumnFamily cf = cfs.getColumnFamily(QueryFilter.getIdentityFilter(Util.dk("k"), new QueryPath(cfName, null, null)));
+ ColumnFamily cf = cfs.getColumnFamily(QueryFilter.getIdentityFilter(Util.dk("k"), cfName));
- Iterator<IColumn> iter = cf.getSortedColumns().iterator();
+ Iterator<Column> iter = cf.getSortedColumns().iterator();
assert iter.next().name().equals(cname1);
assert iter.next().name().equals(cname2);
@@ -258,7 +257,7 @@ public class CompositeTypeTest extends SchemaLoader
private void addColumn(RowMutation rm, ByteBuffer cname)
{
- rm.add(new QueryPath(cfName, null , cname), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
+ rm.add(cfName, cname, ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
}
private ByteBuffer createCompositeKey(String s, UUID uuid, int i, boolean lastIsOne)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a005df3/test/unit/org/apache/cassandra/db/marshal/DynamicCompositeTypeTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/marshal/DynamicCompositeTypeTest.java b/test/unit/org/apache/cassandra/db/marshal/DynamicCompositeTypeTest.java
index af9e85a..f681403 100644
--- a/test/unit/org/apache/cassandra/db/marshal/DynamicCompositeTypeTest.java
+++ b/test/unit/org/apache/cassandra/db/marshal/DynamicCompositeTypeTest.java
@@ -31,7 +31,6 @@ import org.apache.cassandra.SchemaLoader;
import org.apache.cassandra.Util;
import org.apache.cassandra.db.*;
import org.apache.cassandra.db.filter.QueryFilter;
-import org.apache.cassandra.db.filter.QueryPath;
import org.apache.cassandra.utils.*;
public class DynamicCompositeTypeTest extends SchemaLoader
@@ -180,9 +179,9 @@ public class DynamicCompositeTypeTest extends SchemaLoader
addColumn(rm, cname3);
rm.apply();
- ColumnFamily cf = cfs.getColumnFamily(QueryFilter.getIdentityFilter(Util.dk("k"), new QueryPath(cfName, null, null)));
+ ColumnFamily cf = cfs.getColumnFamily(QueryFilter.getIdentityFilter(Util.dk("k"), cfName));
- Iterator<IColumn> iter = cf.getSortedColumns().iterator();
+ Iterator<Column> iter = cf.getSortedColumns().iterator();
assert iter.next().name().equals(cname1);
assert iter.next().name().equals(cname2);
@@ -231,7 +230,7 @@ public class DynamicCompositeTypeTest extends SchemaLoader
private void addColumn(RowMutation rm, ByteBuffer cname)
{
- rm.add(new QueryPath(cfName, null , cname), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
+ rm.add(cfName, cname, ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
}
private ByteBuffer createDynamicCompositeKey(String s, UUID uuid, int i, boolean lastIsOne)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a005df3/test/unit/org/apache/cassandra/io/LazilyCompactedRowTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/io/LazilyCompactedRowTest.java b/test/unit/org/apache/cassandra/io/LazilyCompactedRowTest.java
index ccb5b2c..eff932c 100644
--- a/test/unit/org/apache/cassandra/io/LazilyCompactedRowTest.java
+++ b/test/unit/org/apache/cassandra/io/LazilyCompactedRowTest.java
@@ -35,7 +35,6 @@ import org.apache.cassandra.SchemaLoader;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.db.*;
import org.apache.cassandra.db.compaction.*;
-import org.apache.cassandra.db.filter.QueryPath;
import org.apache.cassandra.io.sstable.Descriptor;
import org.apache.cassandra.io.sstable.SSTableIdentityIterator;
import org.apache.cassandra.io.sstable.SSTableReader;
@@ -128,8 +127,8 @@ public class LazilyCompactedRowTest extends SchemaLoader
assert columns == in2.readInt();
for (int i = 0; i < columns; i++)
{
- IColumn c1 = (IColumn)cf1.getOnDiskSerializer().deserializeFromSSTable(in1, Descriptor.Version.CURRENT);
- IColumn c2 = (IColumn)cf2.getOnDiskSerializer().deserializeFromSSTable(in2, Descriptor.Version.CURRENT);
+ Column c1 = (Column)Column.onDiskSerializer().deserializeFromSSTable(in1, Descriptor.Version.CURRENT);
+ Column c2 = (Column)Column.onDiskSerializer().deserializeFromSSTable(in2, Descriptor.Version.CURRENT);
assert c1.equals(c2) : c1.getString(cfs.metadata.comparator) + " != " + c2.getString(cfs.metadata.comparator);
}
// that should be everything
@@ -177,7 +176,7 @@ public class LazilyCompactedRowTest extends SchemaLoader
ByteBuffer key = ByteBufferUtil.bytes("k");
RowMutation rm = new RowMutation("Keyspace1", key);
- rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("c")), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
+ rm.add("Standard1", ByteBufferUtil.bytes("c"), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
rm.apply();
cfs.forceBlockingFlush();
@@ -195,8 +194,8 @@ public class LazilyCompactedRowTest extends SchemaLoader
ByteBuffer key = ByteBufferUtil.bytes("k");
RowMutation rm = new RowMutation("Keyspace1", key);
- rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("c")), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
- rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("d")), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
+ rm.add("Standard1", ByteBufferUtil.bytes("c"), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
+ rm.add("Standard1", ByteBufferUtil.bytes("d"), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
rm.apply();
cfs.forceBlockingFlush();
@@ -215,7 +214,7 @@ public class LazilyCompactedRowTest extends SchemaLoader
ByteBuffer key = ByteBuffer.wrap("k".getBytes());
RowMutation rm = new RowMutation("Keyspace1", key);
for (int i = 0; i < 1000; i++)
- rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes(i)), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
+ rm.add("Standard1", ByteBufferUtil.bytes(i), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
rm.apply();
DataOutputBuffer out = new DataOutputBuffer();
RowMutation.serializer.serialize(rm, out, MessagingService.current_version);
@@ -236,7 +235,7 @@ public class LazilyCompactedRowTest extends SchemaLoader
ByteBuffer key = ByteBufferUtil.bytes("k");
RowMutation rm = new RowMutation("Keyspace1", key);
- rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("c")), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
+ rm.add("Standard1", ByteBufferUtil.bytes("c"), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
rm.apply();
cfs.forceBlockingFlush();
@@ -257,8 +256,8 @@ public class LazilyCompactedRowTest extends SchemaLoader
ByteBuffer key = ByteBufferUtil.bytes("k");
RowMutation rm = new RowMutation("Keyspace1", key);
- rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("c")), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
- rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("d")), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
+ rm.add("Standard1", ByteBufferUtil.bytes("c"), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
+ rm.add("Standard1", ByteBufferUtil.bytes("d"), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
rm.apply();
cfs.forceBlockingFlush();
@@ -284,7 +283,7 @@ public class LazilyCompactedRowTest extends SchemaLoader
{
ByteBuffer key = ByteBufferUtil.bytes(String.valueOf(i % 2));
RowMutation rm = new RowMutation("Keyspace1", key);
- rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes(String.valueOf(i / 2))), ByteBufferUtil.EMPTY_BYTE_BUFFER, j * ROWS_PER_SSTABLE + i);
+ rm.add("Standard1", ByteBufferUtil.bytes(String.valueOf(i / 2)), ByteBufferUtil.EMPTY_BYTE_BUFFER, j * ROWS_PER_SSTABLE + i);
rm.apply();
}
cfs.forceBlockingFlush();
@@ -294,28 +293,6 @@ public class LazilyCompactedRowTest extends SchemaLoader
assertDigest(cfs, Integer.MAX_VALUE);
}
- @Test
- public void testTwoRowSuperColumn() throws IOException, ExecutionException, InterruptedException
- {
- CompactionManager.instance.disableAutoCompaction();
-
- Table table = Table.open("Keyspace4");
- ColumnFamilyStore cfs = table.getColumnFamilyStore("Super5");
-
- ByteBuffer key = ByteBufferUtil.bytes("k");
- RowMutation rm = new RowMutation("Keyspace4", key);
- ByteBuffer scKey = ByteBuffer.wrap(UUIDGen.getTimeUUIDBytes());
- rm.add(new QueryPath("Super5", scKey , ByteBufferUtil.bytes("c")), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
- rm.apply();
- cfs.forceBlockingFlush();
-
- rm.apply();
- cfs.forceBlockingFlush();
-
- assertBytes(cfs, Integer.MAX_VALUE);
- }
-
-
private static class LazilyCompactingController extends CompactionController
{
public LazilyCompactingController(ColumnFamilyStore cfs, Collection<SSTableReader> sstables, int gcBefore, boolean forceDeserialize)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a005df3/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java b/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java
index 1026301..6e1e5c2 100644
--- a/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java
+++ b/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java
@@ -38,7 +38,6 @@ import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.db.*;
import org.apache.cassandra.db.columniterator.IdentityQueryFilter;
import org.apache.cassandra.db.compaction.CompactionManager;
-import org.apache.cassandra.db.filter.QueryPath;
import org.apache.cassandra.dht.IPartitioner;
import org.apache.cassandra.dht.LocalPartitioner;
import org.apache.cassandra.dht.LocalToken;
@@ -75,7 +74,7 @@ public class SSTableReaderTest extends SchemaLoader
{
ByteBuffer key = ByteBufferUtil.bytes(String.valueOf(j));
RowMutation rm = new RowMutation("Keyspace1", key);
- rm.add(new QueryPath("Standard2", null, ByteBufferUtil.bytes("0")), ByteBufferUtil.EMPTY_BYTE_BUFFER, j);
+ rm.add("Standard2", ByteBufferUtil.bytes("0"), ByteBufferUtil.EMPTY_BYTE_BUFFER, j);
rm.apply();
}
store.forceBlockingFlush();
@@ -116,7 +115,7 @@ public class SSTableReaderTest extends SchemaLoader
{
ByteBuffer key = ByteBufferUtil.bytes(String.valueOf(j));
RowMutation rm = new RowMutation("Keyspace1", key);
- rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("0")), ByteBufferUtil.EMPTY_BYTE_BUFFER, j);
+ rm.add("Standard1", ByteBufferUtil.bytes("0"), ByteBufferUtil.EMPTY_BYTE_BUFFER, j);
rm.apply();
}
store.forceBlockingFlush();
@@ -153,7 +152,7 @@ public class SSTableReaderTest extends SchemaLoader
{
ByteBuffer key = ByteBufferUtil.bytes(String.valueOf(j));
RowMutation rm = new RowMutation("Keyspace1", key);
- rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("0")), ByteBufferUtil.EMPTY_BYTE_BUFFER, j);
+ rm.add("Standard1", ByteBufferUtil.bytes("0"), ByteBufferUtil.EMPTY_BYTE_BUFFER, j);
rm.apply();
}
store.forceBlockingFlush();
@@ -181,7 +180,7 @@ public class SSTableReaderTest extends SchemaLoader
{
ByteBuffer key = ByteBufferUtil.bytes(String.valueOf(j));
RowMutation rm = new RowMutation("Keyspace1", key);
- rm.add(new QueryPath("Standard2", null, ByteBufferUtil.bytes("0")), ByteBufferUtil.EMPTY_BYTE_BUFFER, j);
+ rm.add("Standard2", ByteBufferUtil.bytes("0"), ByteBufferUtil.EMPTY_BYTE_BUFFER, j);
rm.apply();
}
store.forceBlockingFlush();
@@ -210,7 +209,7 @@ public class SSTableReaderTest extends SchemaLoader
ColumnFamilyStore store = table.getColumnFamilyStore("Indexed1");
ByteBuffer key = ByteBufferUtil.bytes(String.valueOf("k1"));
RowMutation rm = new RowMutation("Keyspace1", key);
- rm.add(new QueryPath("Indexed1", null, ByteBufferUtil.bytes("birthdate")), ByteBufferUtil.bytes(1L), System.currentTimeMillis());
+ rm.add("Indexed1", ByteBufferUtil.bytes("birthdate"), ByteBufferUtil.bytes(1L), System.currentTimeMillis());
rm.apply();
store.forceBlockingFlush();
@@ -270,7 +269,7 @@ public class SSTableReaderTest extends SchemaLoader
if (store.metadata.getKeyValidator().compare(lastKey.key, key.key) < 0)
lastKey = key;
RowMutation rm = new RowMutation(ks, key.key);
- rm.add(new QueryPath(cf, null, ByteBufferUtil.bytes("col")),
+ rm.add(cf, ByteBufferUtil.bytes("col"),
ByteBufferUtil.EMPTY_BYTE_BUFFER, timestamp);
rm.apply();
}
@@ -294,7 +293,7 @@ public class SSTableReaderTest extends SchemaLoader
ColumnFamilyStore store = table.getColumnFamilyStore("Indexed1");
ByteBuffer key = ByteBufferUtil.bytes(String.valueOf("k1"));
RowMutation rm = new RowMutation("Keyspace1", key);
- rm.add(new QueryPath("Indexed1", null, ByteBufferUtil.bytes("birthdate")), ByteBufferUtil.bytes(1L), System.currentTimeMillis());
+ rm.add("Indexed1", ByteBufferUtil.bytes("birthdate"), ByteBufferUtil.bytes(1L), System.currentTimeMillis());
rm.apply();
store.forceBlockingFlush();
http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a005df3/test/unit/org/apache/cassandra/io/sstable/SSTableSimpleWriterTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/io/sstable/SSTableSimpleWriterTest.java b/test/unit/org/apache/cassandra/io/sstable/SSTableSimpleWriterTest.java
index 6efdc9b..1b14613 100644
--- a/test/unit/org/apache/cassandra/io/sstable/SSTableSimpleWriterTest.java
+++ b/test/unit/org/apache/cassandra/io/sstable/SSTableSimpleWriterTest.java
@@ -92,7 +92,7 @@ public class SSTableSimpleWriterTest extends SchemaLoader
ColumnFamily cf = Util.getColumnFamily(t, Util.dk("Key10"), cfname);
assert cf.getColumnCount() == INC * NBCOL : "expecting " + (INC * NBCOL) + " columns, got " + cf.getColumnCount();
int i = 0;
- for (IColumn c : cf)
+ for (Column c : cf)
{
assert toInt(c.name()) == i : "Column name should be " + i + ", got " + toInt(c.name());
assert c.value().equals(bytes("v"));
http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a005df3/test/unit/org/apache/cassandra/io/sstable/SSTableTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/io/sstable/SSTableTest.java b/test/unit/org/apache/cassandra/io/sstable/SSTableTest.java
index 12f2747..40ec0be 100644
--- a/test/unit/org/apache/cassandra/io/sstable/SSTableTest.java
+++ b/test/unit/org/apache/cassandra/io/sstable/SSTableTest.java
@@ -41,7 +41,7 @@ public class SSTableTest extends SchemaLoader
ByteBuffer cbytes = ByteBuffer.wrap(new byte[1024]);
new Random().nextBytes(cbytes.array());
ColumnFamily cf = ColumnFamily.create("Keyspace1", "Standard1");
- cf.addColumn(null, new Column(cbytes, cbytes));
+ cf.addColumn(new Column(cbytes, cbytes));
SortedMap<DecoratedKey, ColumnFamily> map = new TreeMap<DecoratedKey, ColumnFamily>();
map.put(Util.dk(key), cf);
@@ -75,7 +75,7 @@ public class SSTableTest extends SchemaLoader
{
ColumnFamily cf = ColumnFamily.create("Keyspace1", "Standard2");
ByteBuffer bytes = ByteBufferUtil.bytes(("Avinash Lakshman is a good man: " + i));
- cf.addColumn(null, new Column(bytes, bytes));
+ cf.addColumn(new Column(bytes, bytes));
map.put(Util.dk(Integer.toString(i)), cf);
bytesMap.put(ByteBufferUtil.bytes(Integer.toString(i)), Util.serializeForSSTable(cf));
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a005df3/test/unit/org/apache/cassandra/io/sstable/SSTableUtils.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/io/sstable/SSTableUtils.java b/test/unit/org/apache/cassandra/io/sstable/SSTableUtils.java
index 2b0a13a..03759af 100644
--- a/test/unit/org/apache/cassandra/io/sstable/SSTableUtils.java
+++ b/test/unit/org/apache/cassandra/io/sstable/SSTableUtils.java
@@ -27,7 +27,6 @@ import org.apache.cassandra.db.Column;
import org.apache.cassandra.db.ColumnFamily;
import org.apache.cassandra.db.DecoratedKey;
import org.apache.cassandra.db.DeletionInfo;
-import org.apache.cassandra.db.IColumn;
import org.apache.cassandra.db.columniterator.OnDiskAtomIterator;
import org.apache.cassandra.utils.ByteBufferUtil;
@@ -40,11 +39,11 @@ 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(long mfda, int ldt, Column... cols)
{
ColumnFamily cf = ColumnFamily.create(TABLENAME, CFNAME);
cf.delete(new DeletionInfo(mfda, ldt));
- for (IColumn col : cols)
+ for (Column col : cols)
cf.addColumn(col);
return cf;
}
@@ -102,9 +101,9 @@ public class SSTableUtils
// iterate columns
while (lhs.hasNext())
{
- IColumn clhs = (IColumn)lhs.next();
+ Column clhs = (Column)lhs.next();
assert rhs.hasNext() : "LHS contained more columns than RHS for " + lhs.getKey();
- IColumn crhs = (IColumn)rhs.next();
+ Column crhs = (Column)rhs.next();
assertEquals("Mismatched columns for " + lhs.getKey(), clhs, crhs);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a005df3/test/unit/org/apache/cassandra/service/AntiEntropyServiceCounterTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/service/AntiEntropyServiceCounterTest.java b/test/unit/org/apache/cassandra/service/AntiEntropyServiceCounterTest.java
index ec0dffc..8689703 100644
--- a/test/unit/org/apache/cassandra/service/AntiEntropyServiceCounterTest.java
+++ b/test/unit/org/apache/cassandra/service/AntiEntropyServiceCounterTest.java
@@ -24,7 +24,6 @@ import java.util.List;
import java.util.LinkedList;
import org.apache.cassandra.db.*;
-import org.apache.cassandra.db.filter.QueryPath;
import org.apache.cassandra.utils.ByteBufferUtil;
import org.apache.cassandra.db.ConsistencyLevel;
@@ -40,7 +39,7 @@ public class AntiEntropyServiceCounterTest extends AntiEntropyServiceTestAbstrac
{
List<IMutation> rms = new LinkedList<IMutation>();
RowMutation rm = new RowMutation(tablename, ByteBufferUtil.bytes("key1"));
- rm.addCounter(new QueryPath(cfname, null, ByteBufferUtil.bytes("Column1")), 42);
+ rm.addCounter(cfname, ByteBufferUtil.bytes("Column1"), 42);
rms.add(new CounterMutation(rm, ConsistencyLevel.ONE));
return rms;
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a005df3/test/unit/org/apache/cassandra/service/AntiEntropyServiceStandardTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/service/AntiEntropyServiceStandardTest.java b/test/unit/org/apache/cassandra/service/AntiEntropyServiceStandardTest.java
index f419c37..76b0af2 100644
--- a/test/unit/org/apache/cassandra/service/AntiEntropyServiceStandardTest.java
+++ b/test/unit/org/apache/cassandra/service/AntiEntropyServiceStandardTest.java
@@ -24,7 +24,6 @@ import java.util.List;
import java.util.LinkedList;
import org.apache.cassandra.db.*;
-import org.apache.cassandra.db.filter.QueryPath;
import org.apache.cassandra.utils.ByteBufferUtil;
public class AntiEntropyServiceStandardTest extends AntiEntropyServiceTestAbstract
@@ -40,7 +39,7 @@ public class AntiEntropyServiceStandardTest extends AntiEntropyServiceTestAbstra
List<IMutation> rms = new LinkedList<IMutation>();
RowMutation rm;
rm = new RowMutation(tablename, ByteBufferUtil.bytes("key1"));
- rm.add(new QueryPath(cfname, null, ByteBufferUtil.bytes("Column1")), ByteBufferUtil.bytes("asdfasdf"), 0);
+ rm.add(cfname, ByteBufferUtil.bytes("Column1"), ByteBufferUtil.bytes("asdfasdf"), 0);
rms.add(rm);
return rms;
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a005df3/test/unit/org/apache/cassandra/service/CassandraServerTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/service/CassandraServerTest.java b/test/unit/org/apache/cassandra/service/CassandraServerTest.java
index af2d1c7..7bd0b8b 100644
--- a/test/unit/org/apache/cassandra/service/CassandraServerTest.java
+++ b/test/unit/org/apache/cassandra/service/CassandraServerTest.java
@@ -27,7 +27,6 @@ import org.apache.cassandra.Util;
import org.apache.cassandra.config.Schema;
import org.apache.cassandra.db.DecoratedKey;
import org.apache.cassandra.db.RowMutation;
-import org.apache.cassandra.db.filter.QueryPath;
import org.apache.cassandra.thrift.*;
import org.apache.cassandra.utils.ByteBufferUtil;
@@ -48,9 +47,7 @@ public class CassandraServerTest extends SchemaLoader
for (int i = 0; i < 3050; i++)
{
RowMutation rm = new RowMutation("Keyspace1", key.key);
- rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes(String.valueOf(i))),
- ByteBufferUtil.EMPTY_BYTE_BUFFER,
- System.currentTimeMillis());
+ rm.add("Standard1", ByteBufferUtil.bytes(String.valueOf(i)), ByteBufferUtil.EMPTY_BYTE_BUFFER, System.currentTimeMillis());
rm.apply();
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a005df3/test/unit/org/apache/cassandra/service/RowResolverTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/service/RowResolverTest.java b/test/unit/org/apache/cassandra/service/RowResolverTest.java
index 3c530f1..3373fd0 100644
--- a/test/unit/org/apache/cassandra/service/RowResolverTest.java
+++ b/test/unit/org/apache/cassandra/service/RowResolverTest.java
@@ -28,11 +28,9 @@ import org.junit.Test;
import org.apache.cassandra.SchemaLoader;
import org.apache.cassandra.db.ColumnFamily;
import org.apache.cassandra.db.DeletionInfo;
-import org.apache.cassandra.db.SuperColumn;
import static junit.framework.Assert.*;
import static org.apache.cassandra.Util.column;
-import static org.apache.cassandra.Util.superColumn;
import static org.apache.cassandra.db.TableTest.*;
public class RowResolverTest extends SchemaLoader
@@ -112,37 +110,6 @@ public class RowResolverTest extends SchemaLoader
assertColumns(resolved);
assertTrue(resolved.isMarkedForDelete());
assertEquals(1, resolved.deletionInfo().getTopLevelDeletion().markedForDeleteAt);
-
- ColumnFamily scf1 = ColumnFamily.create("Keyspace1", "Super1");
- scf1.addColumn(superColumn(scf1, "super-foo", column("one", "A", 0)));
-
- ColumnFamily scf2 = ColumnFamily.create("Keyspace1", "Super1");
- scf2.delete(new DeletionInfo(1L, (int) (System.currentTimeMillis() / 1000)));
-
- ColumnFamily superResolved = RowRepairResolver.resolveSuperset(Arrays.asList(scf1, scf2));
- // no columns in the cf
- assertColumns(superResolved);
- assertTrue(superResolved.isMarkedForDelete());
- assertEquals(1, superResolved.deletionInfo().getTopLevelDeletion().markedForDeleteAt);
- }
-
- @Test
- public void testResolveDeletedSuper()
- {
- // subcolumn is newer than a tombstone on its parent, but not newer than the row deletion
- ColumnFamily scf1 = ColumnFamily.create("Keyspace1", "Super1");
- SuperColumn sc = superColumn(scf1, "super-foo", column("one", "A", 1));
- sc.delete(new DeletionInfo(0L, (int) (System.currentTimeMillis() / 1000)));
- scf1.addColumn(sc);
-
- ColumnFamily scf2 = ColumnFamily.create("Keyspace1", "Super1");
- scf2.delete(new DeletionInfo(2L, (int) (System.currentTimeMillis() / 1000)));
-
- ColumnFamily superResolved = RowRepairResolver.resolveSuperset(Arrays.asList(scf1, scf2));
- // no columns in the cf
- assertColumns(superResolved);
- assertTrue(superResolved.isMarkedForDelete());
- assertEquals(2, superResolved.deletionInfo().getTopLevelDeletion().markedForDeleteAt);
}
@Test
@@ -171,35 +138,5 @@ public class RowResolverTest extends SchemaLoader
assertColumn(resolved, "two", "B", 3);
assertTrue(resolved.isMarkedForDelete());
assertEquals(2, resolved.deletionInfo().getTopLevelDeletion().markedForDeleteAt);
-
-
- ColumnFamily scf1 = ColumnFamily.create("Keyspace1", "Super1");
- scf1.delete(new DeletionInfo(0L, (int) (System.currentTimeMillis() / 1000)));
-
- // these columns created after the previous deletion
- ColumnFamily scf2 = ColumnFamily.create("Keyspace1", "Super1");
- scf2.addColumn(superColumn(scf2, "super1", column("one", "A", 1), column("two", "A", 1)));
-
- //these columns created after the next delete
- ColumnFamily scf3 = ColumnFamily.create("Keyspace1", "Super1");
- scf3.addColumn(superColumn(scf3, "super1", column("two", "B", 3)));
- scf3.addColumn(superColumn(scf3, "super2", column("three", "A", 3), column("four", "A", 3)));
-
- ColumnFamily scf4 = ColumnFamily.create("Keyspace1", "Super1");
- scf4.delete(new DeletionInfo(2L, (int) (System.currentTimeMillis() / 1000)));
-
- ColumnFamily superResolved = RowRepairResolver.resolveSuperset(Arrays.asList(scf1, scf2, scf3, scf4));
- // will have deleted marker and two super cols
- assertColumns(superResolved, "super1", "super2");
-
- assertSubColumns(superResolved, "super1", "two");
- assertSubColumn(superResolved, "super1", "two", "B", 3);
-
- assertSubColumns(superResolved, "super2", "four", "three");
- assertSubColumn(superResolved, "super2", "three", "A", 3);
- assertSubColumn(superResolved, "super2", "four", "A", 3);
-
- assertTrue(superResolved.isMarkedForDelete());
- assertEquals(2, superResolved.deletionInfo().getTopLevelDeletion().markedForDeleteAt);
}
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a005df3/test/unit/org/apache/cassandra/streaming/BootstrapTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/streaming/BootstrapTest.java b/test/unit/org/apache/cassandra/streaming/BootstrapTest.java
index 1af3074..ab7296a 100644
--- a/test/unit/org/apache/cassandra/streaming/BootstrapTest.java
+++ b/test/unit/org/apache/cassandra/streaming/BootstrapTest.java
@@ -36,7 +36,7 @@ public class BootstrapTest extends SchemaLoader
@Test
public void testGetNewNames() throws IOException
{
- Descriptor desc = Descriptor.fromFilename(new File("Keyspace1", "Keyspace1-Standard1-ib-500-Data.db").toString());
+ Descriptor desc = Descriptor.fromFilename(new File("Keyspace1", "Keyspace1-Standard1-ic-500-Data.db").toString());
// assert !desc.isLatestVersion; // minimum compatible version -- for now it is the latest as well
PendingFile inContext = new PendingFile(null, desc, "Data.db", Arrays.asList(Pair.create(0L, 1L)), OperationType.BOOTSTRAP);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a005df3/test/unit/org/apache/cassandra/streaming/SerializationsTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/streaming/SerializationsTest.java b/test/unit/org/apache/cassandra/streaming/SerializationsTest.java
index 5ebbc13..a81feba 100644
--- a/test/unit/org/apache/cassandra/streaming/SerializationsTest.java
+++ b/test/unit/org/apache/cassandra/streaming/SerializationsTest.java
@@ -30,7 +30,6 @@ import org.apache.cassandra.AbstractSerializationsTester;
import org.apache.cassandra.db.ColumnFamilyStore;
import org.apache.cassandra.db.RowMutation;
import org.apache.cassandra.db.Table;
-import org.apache.cassandra.db.filter.QueryPath;
import org.apache.cassandra.dht.BytesToken;
import org.apache.cassandra.dht.Range;
import org.apache.cassandra.dht.Token;
@@ -205,7 +204,7 @@ public class SerializationsTest extends AbstractSerializationsTester
for (int i = 0; i < 100; i++)
{
RowMutation rm = new RowMutation(t.getName(), ByteBufferUtil.bytes(Long.toString(System.nanoTime())));
- rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("cola")), ByteBufferUtil.bytes("value"), 0);
+ rm.add("Standard1", ByteBufferUtil.bytes("cola"), ByteBufferUtil.bytes("value"), 0);
rm.apply();
}
try
http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a005df3/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java b/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java
index 86469e1..07b19ae 100644
--- a/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java
+++ b/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java
@@ -33,7 +33,6 @@ import org.apache.cassandra.db.columniterator.IdentityQueryFilter;
import org.apache.cassandra.db.context.CounterContext;
import org.apache.cassandra.db.filter.IDiskAtomFilter;
import org.apache.cassandra.db.filter.QueryFilter;
-import org.apache.cassandra.db.filter.QueryPath;
import org.apache.cassandra.dht.IPartitioner;
import org.apache.cassandra.dht.Range;
import org.apache.cassandra.dht.Token;
@@ -96,7 +95,7 @@ public class StreamingTransferTest extends SchemaLoader
{
String key = "key" + offs[i];
String col = "col" + offs[i];
- assert cfs.getColumnFamily(QueryFilter.getIdentityFilter(Util.dk(key), new QueryPath(cfs.name))) != null;
+ assert cfs.getColumnFamily(QueryFilter.getIdentityFilter(Util.dk(key), cfs.name)) != null;
assert rows.get(i).key.key.equals(ByteBufferUtil.bytes(key));
assert rows.get(i).cf.getColumn(ByteBufferUtil.bytes(col)) != null;
}
@@ -162,23 +161,6 @@ public class StreamingTransferTest extends SchemaLoader
}
@Test
- public void testTransferTableSuper() throws Exception
- {
- final Table table = Table.open("Keyspace1");
- final ColumnFamilyStore cfs = table.getColumnFamilyStore("Super1");
-
- createAndTransfer(table, cfs, new Mutator()
- {
- public void mutate(String key, String col, long timestamp) throws Exception
- {
- RowMutation rm = new RowMutation(table.getName(), ByteBufferUtil.bytes(key));
- addMutation(rm, cfs.name, col, 1, "val1", timestamp);
- rm.apply();
- }
- });
- }
-
- @Test
public void testTransferTableCounter() throws Exception
{
final Table table = Table.open("Keyspace1");
@@ -274,10 +256,10 @@ public class StreamingTransferTest extends SchemaLoader
assert rows.get(1).cf.getColumnCount() == 1;
// these keys fall outside of the ranges and should not be transferred
- assert cfstore.getColumnFamily(QueryFilter.getIdentityFilter(Util.dk("transfer1"), new QueryPath("Standard1"))) == null;
- assert cfstore.getColumnFamily(QueryFilter.getIdentityFilter(Util.dk("transfer2"), new QueryPath("Standard1"))) == null;
- assert cfstore.getColumnFamily(QueryFilter.getIdentityFilter(Util.dk("test2"), new QueryPath("Standard1"))) == null;
- assert cfstore.getColumnFamily(QueryFilter.getIdentityFilter(Util.dk("test3"), new QueryPath("Standard1"))) == null;
+ assert cfstore.getColumnFamily(QueryFilter.getIdentityFilter(Util.dk("transfer1"), "Standard1")) == null;
+ assert cfstore.getColumnFamily(QueryFilter.getIdentityFilter(Util.dk("transfer2"), "Standard1")) == null;
+ assert cfstore.getColumnFamily(QueryFilter.getIdentityFilter(Util.dk("test2"), "Standard1")) == null;
+ assert cfstore.getColumnFamily(QueryFilter.getIdentityFilter(Util.dk("test3"), "Standard1")) == null;
}
@Test
http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a005df3/test/unit/org/apache/cassandra/tools/SSTableExportTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/tools/SSTableExportTest.java b/test/unit/org/apache/cassandra/tools/SSTableExportTest.java
index aace9ef..c3a2e20 100644
--- a/test/unit/org/apache/cassandra/tools/SSTableExportTest.java
+++ b/test/unit/org/apache/cassandra/tools/SSTableExportTest.java
@@ -40,9 +40,7 @@ import org.apache.cassandra.db.ColumnFamily;
import org.apache.cassandra.db.CounterColumn;
import org.apache.cassandra.db.DeletionInfo;
import org.apache.cassandra.db.ExpiringColumn;
-import org.apache.cassandra.db.SuperColumn;
import org.apache.cassandra.db.filter.QueryFilter;
-import org.apache.cassandra.db.filter.QueryPath;
import org.apache.cassandra.db.marshal.UTF8Type;
import org.apache.cassandra.io.sstable.Descriptor;
import org.apache.cassandra.io.sstable.SSTableReader;
@@ -68,12 +66,12 @@ public class SSTableExportTest extends SchemaLoader
SSTableWriter writer = new SSTableWriter(tempSS.getPath(), 2);
// Add rowA
- cfamily.addColumn(new QueryPath("Standard1", null, ByteBufferUtil.bytes("colA")), ByteBufferUtil.bytes("valA"), System.currentTimeMillis());
+ cfamily.addColumn(ByteBufferUtil.bytes("colA"), ByteBufferUtil.bytes("valA"), System.currentTimeMillis());
writer.append(Util.dk("rowA"), cfamily);
cfamily.clear();
// Add rowB
- cfamily.addColumn(new QueryPath("Standard1", null, ByteBufferUtil.bytes("colB")), ByteBufferUtil.bytes("valB"), System.currentTimeMillis());
+ cfamily.addColumn(ByteBufferUtil.bytes("colB"), ByteBufferUtil.bytes("valB"), System.currentTimeMillis());
writer.append(Util.dk("rowB"), cfamily);
cfamily.clear();
@@ -102,18 +100,18 @@ public class SSTableExportTest extends SchemaLoader
int nowInSec = (int)(System.currentTimeMillis() / 1000) + 42; //live for 42 seconds
// Add rowA
- cfamily.addColumn(new QueryPath("Standard1", null, ByteBufferUtil.bytes("colA")), ByteBufferUtil.bytes("valA"), System.currentTimeMillis());
- cfamily.addColumn(null, new ExpiringColumn(ByteBufferUtil.bytes("colExp"), ByteBufferUtil.bytes("valExp"), System.currentTimeMillis(), 42, nowInSec));
+ cfamily.addColumn(ByteBufferUtil.bytes("colA"), ByteBufferUtil.bytes("valA"), System.currentTimeMillis());
+ cfamily.addColumn(new ExpiringColumn(ByteBufferUtil.bytes("colExp"), ByteBufferUtil.bytes("valExp"), System.currentTimeMillis(), 42, nowInSec));
writer.append(Util.dk("rowA"), cfamily);
cfamily.clear();
// Add rowB
- cfamily.addColumn(new QueryPath("Standard1", null, ByteBufferUtil.bytes("colB")), ByteBufferUtil.bytes("valB"), System.currentTimeMillis());
+ cfamily.addColumn(ByteBufferUtil.bytes("colB"), ByteBufferUtil.bytes("valB"), System.currentTimeMillis());
writer.append(Util.dk("rowB"), cfamily);
cfamily.clear();
// Add rowExclude
- cfamily.addColumn(new QueryPath("Standard1", null, ByteBufferUtil.bytes("colX")), ByteBufferUtil.bytes("valX"), System.currentTimeMillis());
+ cfamily.addColumn(ByteBufferUtil.bytes("colX"), ByteBufferUtil.bytes("valX"), System.currentTimeMillis());
writer.append(Util.dk("rowExclude"), cfamily);
cfamily.clear();
@@ -149,56 +147,6 @@ public class SSTableExportTest extends SchemaLoader
}
@Test
- public void testExportSuperCf() throws IOException, ParseException
- {
- File tempSS = tempSSTableFile("Keyspace1", "Super4");
- ColumnFamily cfamily = ColumnFamily.create("Keyspace1", "Super4");
- SSTableWriter writer = new SSTableWriter(tempSS.getPath(), 2);
-
- // Add rowA
- cfamily.addColumn(new QueryPath("Super4", ByteBufferUtil.bytes("superA"), ByteBufferUtil.bytes("colA")), ByteBufferUtil.bytes("valA"), System.currentTimeMillis());
- // set deletion info on the super col
- ((SuperColumn) cfamily.getColumn(ByteBufferUtil.bytes("superA"))).setDeletionInfo(new DeletionInfo(0, 0));
- writer.append(Util.dk("rowA"), cfamily);
- cfamily.clear();
-
- // Add rowB
- cfamily.addColumn(new QueryPath("Super4", ByteBufferUtil.bytes("superB"), ByteBufferUtil.bytes("colB")), ByteBufferUtil.bytes("valB"), System.currentTimeMillis());
- writer.append(Util.dk("rowB"), cfamily);
- cfamily.clear();
-
- // Add rowExclude
- cfamily.addColumn(new QueryPath("Super4", ByteBufferUtil.bytes("superX"), ByteBufferUtil.bytes("colX")), ByteBufferUtil.bytes("valX"), System.currentTimeMillis());
- writer.append(Util.dk("rowExclude"), cfamily);
- cfamily.clear();
-
- SSTableReader reader = writer.closeAndOpenReader();
-
- // Export to JSON and verify
- File tempJson = File.createTempFile("Super4", ".json");
- SSTableExport.export(reader, new PrintStream(tempJson.getPath()), new String[] { asHex("rowExclude") });
-
- JSONArray json = (JSONArray) JSONValue.parseWithException(new FileReader(tempJson));
- assertEquals("unexpected number of rows", 2, json.size());
-
- // make sure only the two rows we expect are there
- JSONObject rowA = (JSONObject) json.get(0);
- assertEquals("unexpected number of keys", 2, rowA.keySet().size());
- assertEquals("unexpected row key", asHex("rowA"), rowA.get("key"));
- JSONObject rowB = (JSONObject) json.get(0);
- assertEquals("unexpected number of keys", 2, rowB.keySet().size());
- assertEquals("unexpected row key", asHex("rowA"), rowB.get("key"));
-
- JSONObject cols = (JSONObject) rowA.get("columns");
-
- JSONObject superA = (JSONObject) cols.get(cfamily.getComparator().getString(ByteBufferUtil.bytes("superA")));
- JSONArray subColumns = (JSONArray) superA.get("subColumns");
- JSONArray colA = (JSONArray) subColumns.get(0);
- assert hexToBytes((String) colA.get(1)).equals(ByteBufferUtil.bytes("valA"));
- assert colA.size() == 3;
- }
-
- @Test
public void testRoundTripStandardCf() throws IOException, ParseException
{
File tempSS = tempSSTableFile("Keyspace1", "Standard1");
@@ -206,12 +154,12 @@ public class SSTableExportTest extends SchemaLoader
SSTableWriter writer = new SSTableWriter(tempSS.getPath(), 2);
// Add rowA
- cfamily.addColumn(new QueryPath("Standard1", null, ByteBufferUtil.bytes("name")), ByteBufferUtil.bytes("val"), System.currentTimeMillis());
+ cfamily.addColumn(ByteBufferUtil.bytes("name"), ByteBufferUtil.bytes("val"), System.currentTimeMillis());
writer.append(Util.dk("rowA"), cfamily);
cfamily.clear();
// Add rowExclude
- cfamily.addColumn(new QueryPath("Standard1", null, ByteBufferUtil.bytes("name")), ByteBufferUtil.bytes("val"), System.currentTimeMillis());
+ cfamily.addColumn(ByteBufferUtil.bytes("name"), ByteBufferUtil.bytes("val"), System.currentTimeMillis());
writer.append(Util.dk("rowExclude"), cfamily);
cfamily.clear();
@@ -226,13 +174,13 @@ public class SSTableExportTest extends SchemaLoader
new SSTableImport().importJson(tempJson.getPath(), "Keyspace1", "Standard1", tempSS2.getPath());
reader = SSTableReader.open(Descriptor.fromFilename(tempSS2.getPath()));
- QueryFilter qf = QueryFilter.getNamesFilter(Util.dk("rowA"), new QueryPath("Standard1", null, null), ByteBufferUtil.bytes("name"));
+ QueryFilter qf = QueryFilter.getNamesFilter(Util.dk("rowA"), "Standard1", ByteBufferUtil.bytes("name"));
ColumnFamily cf = qf.getSSTableColumnIterator(reader).getColumnFamily();
qf.collateOnDiskAtom(cf, Collections.singletonList(qf.getSSTableColumnIterator(reader)), Integer.MIN_VALUE);
assertTrue(cf != null);
assertTrue(cf.getColumn(ByteBufferUtil.bytes("name")).value().equals(hexToBytes("76616c")));
- qf = QueryFilter.getNamesFilter(Util.dk("rowExclude"), new QueryPath("Standard1", null, null), ByteBufferUtil.bytes("name"));
+ qf = QueryFilter.getNamesFilter(Util.dk("rowExclude"), "Standard1", ByteBufferUtil.bytes("name"));
cf = qf.getSSTableColumnIterator(reader).getColumnFamily();
assert cf == null;
}
@@ -245,7 +193,7 @@ public class SSTableExportTest extends SchemaLoader
SSTableWriter writer = new SSTableWriter(tempSS.getPath(), 2);
// Add rowA
- cfamily.addColumn(null, new CounterColumn(ByteBufferUtil.bytes("colA"), 42, System.currentTimeMillis()));
+ cfamily.addColumn(new CounterColumn(ByteBufferUtil.bytes("colA"), 42, System.currentTimeMillis()));
writer.append(Util.dk("rowA"), cfamily);
cfamily.clear();
@@ -276,7 +224,7 @@ public class SSTableExportTest extends SchemaLoader
SSTableWriter writer = new SSTableWriter(tempSS.getPath(), 2);
// Add rowA
- cfamily.addColumn(null, new Column(ByteBufferUtil.bytes("data"), UTF8Type.instance.fromString("{\"foo\":\"bar\"}")));
+ cfamily.addColumn(new Column(ByteBufferUtil.bytes("data"), UTF8Type.instance.fromString("{\"foo\":\"bar\"}")));
writer.append(Util.dk("rowA"), cfamily);
cfamily.clear();
@@ -308,10 +256,8 @@ public class SSTableExportTest extends SchemaLoader
SSTableWriter writer = new SSTableWriter(tempSS.getPath(), 2);
// Add rowA
- cfamily.addColumn(new QueryPath("Standard1", null, ByteBufferUtil.bytes("colName")),
- ByteBufferUtil.bytes("val"), System.currentTimeMillis());
- cfamily.addColumn(new QueryPath("Standard1", null, ByteBufferUtil.bytes("colName1")),
- ByteBufferUtil.bytes("val1"), System.currentTimeMillis());
+ cfamily.addColumn(ByteBufferUtil.bytes("colName"), ByteBufferUtil.bytes("val"), System.currentTimeMillis());
+ cfamily.addColumn(ByteBufferUtil.bytes("colName1"), ByteBufferUtil.bytes("val1"), System.currentTimeMillis());
cfamily.delete(new DeletionInfo(0, 0));
writer.append(Util.dk("rowA"), cfamily);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a005df3/test/unit/org/apache/cassandra/tools/SSTableImportTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/tools/SSTableImportTest.java b/test/unit/org/apache/cassandra/tools/SSTableImportTest.java
index 6bed245..a9d770a 100644
--- a/test/unit/org/apache/cassandra/tools/SSTableImportTest.java
+++ b/test/unit/org/apache/cassandra/tools/SSTableImportTest.java
@@ -32,16 +32,16 @@ import org.junit.Test;
import org.apache.cassandra.SchemaLoader;
import org.apache.cassandra.Util;
+import org.apache.cassandra.db.Column;
import org.apache.cassandra.db.ColumnFamily;
import org.apache.cassandra.db.CounterColumn;
import org.apache.cassandra.db.DeletedColumn;
import org.apache.cassandra.db.DeletionInfo;
+import org.apache.cassandra.db.DeletionTime;
import org.apache.cassandra.db.ExpiringColumn;
-import org.apache.cassandra.db.IColumn;
-import org.apache.cassandra.db.SuperColumn;
import org.apache.cassandra.db.columniterator.OnDiskAtomIterator;
import org.apache.cassandra.db.filter.QueryFilter;
-import org.apache.cassandra.db.filter.QueryPath;
+import org.apache.cassandra.db.marshal.CompositeType;
import org.apache.cassandra.io.sstable.Descriptor;
import org.apache.cassandra.io.sstable.SSTableReader;
import org.apache.cassandra.utils.ByteBufferUtil;
@@ -59,13 +59,13 @@ public class SSTableImportTest extends SchemaLoader
// Verify results
SSTableReader reader = SSTableReader.open(Descriptor.fromFilename(tempSS.getPath()));
- QueryFilter qf = QueryFilter.getIdentityFilter(Util.dk("rowA"), new QueryPath("Standard1"));
+ QueryFilter qf = QueryFilter.getIdentityFilter(Util.dk("rowA"), "Standard1");
OnDiskAtomIterator iter = qf.getSSTableColumnIterator(reader);
ColumnFamily cf = iter.getColumnFamily();
while (iter.hasNext()) cf.addAtom(iter.next());
assert cf.getColumn(ByteBufferUtil.bytes("colAA")).value().equals(hexToBytes("76616c4141"));
assert !(cf.getColumn(ByteBufferUtil.bytes("colAA")) instanceof DeletedColumn);
- IColumn expCol = cf.getColumn(ByteBufferUtil.bytes("colAC"));
+ Column expCol = cf.getColumn(ByteBufferUtil.bytes("colAC"));
assert expCol.value().equals(hexToBytes("76616c4143"));
assert expCol instanceof ExpiringColumn;
assert ((ExpiringColumn)expCol).getTimeToLive() == 42 && expCol.getLocalDeletionTime() == 2000000000;
@@ -88,13 +88,13 @@ public class SSTableImportTest extends SchemaLoader
// Verify results
SSTableReader reader = SSTableReader.open(Descriptor.fromFilename(tempSS.getPath()));
- QueryFilter qf = QueryFilter.getIdentityFilter(Util.dk("rowA"), new QueryPath("Standard1"));
+ QueryFilter qf = QueryFilter.getIdentityFilter(Util.dk("rowA"), "Standard1");
OnDiskAtomIterator iter = qf.getSSTableColumnIterator(reader);
ColumnFamily cf = iter.getColumnFamily();
while (iter.hasNext()) cf.addAtom(iter.next());
assert cf.getColumn(ByteBufferUtil.bytes("colAA")).value().equals(hexToBytes("76616c4141"));
assert !(cf.getColumn(ByteBufferUtil.bytes("colAA")) instanceof DeletedColumn);
- IColumn expCol = cf.getColumn(ByteBufferUtil.bytes("colAC"));
+ Column expCol = cf.getColumn(ByteBufferUtil.bytes("colAC"));
assert expCol.value().equals(hexToBytes("76616c4143"));
assert expCol instanceof ExpiringColumn;
assert ((ExpiringColumn)expCol).getTimeToLive() == 42 && expCol.getLocalDeletionTime() == 2000000000;
@@ -105,19 +105,17 @@ public class SSTableImportTest extends SchemaLoader
{
String jsonUrl = resourcePath("SuperCF.json");
File tempSS = tempSSTableFile("Keyspace1", "Super4");
- new SSTableImport(true).importJson(jsonUrl, "Keyspace1", "Super4", tempSS.getPath());
+ new SSTableImport(true, true).importJson(jsonUrl, "Keyspace1", "Super4", tempSS.getPath());
// Verify results
SSTableReader reader = SSTableReader.open(Descriptor.fromFilename(tempSS.getPath()));
- QueryFilter qf = QueryFilter.getNamesFilter(Util.dk("rowA"), new QueryPath("Super4", null, null), ByteBufferUtil.bytes("superA"));
+ QueryFilter qf = QueryFilter.getIdentityFilter(Util.dk("rowA"), "Super4");
ColumnFamily cf = qf.getSSTableColumnIterator(reader).getColumnFamily();
qf.collateOnDiskAtom(cf, Collections.singletonList(qf.getSSTableColumnIterator(reader)), Integer.MIN_VALUE);
- IColumn superCol = cf.getColumn(ByteBufferUtil.bytes("superA"));
- assertEquals("supercolumn deletion time did not match the expected time", new DeletionInfo(0, 0),
- ((SuperColumn) superCol).deletionInfo());
- assert superCol != null;
- assert superCol.getSubColumns().size() > 0;
- IColumn subColumn = superCol.getSubColumn(ByteBufferUtil.bytes("636f6c4141"));
+
+ DeletionTime delTime = cf.deletionInfo().rangeCovering(CompositeType.build(ByteBufferUtil.bytes("superA"))).iterator().next();
+ assertEquals("supercolumn deletion time did not match the expected time", new DeletionInfo(0, 0), new DeletionInfo(delTime));
+ Column subColumn = cf.getColumn(CompositeType.build(ByteBufferUtil.bytes("superA"), ByteBufferUtil.bytes("636f6c4141")));
assert subColumn.value().equals(hexToBytes("76616c75654141"));
}
@@ -127,7 +125,7 @@ public class SSTableImportTest extends SchemaLoader
String jsonUrl = resourcePath("UnsortedSuperCF.json");
File tempSS = tempSSTableFile("Keyspace1", "Super4");
- int result = new SSTableImport(3,true).importJson(jsonUrl, "Keyspace1","Super4", tempSS.getPath());
+ int result = new SSTableImport(3,true, true).importJson(jsonUrl, "Keyspace1","Super4", tempSS.getPath());
assert result == -1;
}
@@ -140,14 +138,14 @@ public class SSTableImportTest extends SchemaLoader
new SSTableImport().importJson(jsonUrl, "Keyspace1", "Standard1", tempSS.getPath());
SSTableReader reader = SSTableReader.open(Descriptor.fromFilename(tempSS.getPath()));
- QueryFilter qf = QueryFilter.getIdentityFilter(Util.dk("rowA"), new QueryPath("Standard1"));
+ QueryFilter qf = QueryFilter.getIdentityFilter(Util.dk("rowA"), "Standard1");
OnDiskAtomIterator iter = qf.getSSTableColumnIterator(reader);
ColumnFamily cf = iter.getColumnFamily();
while (iter.hasNext())
cf.addAtom(iter.next());
assert cf.getColumn(ByteBufferUtil.bytes("colAA")).value().equals(hexToBytes("76616c4141"));
assert !(cf.getColumn(ByteBufferUtil.bytes("colAA")) instanceof DeletedColumn);
- IColumn expCol = cf.getColumn(ByteBufferUtil.bytes("colAC"));
+ Column expCol = cf.getColumn(ByteBufferUtil.bytes("colAC"));
assert expCol.value().equals(hexToBytes("76616c4143"));
assert expCol instanceof ExpiringColumn;
assert ((ExpiringColumn) expCol).getTimeToLive() == 42 && expCol.getLocalDeletionTime() == 2000000000;
@@ -163,7 +161,7 @@ public class SSTableImportTest extends SchemaLoader
// Verify results
SSTableReader reader = SSTableReader.open(Descriptor.fromFilename(tempSS.getPath()));
- QueryFilter qf = QueryFilter.getIdentityFilter(Util.dk("rowA"), new QueryPath("Standard1"));
+ QueryFilter qf = QueryFilter.getIdentityFilter(Util.dk("rowA"), "Standard1");
OnDiskAtomIterator iter = qf.getSSTableColumnIterator(reader);
ColumnFamily cf = iter.getColumnFamily();
assertEquals(cf.deletionInfo(), new DeletionInfo(0, 0));
@@ -171,7 +169,7 @@ public class SSTableImportTest extends SchemaLoader
cf.addAtom(iter.next());
assert cf.getColumn(ByteBufferUtil.bytes("colAA")).value().equals(hexToBytes("76616c4141"));
assert !(cf.getColumn(ByteBufferUtil.bytes("colAA")) instanceof DeletedColumn);
- IColumn expCol = cf.getColumn(ByteBufferUtil.bytes("colAC"));
+ Column expCol = cf.getColumn(ByteBufferUtil.bytes("colAC"));
assert expCol.value().equals(hexToBytes("76616c4143"));
assert expCol instanceof ExpiringColumn;
assert ((ExpiringColumn) expCol).getTimeToLive() == 42 && expCol.getLocalDeletionTime() == 2000000000;
@@ -187,11 +185,11 @@ public class SSTableImportTest extends SchemaLoader
// Verify results
SSTableReader reader = SSTableReader.open(Descriptor.fromFilename(tempSS.getPath()));
- QueryFilter qf = QueryFilter.getIdentityFilter(Util.dk("rowA"), new QueryPath("Counter1"));
+ QueryFilter qf = QueryFilter.getIdentityFilter(Util.dk("rowA"), "Counter1");
OnDiskAtomIterator iter = qf.getSSTableColumnIterator(reader);
ColumnFamily cf = iter.getColumnFamily();
while (iter.hasNext()) cf.addAtom(iter.next());
- IColumn c = cf.getColumn(ByteBufferUtil.bytes("colAA"));
+ Column c = cf.getColumn(ByteBufferUtil.bytes("colAA"));
assert c instanceof CounterColumn: c;
assert ((CounterColumn) c).total() == 42;
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a005df3/test/unit/org/apache/cassandra/utils/EncodedStreamsTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/utils/EncodedStreamsTest.java b/test/unit/org/apache/cassandra/utils/EncodedStreamsTest.java
index 7fa4395..2258988 100644
--- a/test/unit/org/apache/cassandra/utils/EncodedStreamsTest.java
+++ b/test/unit/org/apache/cassandra/utils/EncodedStreamsTest.java
@@ -110,14 +110,6 @@ public class EncodedStreamsTest extends SchemaLoader
return cf;
}
- private ColumnFamily createSuperCF()
- {
- ColumnFamily cf = ColumnFamily.create(tableName, superCFName);
- cf.addColumn(superColumn(cf, "Avatar", column("$2,782,275,172", "2009", 1)));
- cf.addColumn(superColumn(cf, "Titanic", column("$1,925,905,151", "1997", 1)));
- return cf;
- }
-
@Test
public void testCFSerialization() throws IOException
{
@@ -145,19 +137,5 @@ public class EncodedStreamsTest extends SchemaLoader
Assert.assertEquals(cf, createCounterCF());
Assert.assertEquals(byteArrayOStream1.size(), (int) ColumnFamily.serializer.serializedSize(cf, TypeSizes.VINT, version));
}
-
- @Test
- public void testSuperCFSerialization() throws IOException
- {
- ByteArrayOutputStream byteArrayOStream1 = new ByteArrayOutputStream();
- EncodedDataOutputStream odos = new EncodedDataOutputStream(byteArrayOStream1);
- ColumnFamily.serializer.serialize(createSuperCF(), odos, version);
-
- ByteArrayInputStream byteArrayIStream1 = new ByteArrayInputStream(byteArrayOStream1.toByteArray());
- EncodedDataInputStream odis = new EncodedDataInputStream(new DataInputStream(byteArrayIStream1));
- ColumnFamily cf = ColumnFamily.serializer.deserialize(odis, version);
- Assert.assertEquals(cf, createSuperCF());
- Assert.assertEquals(byteArrayOStream1.size(), (int) ColumnFamily.serializer.serializedSize(cf, TypeSizes.VINT, version));
- }
}