You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by al...@apache.org on 2013/12/21 22:40:50 UTC
[1/4] Rename RowMutation->Mutation in preparation for Row->Partition
Updated Branches:
refs/heads/trunk d7536612f -> 6bbb13b9b
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/db/compaction/BlacklistingCompactionsTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/compaction/BlacklistingCompactionsTest.java b/test/unit/org/apache/cassandra/db/compaction/BlacklistingCompactionsTest.java
index d73ccfd..de449d8 100644
--- a/test/unit/org/apache/cassandra/db/compaction/BlacklistingCompactionsTest.java
+++ b/test/unit/org/apache/cassandra/db/compaction/BlacklistingCompactionsTest.java
@@ -31,10 +31,7 @@ import org.junit.Test;
import org.apache.cassandra.SchemaLoader;
import org.apache.cassandra.Util;
-import org.apache.cassandra.db.ColumnFamilyStore;
-import org.apache.cassandra.db.DecoratedKey;
-import org.apache.cassandra.db.RowMutation;
-import org.apache.cassandra.db.Keyspace;
+import org.apache.cassandra.db.*;
import org.apache.cassandra.io.sstable.SSTableReader;
import org.apache.cassandra.io.util.FileUtils;
import org.apache.cassandra.utils.ByteBufferUtil;
@@ -92,7 +89,7 @@ public class BlacklistingCompactionsTest extends SchemaLoader
for (int i = 0; i < ROWS_PER_SSTABLE; i++)
{
DecoratedKey key = Util.dk(String.valueOf(i % 2));
- RowMutation rm = new RowMutation(KEYSPACE, key.key);
+ Mutation rm = new Mutation(KEYSPACE, key.key);
long timestamp = j * ROWS_PER_SSTABLE + i;
rm.add("Standard1", cellname(i / 2), ByteBufferUtil.EMPTY_BYTE_BUFFER, timestamp);
maxTimestampExpected = Math.max(timestamp, maxTimestampExpected);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/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 03a8c71..ac58839 100644
--- a/test/unit/org/apache/cassandra/db/compaction/CompactionsPurgeTest.java
+++ b/test/unit/org/apache/cassandra/db/compaction/CompactionsPurgeTest.java
@@ -23,16 +23,12 @@ import java.util.Collection;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
-import org.apache.cassandra.db.Cell;
+import org.apache.cassandra.db.*;
+
import org.junit.Test;
import org.apache.cassandra.SchemaLoader;
import org.apache.cassandra.cql3.UntypedResultSet;
-import org.apache.cassandra.db.Keyspace;
-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.filter.QueryFilter;
import org.apache.cassandra.io.sstable.SSTableReader;
import org.apache.cassandra.Util;
@@ -63,10 +59,10 @@ public class CompactionsPurgeTest extends SchemaLoader
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(cfName);
DecoratedKey key = Util.dk("key1");
- RowMutation rm;
+ Mutation rm;
// inserts
- rm = new RowMutation(KEYSPACE1, key.key);
+ rm = new Mutation(KEYSPACE1, key.key);
for (int i = 0; i < 10; i++)
{
rm.add(cfName, cellname(String.valueOf(i)), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
@@ -77,14 +73,14 @@ public class CompactionsPurgeTest extends SchemaLoader
// deletes
for (int i = 0; i < 10; i++)
{
- rm = new RowMutation(KEYSPACE1, key.key);
+ rm = new Mutation(KEYSPACE1, key.key);
rm.delete(cfName, cellname(String.valueOf(i)), 1);
rm.apply();
}
cfs.forceBlockingFlush();
// resurrect one column
- rm = new RowMutation(KEYSPACE1, key.key);
+ rm = new Mutation(KEYSPACE1, key.key);
rm.add(cfName, cellname(String.valueOf(5)), ByteBufferUtil.EMPTY_BYTE_BUFFER, 2);
rm.apply();
cfs.forceBlockingFlush();
@@ -106,12 +102,12 @@ public class CompactionsPurgeTest extends SchemaLoader
String cfName = "Standard1";
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(cfName);
- RowMutation rm;
+ Mutation rm;
for (int k = 1; k <= 2; ++k) {
DecoratedKey key = Util.dk("key" + k);
// inserts
- rm = new RowMutation(KEYSPACE2, key.key);
+ rm = new Mutation(KEYSPACE2, key.key);
for (int i = 0; i < 10; i++)
{
rm.add(cfName, cellname(String.valueOf(i)), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
@@ -122,7 +118,7 @@ public class CompactionsPurgeTest extends SchemaLoader
// deletes
for (int i = 0; i < 10; i++)
{
- rm = new RowMutation(KEYSPACE2, key.key);
+ rm = new Mutation(KEYSPACE2, key.key);
rm.delete(cfName, cellname(String.valueOf(i)), 1);
rm.apply();
}
@@ -136,7 +132,7 @@ public class CompactionsPurgeTest extends SchemaLoader
// for first key. Then submit minor compaction on remembered sstables.
cfs.forceBlockingFlush();
Collection<SSTableReader> sstablesIncomplete = cfs.getSSTables();
- rm = new RowMutation(KEYSPACE2, key1.key);
+ rm = new Mutation(KEYSPACE2, key1.key);
rm.add(cfName, cellname(String.valueOf(5)), ByteBufferUtil.EMPTY_BYTE_BUFFER, 2);
rm.apply();
cfs.forceBlockingFlush();
@@ -164,24 +160,24 @@ public class CompactionsPurgeTest extends SchemaLoader
Keyspace keyspace = Keyspace.open(KEYSPACE2);
String cfName = "Standard1";
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(cfName);
- RowMutation rm;
+ Mutation rm;
DecoratedKey key3 = Util.dk("key3");
// inserts
- rm = new RowMutation(KEYSPACE2, key3.key);
+ rm = new Mutation(KEYSPACE2, key3.key);
rm.add(cfName, cellname("c1"), ByteBufferUtil.EMPTY_BYTE_BUFFER, 8);
rm.add(cfName, cellname("c2"), ByteBufferUtil.EMPTY_BYTE_BUFFER, 8);
rm.apply();
cfs.forceBlockingFlush();
// delete c1
- rm = new RowMutation(KEYSPACE2, key3.key);
+ rm = new Mutation(KEYSPACE2, key3.key);
rm.delete(cfName, cellname("c1"), 10);
rm.apply();
cfs.forceBlockingFlush();
Collection<SSTableReader> sstablesIncomplete = cfs.getSSTables();
// delete c2 so we have new delete in a diffrent SSTable
- rm = new RowMutation(KEYSPACE2, key3.key);
+ rm = new Mutation(KEYSPACE2, key3.key);
rm.delete(cfName, cellname("c2"), 9);
rm.apply();
cfs.forceBlockingFlush();
@@ -206,10 +202,10 @@ public class CompactionsPurgeTest extends SchemaLoader
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(cfName);
DecoratedKey key = Util.dk("key1");
- RowMutation rm;
+ Mutation rm;
// inserts
- rm = new RowMutation(KEYSPACE1, key.key);
+ rm = new Mutation(KEYSPACE1, key.key);
for (int i = 0; i < 5; i++)
{
rm.add(cfName, cellname(String.valueOf(i)), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
@@ -219,7 +215,7 @@ public class CompactionsPurgeTest extends SchemaLoader
// deletes
for (int i = 0; i < 5; i++)
{
- rm = new RowMutation(KEYSPACE1, key.key);
+ rm = new Mutation(KEYSPACE1, key.key);
rm.delete(cfName, cellname(String.valueOf(i)), 1);
rm.apply();
}
@@ -244,10 +240,10 @@ public class CompactionsPurgeTest extends SchemaLoader
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(cfName);
DecoratedKey key = Util.dk("key3");
- RowMutation rm;
+ Mutation rm;
// inserts
- rm = new RowMutation(keyspaceName, key.key);
+ rm = new Mutation(keyspaceName, key.key);
for (int i = 0; i < 10; i++)
{
rm.add(cfName, cellname(String.valueOf(i)), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
@@ -258,7 +254,7 @@ public class CompactionsPurgeTest extends SchemaLoader
cfs.getColumnFamily(QueryFilter.getIdentityFilter(key, cfName, System.currentTimeMillis()));
// deletes row
- rm = new RowMutation(keyspaceName, key.key);
+ rm = new Mutation(keyspaceName, key.key);
rm.delete(cfName, 1);
rm.apply();
@@ -267,7 +263,7 @@ public class CompactionsPurgeTest extends SchemaLoader
Util.compactAll(cfs, Integer.MAX_VALUE).get();
// re-inserts with timestamp lower than delete
- rm = new RowMutation(keyspaceName, key.key);
+ rm = new Mutation(keyspaceName, key.key);
for (int i = 0; i < 10; i++)
{
rm.add(cfName, cellname(String.valueOf(i)), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
@@ -291,17 +287,17 @@ public class CompactionsPurgeTest extends SchemaLoader
Keyspace keyspace = Keyspace.open(keyspaceName);
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(cfName);
DecoratedKey key = Util.dk("key3");
- RowMutation rm;
+ Mutation rm;
QueryFilter filter = QueryFilter.getIdentityFilter(key, cfName, System.currentTimeMillis());
// inserts
- rm = new RowMutation(keyspaceName, key.key);
+ rm = new Mutation(keyspaceName, key.key);
for (int i = 0; i < 10; i++)
rm.add(cfName, cellname(String.valueOf(i)), ByteBufferUtil.EMPTY_BYTE_BUFFER, i);
rm.apply();
// deletes row with timestamp such that not all columns are deleted
- rm = new RowMutation(keyspaceName, key.key);
+ rm = new Mutation(keyspaceName, key.key);
rm.delete(cfName, 4);
rm.apply();
ColumnFamily cf = cfs.getColumnFamily(filter);
@@ -313,7 +309,7 @@ public class CompactionsPurgeTest extends SchemaLoader
assertFalse(cfs.getColumnFamily(filter).isMarkedForDelete());
// re-inserts with timestamp lower than delete
- rm = new RowMutation(keyspaceName, key.key);
+ rm = new Mutation(keyspaceName, key.key);
for (int i = 0; i < 5; i++)
rm.add(cfName, cellname(String.valueOf(i)), ByteBufferUtil.EMPTY_BYTE_BUFFER, i);
rm.apply();
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/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 b78f182..e7aa442 100644
--- a/test/unit/org/apache/cassandra/db/compaction/CompactionsTest.java
+++ b/test/unit/org/apache/cassandra/db/compaction/CompactionsTest.java
@@ -35,10 +35,8 @@ import org.apache.cassandra.OrderedJUnit4ClassRunner;
import org.apache.cassandra.SchemaLoader;
import org.apache.cassandra.Util;
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.marshal.CompositeType;
import org.apache.cassandra.dht.BytesToken;
import org.apache.cassandra.dht.Range;
import org.apache.cassandra.dht.Token;
@@ -71,7 +69,7 @@ public class CompactionsTest extends SchemaLoader
for (int i = 0; i < 10; i++)
{
DecoratedKey key = Util.dk(Integer.toString(i));
- RowMutation rm = new RowMutation(KEYSPACE1, key.key);
+ Mutation rm = new Mutation(KEYSPACE1, key.key);
for (int j = 0; j < 10; j++)
rm.add("Standard1", Util.cellname(Integer.toString(j)),
ByteBufferUtil.EMPTY_BYTE_BUFFER,
@@ -132,7 +130,7 @@ public class CompactionsTest extends SchemaLoader
ByteBuffer scName = ByteBufferUtil.bytes("TestSuperColumn");
// a subcolumn
- RowMutation rm = new RowMutation(KEYSPACE1, key.key);
+ Mutation rm = new Mutation(KEYSPACE1, key.key);
rm.add("Super1", Util.cellname(scName, ByteBufferUtil.bytes(0)),
ByteBufferUtil.EMPTY_BYTE_BUFFER,
FBUtilities.timestampMicros());
@@ -140,7 +138,7 @@ public class CompactionsTest extends SchemaLoader
cfs.forceBlockingFlush();
// shadow the subcolumn with a supercolumn tombstone
- rm = new RowMutation(KEYSPACE1, key.key);
+ rm = new Mutation(KEYSPACE1, key.key);
rm.deleteRange("Super1", SuperColumns.startOf(scName), SuperColumns.endOf(scName), FBUtilities.timestampMicros());
rm.apply();
cfs.forceBlockingFlush();
@@ -182,7 +180,7 @@ public class CompactionsTest extends SchemaLoader
for (int i=1; i < 5; i++)
{
DecoratedKey key = Util.dk(String.valueOf(i));
- RowMutation rm = new RowMutation(KEYSPACE1, key.key);
+ Mutation rm = new Mutation(KEYSPACE1, key.key);
rm.add("Standard2", Util.cellname(String.valueOf(i)), ByteBufferUtil.EMPTY_BYTE_BUFFER, i);
rm.apply();
@@ -197,7 +195,7 @@ public class CompactionsTest extends SchemaLoader
for (int i=1; i < 5; i++)
{
DecoratedKey key = Util.dk(String.valueOf(i));
- RowMutation rm = new RowMutation(KEYSPACE1, key.key);
+ Mutation rm = new Mutation(KEYSPACE1, key.key);
rm.add("Standard2", Util.cellname(String.valueOf(i)), ByteBufferUtil.EMPTY_BYTE_BUFFER, i);
rm.apply();
}
@@ -242,7 +240,7 @@ public class CompactionsTest extends SchemaLoader
final int ROWS_PER_SSTABLE = 10;
for (int i = 0; i < ROWS_PER_SSTABLE; i++) {
DecoratedKey key = Util.dk(String.valueOf(i));
- RowMutation rm = new RowMutation(KEYSPACE1, key.key);
+ Mutation rm = new Mutation(KEYSPACE1, key.key);
rm.add(cfname, Util.cellname("col"),
ByteBufferUtil.EMPTY_BYTE_BUFFER,
System.currentTimeMillis());
@@ -310,7 +308,7 @@ public class CompactionsTest extends SchemaLoader
// Add test row
DecoratedKey key = Util.dk(k);
- RowMutation rm = new RowMutation(KEYSPACE1, key.key);
+ Mutation rm = new Mutation(KEYSPACE1, key.key);
rm.add(cfname, Util.cellname(ByteBufferUtil.bytes("sc"), ByteBufferUtil.bytes("c")), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
rm.apply();
@@ -322,7 +320,7 @@ public class CompactionsTest extends SchemaLoader
assert !(cfs.getColumnFamily(filter).getColumnCount() == 0);
// Remove key
- rm = new RowMutation(KEYSPACE1, key.key);
+ rm = new Mutation(KEYSPACE1, key.key);
rm.delete(cfname, 2);
rm.apply();
@@ -364,7 +362,7 @@ public class CompactionsTest extends SchemaLoader
{
long timestamp = System.currentTimeMillis();
DecoratedKey decoratedKey = Util.dk(String.format("%03d", key));
- RowMutation rm = new RowMutation(KEYSPACE1, decoratedKey.key);
+ Mutation rm = new Mutation(KEYSPACE1, decoratedKey.key);
rm.add("Standard1", Util.cellname("col"), ByteBufferUtil.EMPTY_BYTE_BUFFER, timestamp, 1000);
rm.apply();
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/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 a107e1b..38c6d56 100644
--- a/test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java
+++ b/test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java
@@ -30,19 +30,13 @@ import org.junit.runner.RunWith;
import org.apache.cassandra.OrderedJUnit4ClassRunner;
import org.apache.cassandra.SchemaLoader;
import org.apache.cassandra.Util;
-import org.apache.cassandra.db.ColumnFamilyStore;
-import org.apache.cassandra.db.DecoratedKey;
-import org.apache.cassandra.db.RowMutation;
-import org.apache.cassandra.db.Keyspace;
+import org.apache.cassandra.db.*;
import org.apache.cassandra.dht.Range;
import org.apache.cassandra.dht.Token;
-import org.apache.cassandra.io.sstable.Component;
import org.apache.cassandra.io.sstable.SSTableReader;
import org.apache.cassandra.repair.RepairJobDesc;
import org.apache.cassandra.repair.Validator;
-import org.apache.cassandra.utils.ByteBufferUtil;
import org.apache.cassandra.utils.FBUtilities;
-import org.apache.cassandra.utils.Pair;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -71,7 +65,7 @@ public class LeveledCompactionStrategyTest extends SchemaLoader
for (int r = 0; r < rows; r++)
{
DecoratedKey key = Util.dk(String.valueOf(r));
- RowMutation rm = new RowMutation(ksname, key.key);
+ Mutation rm = new Mutation(ksname, key.key);
for (int c = 0; c < columns; c++)
{
rm.add(cfname, Util.cellname("column" + c), value, 0);
@@ -119,7 +113,7 @@ public class LeveledCompactionStrategyTest extends SchemaLoader
for (int r = 0; r < rows; r++)
{
DecoratedKey key = Util.dk(String.valueOf(r));
- RowMutation rm = new RowMutation(ksname, key.key);
+ Mutation rm = new Mutation(ksname, key.key);
for (int c = 0; c < columns; c++)
{
rm.add(cfname, Util.cellname("column" + c), value, 0);
@@ -163,7 +157,7 @@ public class LeveledCompactionStrategyTest extends SchemaLoader
for (int r = 0; r < rows; r++)
{
DecoratedKey key = Util.dk(String.valueOf(r));
- RowMutation rm = new RowMutation(ksname, key.key);
+ Mutation rm = new Mutation(ksname, key.key);
for (int c = 0; c < columns; c++)
{
rm.add(cfname, Util.cellname("column" + c), value, 0);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/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 31b3375..2cb45f4 100644
--- a/test/unit/org/apache/cassandra/db/compaction/OneCompactionTest.java
+++ b/test/unit/org/apache/cassandra/db/compaction/OneCompactionTest.java
@@ -28,10 +28,8 @@ import org.apache.cassandra.Util;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
-import org.apache.cassandra.db.Keyspace;
-import org.apache.cassandra.db.DecoratedKey;
-import org.apache.cassandra.db.RowMutation;
-import org.apache.cassandra.db.ColumnFamilyStore;
+
+import org.apache.cassandra.db.*;
import org.apache.cassandra.SchemaLoader;
import org.apache.cassandra.utils.ByteBufferUtil;
@@ -49,7 +47,7 @@ public class OneCompactionTest extends SchemaLoader
Set<DecoratedKey> inserted = new HashSet<DecoratedKey>();
for (int j = 0; j < insertsPerTable; j++) {
DecoratedKey key = Util.dk(String.valueOf(j));
- RowMutation rm = new RowMutation("Keyspace1", key.key);
+ Mutation rm = new Mutation("Keyspace1", key.key);
rm.add(columnFamilyName, Util.cellname("0"), ByteBufferUtil.EMPTY_BYTE_BUFFER, j);
rm.apply();
inserted.add(key);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/db/compaction/SizeTieredCompactionStrategyTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/compaction/SizeTieredCompactionStrategyTest.java b/test/unit/org/apache/cassandra/db/compaction/SizeTieredCompactionStrategyTest.java
index bc4061c..bd4e76d 100644
--- a/test/unit/org/apache/cassandra/db/compaction/SizeTieredCompactionStrategyTest.java
+++ b/test/unit/org/apache/cassandra/db/compaction/SizeTieredCompactionStrategyTest.java
@@ -24,14 +24,10 @@ import org.junit.Test;
import org.apache.cassandra.SchemaLoader;
import org.apache.cassandra.Util;
-import org.apache.cassandra.db.ColumnFamilyStore;
-import org.apache.cassandra.db.DecoratedKey;
-import org.apache.cassandra.db.Keyspace;
-import org.apache.cassandra.db.RowMutation;
+import org.apache.cassandra.db.*;
import org.apache.cassandra.exceptions.ConfigurationException;
import org.apache.cassandra.io.sstable.SSTableReader;
import org.apache.cassandra.metrics.RestorableMeter;
-import org.apache.cassandra.utils.ByteBufferUtil;
import org.apache.cassandra.utils.Pair;
import static org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy.getBuckets;
@@ -164,7 +160,7 @@ public class SizeTieredCompactionStrategyTest extends SchemaLoader
for (int r = 0; r < numSSTables; r++)
{
DecoratedKey key = Util.dk(String.valueOf(r));
- RowMutation rm = new RowMutation(ksname, key.key);
+ Mutation rm = new Mutation(ksname, key.key);
rm.add(cfname, Util.cellname("column"), value, 0);
rm.apply();
cfs.forceBlockingFlush();
@@ -208,7 +204,7 @@ public class SizeTieredCompactionStrategyTest extends SchemaLoader
for (int r = 0; r < numSSTables; r++)
{
DecoratedKey key = Util.dk(String.valueOf(r));
- RowMutation rm = new RowMutation(ksname, key.key);
+ Mutation rm = new Mutation(ksname, key.key);
rm.add(cfname, Util.cellname("column"), value, 0);
rm.apply();
cfs.forceBlockingFlush();
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/db/compaction/TTLExpiryTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/compaction/TTLExpiryTest.java b/test/unit/org/apache/cassandra/db/compaction/TTLExpiryTest.java
index 1d6664e..9aeb6d6 100644
--- a/test/unit/org/apache/cassandra/db/compaction/TTLExpiryTest.java
+++ b/test/unit/org/apache/cassandra/db/compaction/TTLExpiryTest.java
@@ -29,15 +29,8 @@ import org.junit.runner.RunWith;
import org.apache.cassandra.OrderedJUnit4ClassRunner;
import org.apache.cassandra.SchemaLoader;
import org.apache.cassandra.Util;
-import org.apache.cassandra.db.ColumnFamilyStore;
-import org.apache.cassandra.db.DataRange;
-import org.apache.cassandra.db.DecoratedKey;
-import org.apache.cassandra.db.Keyspace;
-import org.apache.cassandra.db.RowMutation;
-import org.apache.cassandra.db.RowPosition;
-import org.apache.cassandra.db.columniterator.IdentityQueryFilter;
+import org.apache.cassandra.db.*;
import org.apache.cassandra.db.columniterator.OnDiskAtomIterator;
-import org.apache.cassandra.db.filter.QueryFilter;
import org.apache.cassandra.io.sstable.SSTableReader;
import org.apache.cassandra.io.sstable.SSTableScanner;
import org.apache.cassandra.utils.ByteBufferUtil;
@@ -54,7 +47,7 @@ public class TTLExpiryTest extends SchemaLoader
cfs.disableAutoCompaction();
cfs.metadata.gcGraceSeconds(0);
long timestamp = System.currentTimeMillis();
- RowMutation rm = new RowMutation("Keyspace1", Util.dk("ttl").key);
+ Mutation rm = new Mutation("Keyspace1", Util.dk("ttl").key);
rm.add("Standard1", Util.cellname("col"),
ByteBufferUtil.EMPTY_BYTE_BUFFER,
timestamp,
@@ -67,21 +60,21 @@ public class TTLExpiryTest extends SchemaLoader
rm.apply();
cfs.forceBlockingFlush();
- rm = new RowMutation("Keyspace1", Util.dk("ttl").key);
+ rm = new Mutation("Keyspace1", Util.dk("ttl").key);
rm.add("Standard1", Util.cellname("col2"),
ByteBufferUtil.EMPTY_BYTE_BUFFER,
timestamp,
1);
rm.apply();
cfs.forceBlockingFlush();
- rm = new RowMutation("Keyspace1", Util.dk("ttl").key);
+ rm = new Mutation("Keyspace1", Util.dk("ttl").key);
rm.add("Standard1", Util.cellname("col3"),
ByteBufferUtil.EMPTY_BYTE_BUFFER,
timestamp,
1);
rm.apply();
cfs.forceBlockingFlush();
- rm = new RowMutation("Keyspace1", Util.dk("ttl").key);
+ rm = new Mutation("Keyspace1", Util.dk("ttl").key);
rm.add("Standard1", Util.cellname("col311"),
ByteBufferUtil.EMPTY_BYTE_BUFFER,
timestamp,
@@ -102,7 +95,7 @@ public class TTLExpiryTest extends SchemaLoader
cfs.disableAutoCompaction();
cfs.metadata.gcGraceSeconds(0);
long timestamp = System.currentTimeMillis();
- RowMutation rm = new RowMutation("Keyspace1", Util.dk("ttl").key);
+ Mutation rm = new Mutation("Keyspace1", Util.dk("ttl").key);
rm.add("Standard1", Util.cellname("col"),
ByteBufferUtil.EMPTY_BYTE_BUFFER,
timestamp,
@@ -115,14 +108,14 @@ public class TTLExpiryTest extends SchemaLoader
rm.apply();
cfs.forceBlockingFlush();
- rm = new RowMutation("Keyspace1", Util.dk("ttl").key);
+ rm = new Mutation("Keyspace1", Util.dk("ttl").key);
rm.add("Standard1", Util.cellname("col2"),
ByteBufferUtil.EMPTY_BYTE_BUFFER,
timestamp,
1);
rm.apply();
cfs.forceBlockingFlush();
- rm = new RowMutation("Keyspace1", Util.dk("ttl").key);
+ rm = new Mutation("Keyspace1", Util.dk("ttl").key);
rm.add("Standard1", Util.cellname("col3"),
ByteBufferUtil.EMPTY_BYTE_BUFFER,
timestamp,
@@ -130,7 +123,7 @@ public class TTLExpiryTest extends SchemaLoader
rm.apply();
cfs.forceBlockingFlush();
DecoratedKey noTTLKey = Util.dk("nottl");
- rm = new RowMutation("Keyspace1", noTTLKey.key);
+ rm = new Mutation("Keyspace1", noTTLKey.key);
rm.add("Standard1", Util.cellname("col311"),
ByteBufferUtil.EMPTY_BYTE_BUFFER,
timestamp);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/db/index/PerRowSecondaryIndexTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/index/PerRowSecondaryIndexTest.java b/test/unit/org/apache/cassandra/db/index/PerRowSecondaryIndexTest.java
index a4fb875..03f5860 100644
--- a/test/unit/org/apache/cassandra/db/index/PerRowSecondaryIndexTest.java
+++ b/test/unit/org/apache/cassandra/db/index/PerRowSecondaryIndexTest.java
@@ -58,8 +58,8 @@ public class PerRowSecondaryIndexTest extends SchemaLoader
public void testIndexInsertAndUpdate() throws IOException
{
// create a row then test that the configured index instance was able to read the row
- RowMutation rm;
- rm = new RowMutation("PerRowSecondaryIndex", ByteBufferUtil.bytes("k1"));
+ Mutation rm;
+ rm = new Mutation("PerRowSecondaryIndex", ByteBufferUtil.bytes("k1"));
rm.add("Indexed1", Util.cellname("indexed"), ByteBufferUtil.bytes("foo"), 1);
rm.apply();
@@ -68,7 +68,7 @@ public class PerRowSecondaryIndexTest extends SchemaLoader
assertEquals(ByteBufferUtil.bytes("foo"), indexedRow.getColumn(Util.cellname("indexed")).value());
// update the row and verify what was indexed
- rm = new RowMutation("PerRowSecondaryIndex", ByteBufferUtil.bytes("k1"));
+ rm = new Mutation("PerRowSecondaryIndex", ByteBufferUtil.bytes("k1"));
rm.add("Indexed1", Util.cellname("indexed"), ByteBufferUtil.bytes("bar"), 2);
rm.apply();
@@ -82,8 +82,8 @@ public class PerRowSecondaryIndexTest extends SchemaLoader
public void testColumnDelete() throws IOException
{
// issue a column delete and test that the configured index instance was notified to update
- RowMutation rm;
- rm = new RowMutation("PerRowSecondaryIndex", ByteBufferUtil.bytes("k2"));
+ Mutation rm;
+ rm = new Mutation("PerRowSecondaryIndex", ByteBufferUtil.bytes("k2"));
rm.delete("Indexed1", Util.cellname("indexed"), 1);
rm.apply();
@@ -101,8 +101,8 @@ public class PerRowSecondaryIndexTest extends SchemaLoader
public void testRowDelete() throws IOException
{
// issue a row level delete and test that the configured index instance was notified to update
- RowMutation rm;
- rm = new RowMutation("PerRowSecondaryIndex", ByteBufferUtil.bytes("k3"));
+ Mutation rm;
+ rm = new Mutation("PerRowSecondaryIndex", ByteBufferUtil.bytes("k3"));
rm.delete("Indexed1", 1);
rm.apply();
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/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 ac85ccf..f606780 100644
--- a/test/unit/org/apache/cassandra/db/marshal/CompositeTypeTest.java
+++ b/test/unit/org/apache/cassandra/db/marshal/CompositeTypeTest.java
@@ -174,7 +174,7 @@ public class CompositeTypeTest extends SchemaLoader
ByteBuffer cname5 = createCompositeKey("test2", uuids[1], 42, false);
ByteBuffer key = ByteBufferUtil.bytes("k");
- RowMutation rm = new RowMutation("Keyspace1", key);
+ Mutation rm = new Mutation("Keyspace1", key);
addColumn(rm, cname5);
addColumn(rm, cname1);
addColumn(rm, cname4);
@@ -256,7 +256,7 @@ public class CompositeTypeTest extends SchemaLoader
}
}
- private void addColumn(RowMutation rm, ByteBuffer cname)
+ private void addColumn(Mutation rm, ByteBuffer cname)
{
rm.add(cfName, CellNames.simpleDense(cname), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/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 15b7650..26d2e62 100644
--- a/test/unit/org/apache/cassandra/db/marshal/DynamicCompositeTypeTest.java
+++ b/test/unit/org/apache/cassandra/db/marshal/DynamicCompositeTypeTest.java
@@ -173,7 +173,7 @@ public class DynamicCompositeTypeTest extends SchemaLoader
ByteBuffer cname5 = createDynamicCompositeKey("test2", uuids[1], 42, false);
ByteBuffer key = ByteBufferUtil.bytes("k");
- RowMutation rm = new RowMutation("Keyspace1", key);
+ Mutation rm = new Mutation("Keyspace1", key);
addColumn(rm, cname5);
addColumn(rm, cname1);
addColumn(rm, cname4);
@@ -230,7 +230,7 @@ public class DynamicCompositeTypeTest extends SchemaLoader
assert !TypeParser.parse("DynamicCompositeType(a => BytesType)").isCompatibleWith(TypeParser.parse("DynamicCompositeType(a => BytesType, b => AsciiType)"));
}
- private void addColumn(RowMutation rm, ByteBuffer cname)
+ private void addColumn(Mutation rm, ByteBuffer cname)
{
rm.add(cfName, CellNames.simpleDense(cname), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/io/sstable/IndexSummaryManagerTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/io/sstable/IndexSummaryManagerTest.java b/test/unit/org/apache/cassandra/io/sstable/IndexSummaryManagerTest.java
index 1c86216..994a846 100644
--- a/test/unit/org/apache/cassandra/io/sstable/IndexSummaryManagerTest.java
+++ b/test/unit/org/apache/cassandra/io/sstable/IndexSummaryManagerTest.java
@@ -110,7 +110,7 @@ public class IndexSummaryManagerTest extends SchemaLoader
for (int row = 0; row < numRows; row++)
{
DecoratedKey key = Util.dk(String.valueOf(row));
- RowMutation rm = new RowMutation(ksname, key.key);
+ Mutation rm = new Mutation(ksname, key.key);
rm.add(cfname, Util.cellname("column"), value, 0);
rm.apply();
}
@@ -244,7 +244,7 @@ public class IndexSummaryManagerTest extends SchemaLoader
for (int row = 0; row < numRows; row++)
{
DecoratedKey key = Util.dk(String.valueOf(row));
- RowMutation rm = new RowMutation(ksname, key.key);
+ Mutation rm = new Mutation(ksname, key.key);
rm.add(cfname, Util.cellname("column"), value, 0);
rm.apply();
}
@@ -304,7 +304,7 @@ public class IndexSummaryManagerTest extends SchemaLoader
for (int row = 0; row < numRows; row++)
{
DecoratedKey key = Util.dk(String.valueOf(row));
- RowMutation rm = new RowMutation(ksname, key.key);
+ Mutation rm = new Mutation(ksname, key.key);
rm.add(cfname, Util.cellname("column"), value, 0);
rm.apply();
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/io/sstable/SSTableMetadataTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/io/sstable/SSTableMetadataTest.java b/test/unit/org/apache/cassandra/io/sstable/SSTableMetadataTest.java
index cf44573..5c801c6 100644
--- a/test/unit/org/apache/cassandra/io/sstable/SSTableMetadataTest.java
+++ b/test/unit/org/apache/cassandra/io/sstable/SSTableMetadataTest.java
@@ -32,9 +32,6 @@ import org.apache.cassandra.SchemaLoader;
import org.apache.cassandra.Util;
import org.apache.cassandra.db.*;
import org.apache.cassandra.db.composites.*;
-import org.apache.cassandra.db.marshal.BytesType;
-import org.apache.cassandra.db.marshal.CompositeType;
-import org.apache.cassandra.db.marshal.IntegerType;
import org.apache.cassandra.utils.ByteBufferUtil;
import static org.junit.Assert.assertEquals;
@@ -51,7 +48,7 @@ public class SSTableMetadataTest extends SchemaLoader
for(int i = 0; i < 10; i++)
{
DecoratedKey key = Util.dk(Integer.toString(i));
- RowMutation rm = new RowMutation("Keyspace1", key.key);
+ Mutation rm = new Mutation("Keyspace1", key.key);
for (int j = 0; j < 10; j++)
rm.add("Standard1", Util.cellname(Integer.toString(j)),
ByteBufferUtil.EMPTY_BYTE_BUFFER,
@@ -59,7 +56,7 @@ public class SSTableMetadataTest extends SchemaLoader
10 + j);
rm.apply();
}
- RowMutation rm = new RowMutation("Keyspace1", Util.dk("longttl").key);
+ Mutation rm = new Mutation("Keyspace1", Util.dk("longttl").key);
rm.add("Standard1", Util.cellname("col"),
ByteBufferUtil.EMPTY_BYTE_BUFFER,
timestamp,
@@ -75,7 +72,7 @@ public class SSTableMetadataTest extends SchemaLoader
assertEquals(ttltimestamp + 10000, firstDelTime, 10);
}
- rm = new RowMutation("Keyspace1", Util.dk("longttl2").key);
+ rm = new Mutation("Keyspace1", Util.dk("longttl2").key);
rm.add("Standard1", Util.cellname("col"),
ByteBufferUtil.EMPTY_BYTE_BUFFER,
timestamp,
@@ -122,7 +119,7 @@ public class SSTableMetadataTest extends SchemaLoader
ColumnFamilyStore store = keyspace.getColumnFamilyStore("Standard2");
long timestamp = System.currentTimeMillis();
DecoratedKey key = Util.dk("deletetest");
- RowMutation rm = new RowMutation("Keyspace1", key.key);
+ Mutation rm = new Mutation("Keyspace1", key.key);
for (int i = 0; i<5; i++)
rm.add("Standard2", Util.cellname("deletecolumn"+i),
ByteBufferUtil.EMPTY_BYTE_BUFFER,
@@ -142,7 +139,7 @@ public class SSTableMetadataTest extends SchemaLoader
firstMaxDelTime = sstable.getSSTableMetadata().maxLocalDeletionTime;
assertEquals(ttltimestamp + 1000, firstMaxDelTime, 10);
}
- rm = new RowMutation("Keyspace1", key.key);
+ rm = new Mutation("Keyspace1", key.key);
rm.delete("Standard2", Util.cellname("todelete"), timestamp + 1);
rm.apply();
store.forceBlockingFlush();
@@ -174,7 +171,7 @@ public class SSTableMetadataTest extends SchemaLoader
for (int j = 0; j < 8; j++)
{
DecoratedKey key = Util.dk("row"+j);
- RowMutation rm = new RowMutation("Keyspace1", key.key);
+ Mutation rm = new Mutation("Keyspace1", key.key);
for (int i = 100; i<150; i++)
{
rm.add("Standard3", Util.cellname(j+"col"+i), ByteBufferUtil.EMPTY_BYTE_BUFFER, System.currentTimeMillis());
@@ -189,7 +186,7 @@ public class SSTableMetadataTest extends SchemaLoader
assertEquals(ByteBufferUtil.string(sstable.getSSTableMetadata().maxColumnNames.get(0)), "7col149");
}
DecoratedKey key = Util.dk("row2");
- RowMutation rm = new RowMutation("Keyspace1", key.key);
+ Mutation rm = new Mutation("Keyspace1", key.key);
for (int i = 101; i<299; i++)
{
rm.add("Standard3", Util.cellname(9+"col"+i), ByteBufferUtil.EMPTY_BYTE_BUFFER, System.currentTimeMillis());
@@ -228,7 +225,7 @@ public class SSTableMetadataTest extends SchemaLoader
ByteBuffer key = ByteBufferUtil.bytes("k");
for (int i = 0; i < 10; i++)
{
- RowMutation rm = new RowMutation("Keyspace1", key);
+ Mutation rm = new Mutation("Keyspace1", key);
CellName colName = type.makeCellName(ByteBufferUtil.bytes("a"+(9-i)), ByteBufferUtil.bytes(i));
rm.add("StandardComposite2", colName, ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
rm.apply();
@@ -238,7 +235,7 @@ public class SSTableMetadataTest extends SchemaLoader
key = ByteBufferUtil.bytes("k2");
for (int i = 0; i < 10; i++)
{
- RowMutation rm = new RowMutation("Keyspace1", key);
+ Mutation rm = new Mutation("Keyspace1", key);
CellName colName = type.makeCellName(ByteBufferUtil.bytes("b"+(9-i)), ByteBufferUtil.bytes(i));
rm.add("StandardComposite2", colName, ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
rm.apply();
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/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 cf17e5f..4b05e17 100644
--- a/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java
+++ b/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java
@@ -86,7 +86,7 @@ public class SSTableReaderTest extends SchemaLoader
for (int j = 0; j < 10; j++)
{
ByteBuffer key = ByteBufferUtil.bytes(String.valueOf(j));
- RowMutation rm = new RowMutation("Keyspace1", key);
+ Mutation rm = new Mutation("Keyspace1", key);
rm.add("Standard2", cellname("0"), ByteBufferUtil.EMPTY_BYTE_BUFFER, j);
rm.apply();
}
@@ -127,7 +127,7 @@ public class SSTableReaderTest extends SchemaLoader
for (int j = 0; j < 100; j += 2)
{
ByteBuffer key = ByteBufferUtil.bytes(String.valueOf(j));
- RowMutation rm = new RowMutation("Keyspace1", key);
+ Mutation rm = new Mutation("Keyspace1", key);
rm.add("Standard1", cellname("0"), ByteBufferUtil.EMPTY_BYTE_BUFFER, j);
rm.apply();
}
@@ -162,7 +162,7 @@ public class SSTableReaderTest extends SchemaLoader
for (int j = 0; j < 100; j += 2)
{
ByteBuffer key = ByteBufferUtil.bytes(String.valueOf(j));
- RowMutation rm = new RowMutation("Keyspace1", key);
+ Mutation rm = new Mutation("Keyspace1", key);
rm.add("Standard1", cellname("0"), ByteBufferUtil.EMPTY_BYTE_BUFFER, j);
rm.apply();
}
@@ -190,7 +190,7 @@ public class SSTableReaderTest extends SchemaLoader
for (int j = 0; j < 10; j++)
{
ByteBuffer key = ByteBufferUtil.bytes(String.valueOf(j));
- RowMutation rm = new RowMutation("Keyspace1", key);
+ Mutation rm = new Mutation("Keyspace1", key);
rm.add("Standard2", cellname("0"), ByteBufferUtil.EMPTY_BYTE_BUFFER, j);
rm.apply();
}
@@ -219,7 +219,7 @@ public class SSTableReaderTest extends SchemaLoader
Keyspace keyspace = Keyspace.open("Keyspace1");
ColumnFamilyStore store = keyspace.getColumnFamilyStore("Indexed1");
ByteBuffer key = ByteBufferUtil.bytes(String.valueOf("k1"));
- RowMutation rm = new RowMutation("Keyspace1", key);
+ Mutation rm = new Mutation("Keyspace1", key);
rm.add("Indexed1", cellname("birthdate"), ByteBufferUtil.bytes(1L), System.currentTimeMillis());
rm.apply();
store.forceBlockingFlush();
@@ -251,7 +251,7 @@ public class SSTableReaderTest extends SchemaLoader
lastKey = key;
if (store.metadata.getKeyValidator().compare(lastKey.key, key.key) < 0)
lastKey = key;
- RowMutation rm = new RowMutation(ks, key.key);
+ Mutation rm = new Mutation(ks, key.key);
rm.add(cf, cellname("col"),
ByteBufferUtil.EMPTY_BYTE_BUFFER, timestamp);
rm.apply();
@@ -275,7 +275,7 @@ public class SSTableReaderTest extends SchemaLoader
Keyspace keyspace = Keyspace.open("Keyspace1");
ColumnFamilyStore store = keyspace.getColumnFamilyStore("Indexed1");
ByteBuffer key = ByteBufferUtil.bytes(String.valueOf("k1"));
- RowMutation rm = new RowMutation("Keyspace1", key);
+ Mutation rm = new Mutation("Keyspace1", key);
rm.add("Indexed1", cellname("birthdate"), ByteBufferUtil.bytes(1L), System.currentTimeMillis());
rm.apply();
store.forceBlockingFlush();
@@ -302,7 +302,7 @@ public class SSTableReaderTest extends SchemaLoader
Keyspace keyspace = Keyspace.open("Keyspace1");
ColumnFamilyStore store = keyspace.getColumnFamilyStore("Standard1");
ByteBuffer key = ByteBufferUtil.bytes(String.valueOf("k1"));
- RowMutation rm = new RowMutation("Keyspace1", key);
+ Mutation rm = new Mutation("Keyspace1", key);
rm.add("Standard1", cellname("xyz"), ByteBufferUtil.bytes("abc"), 0);
rm.apply();
store.forceBlockingFlush();
@@ -329,7 +329,7 @@ public class SSTableReaderTest extends SchemaLoader
for (int j = 0; j < 130; j++)
{
ByteBuffer key = ByteBufferUtil.bytes(String.valueOf(j));
- RowMutation rm = new RowMutation("Keyspace1", key);
+ Mutation rm = new Mutation("Keyspace1", key);
rm.add("Standard2", cellname("0"), ByteBufferUtil.EMPTY_BYTE_BUFFER, j);
rm.apply();
}
@@ -363,7 +363,7 @@ public class SSTableReaderTest extends SchemaLoader
for (int j = 0; j < NUM_ROWS; j++)
{
ByteBuffer key = ByteBufferUtil.bytes(String.format("%3d", j));
- RowMutation rm = new RowMutation("Keyspace1", key);
+ Mutation rm = new Mutation("Keyspace1", key);
rm.add("StandardLowIndexInterval", Util.cellname("0"), ByteBufferUtil.bytes(String.format("%3d", j)), j);
rm.apply();
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/io/sstable/SSTableScannerTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/io/sstable/SSTableScannerTest.java b/test/unit/org/apache/cassandra/io/sstable/SSTableScannerTest.java
index 8f7f07b..b514c05 100644
--- a/test/unit/org/apache/cassandra/io/sstable/SSTableScannerTest.java
+++ b/test/unit/org/apache/cassandra/io/sstable/SSTableScannerTest.java
@@ -71,7 +71,7 @@ public class SSTableScannerTest extends SchemaLoader
{
long timestamp = System.currentTimeMillis();
DecoratedKey decoratedKey = Util.dk(toKey(key));
- RowMutation rm = new RowMutation(KEYSPACE, decoratedKey.key);
+ Mutation rm = new Mutation(KEYSPACE, decoratedKey.key);
rm.add(TABLE, Util.cellname("col"), ByteBufferUtil.EMPTY_BYTE_BUFFER, timestamp, 1000);
rm.apply();
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/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 b33f208..4a82183 100644
--- a/test/unit/org/apache/cassandra/service/AntiEntropyServiceCounterTest.java
+++ b/test/unit/org/apache/cassandra/service/AntiEntropyServiceCounterTest.java
@@ -39,7 +39,7 @@ public class AntiEntropyServiceCounterTest extends AntiEntropyServiceTestAbstrac
public List<IMutation> getWriteData()
{
List<IMutation> rms = new LinkedList<IMutation>();
- RowMutation rm = new RowMutation(keyspaceName, ByteBufferUtil.bytes("key1"));
+ Mutation rm = new Mutation(keyspaceName, ByteBufferUtil.bytes("key1"));
rm.addCounter(cfname, CellNames.simpleDense(ByteBufferUtil.bytes("Column1")), 42);
rms.add(new CounterMutation(rm, ConsistencyLevel.ONE));
return rms;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/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 9cfe8f0..f4025cc 100644
--- a/test/unit/org/apache/cassandra/service/AntiEntropyServiceStandardTest.java
+++ b/test/unit/org/apache/cassandra/service/AntiEntropyServiceStandardTest.java
@@ -38,8 +38,8 @@ public class AntiEntropyServiceStandardTest extends AntiEntropyServiceTestAbstra
public List<IMutation> getWriteData()
{
List<IMutation> rms = new LinkedList<IMutation>();
- RowMutation rm;
- rm = new RowMutation(keyspaceName, ByteBufferUtil.bytes("key1"));
+ Mutation rm;
+ rm = new Mutation(keyspaceName, ByteBufferUtil.bytes("key1"));
rm.add(cfname, Util.cellname("Column1"), ByteBufferUtil.bytes("asdfasdf"), 0);
rms.add(rm);
return rms;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/service/QueryPagerTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/service/QueryPagerTest.java b/test/unit/org/apache/cassandra/service/QueryPagerTest.java
index 9e28fe6..318feb9 100644
--- a/test/unit/org/apache/cassandra/service/QueryPagerTest.java
+++ b/test/unit/org/apache/cassandra/service/QueryPagerTest.java
@@ -79,7 +79,7 @@ public class QueryPagerTest extends SchemaLoader
*/
for (int i = 0; i < nbKeys; i++)
{
- RowMutation rm = new RowMutation(KS, bytes("k" + i));
+ Mutation rm = new Mutation(KS, bytes("k" + i));
ColumnFamily cf = rm.addOrGet(CF);
for (int j = 0; j < nbCols; j++)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/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 412d9d0..8cf13bc 100644
--- a/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java
+++ b/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java
@@ -230,7 +230,7 @@ public class StreamingTransferTest extends SchemaLoader
ColumnFamily cf = TreeMapBackedSortedColumns.factory.create(keyspace.getName(), cfs.name);
cf.addColumn(column(col, "v", timestamp));
cf.addColumn(new Cell(cellname("birthdate"), ByteBufferUtil.bytes(val), timestamp));
- RowMutation rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes(key), cf);
+ Mutation rm = new Mutation("Keyspace1", ByteBufferUtil.bytes(key), cf);
logger.debug("Applying row to transfer " + rm);
rm.apply();
}
@@ -264,7 +264,7 @@ public class StreamingTransferTest extends SchemaLoader
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(cfname);
String key = "key1";
- RowMutation rm = new RowMutation(ks, ByteBufferUtil.bytes(key));
+ Mutation rm = new Mutation(ks, ByteBufferUtil.bytes(key));
// add columns of size slightly less than column_index_size to force insert column index
rm.add(cfname, cellname(1), ByteBuffer.wrap(new byte[DatabaseDescriptor.getColumnIndexSize() - 64]), 2);
rm.add(cfname, cellname(6), ByteBuffer.wrap(new byte[DatabaseDescriptor.getColumnIndexSize()]), 2);
@@ -454,7 +454,7 @@ public class StreamingTransferTest extends SchemaLoader
ColumnFamily cf = TreeMapBackedSortedColumns.factory.create(keyspace.getName(), cfs.name);
cf.addColumn(column(colName, "value", timestamp));
cf.addColumn(new Cell(cellname("birthdate"), ByteBufferUtil.bytes(new Date(timestamp).toString()), timestamp));
- RowMutation rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes(key), cf);
+ Mutation rm = new Mutation("Keyspace1", ByteBufferUtil.bytes(key), cf);
logger.debug("Applying row to transfer " + rm);
rm.apply();
}
[4/4] git commit: Rename RowMutation->Mutation in preparation for
Row->Partition
Posted by al...@apache.org.
Rename RowMutation->Mutation in preparation for Row->Partition
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/6bbb13b9
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/6bbb13b9
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/6bbb13b9
Branch: refs/heads/trunk
Commit: 6bbb13b9b0fe62de2a2140055af2ea6968c73ccc
Parents: d753661
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Sun Dec 22 00:37:43 2013 +0300
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Sun Dec 22 00:37:43 2013 +0300
----------------------------------------------------------------------
.../cassandra/triggers/InvertedIndex.java | 10 +-
.../org/apache/cassandra/config/CFMetaData.java | 52 +--
.../cassandra/config/ColumnDefinition.java | 14 +-
.../org/apache/cassandra/config/KSMetaData.java | 27 +-
.../cassandra/config/TriggerDefinition.java | 16 +-
.../org/apache/cassandra/config/UTMetaData.java | 16 +-
.../apache/cassandra/cql/DeleteStatement.java | 22 +-
.../apache/cassandra/cql/UpdateStatement.java | 35 +-
.../cql3/statements/ModificationStatement.java | 10 +-
.../apache/cassandra/db/BatchlogManager.java | 22 +-
.../cassandra/db/CollationController.java | 4 +-
.../org/apache/cassandra/db/CounterCell.java | 6 +-
.../apache/cassandra/db/CounterMutation.java | 79 ++---
.../db/DefinitionsUpdateVerbHandler.java | 6 +-
.../org/apache/cassandra/db/DefsTables.java | 8 +-
.../cassandra/db/HintedHandOffManager.java | 36 +-
src/java/org/apache/cassandra/db/Keyspace.java | 4 +-
.../db/MigrationRequestVerbHandler.java | 8 +-
src/java/org/apache/cassandra/db/Mutation.java | 336 +++++++++++++++++++
.../cassandra/db/MutationVerbHandler.java | 85 +++++
.../cassandra/db/ReadRepairVerbHandler.java | 7 +-
.../org/apache/cassandra/db/RowMutation.java | 335 ------------------
.../cassandra/db/RowMutationVerbHandler.java | 87 -----
.../org/apache/cassandra/db/SystemKeyspace.java | 33 +-
.../cassandra/db/commitlog/CommitLog.java | 13 +-
.../db/commitlog/CommitLogReplayer.java | 52 +--
.../db/commitlog/CommitLogSegment.java | 14 +-
.../db/commitlog/CommitLogSegmentManager.java | 9 +-
.../apache/cassandra/net/MessagingService.java | 8 +-
.../cassandra/service/MigrationManager.java | 32 +-
.../apache/cassandra/service/MigrationTask.java | 6 +-
.../cassandra/service/RowDataResolver.java | 9 +-
.../apache/cassandra/service/StorageProxy.java | 58 ++--
.../cassandra/service/StorageService.java | 2 +-
.../apache/cassandra/service/paxos/Commit.java | 11 +-
.../cassandra/service/paxos/PaxosState.java | 6 +-
.../org/apache/cassandra/sink/IRequestSink.java | 4 +-
.../cassandra/thrift/CassandraServer.java | 114 +++----
.../apache/cassandra/tracing/TraceState.java | 4 +-
.../org/apache/cassandra/tracing/Tracing.java | 6 +-
.../org/apache/cassandra/triggers/ITrigger.java | 8 +-
.../cassandra/triggers/TriggerExecutor.java | 21 +-
.../org/apache/cassandra/cli/CliHelp.yaml | 4 +-
.../apache/cassandra/db/LongKeyspaceTest.java | 4 +-
.../apache/cassandra/db/MeteredFlusherTest.java | 2 +-
.../cassandra/db/commitlog/ComitLogStress.java | 4 +-
.../db/compaction/LongCompactionsTest.java | 2 +-
.../LongLeveledCompactionStrategyTest.java | 8 +-
.../unit/org/apache/cassandra/SchemaLoader.java | 7 +-
test/unit/org/apache/cassandra/Util.java | 4 +-
.../apache/cassandra/config/CFMetaDataTest.java | 3 +-
.../org/apache/cassandra/config/DefsTest.java | 18 +-
.../org/apache/cassandra/db/CleanupTest.java | 4 +-
.../cassandra/db/CollationControllerTest.java | 19 +-
.../cassandra/db/ColumnFamilyStoreTest.java | 108 +++---
.../org/apache/cassandra/db/CommitLogTest.java | 10 +-
.../cassandra/db/CounterMutationTest.java | 8 +-
.../apache/cassandra/db/HintedHandOffTest.java | 2 +-
.../org/apache/cassandra/db/KeyCacheTest.java | 7 +-
.../apache/cassandra/db/KeyCollisionTest.java | 4 +-
.../org/apache/cassandra/db/KeyspaceTest.java | 30 +-
.../org/apache/cassandra/db/MultitableTest.java | 6 +-
.../org/apache/cassandra/db/NameSortTest.java | 6 +-
.../apache/cassandra/db/RangeTombstoneTest.java | 40 +--
.../apache/cassandra/db/ReadMessageTest.java | 8 +-
.../cassandra/db/RecoveryManager2Test.java | 2 +-
.../cassandra/db/RecoveryManager3Test.java | 6 +-
.../cassandra/db/RecoveryManagerTest.java | 12 +-
.../db/RecoveryManagerTruncateTest.java | 4 +-
.../org/apache/cassandra/db/RemoveCellTest.java | 6 +-
.../cassandra/db/RemoveColumnFamilyTest.java | 6 +-
.../db/RemoveColumnFamilyWithFlush1Test.java | 6 +-
.../db/RemoveColumnFamilyWithFlush2Test.java | 6 +-
.../apache/cassandra/db/RemoveSubCellTest.java | 16 +-
.../apache/cassandra/db/RowIterationTest.java | 9 +-
.../unit/org/apache/cassandra/db/ScrubTest.java | 4 +-
.../apache/cassandra/db/SerializationsTest.java | 48 +--
.../org/apache/cassandra/db/TimeSortTest.java | 12 +-
.../compaction/BlacklistingCompactionsTest.java | 7 +-
.../db/compaction/CompactionsPurgeTest.java | 54 ++-
.../db/compaction/CompactionsTest.java | 20 +-
.../LeveledCompactionStrategyTest.java | 14 +-
.../db/compaction/OneCompactionTest.java | 8 +-
.../SizeTieredCompactionStrategyTest.java | 10 +-
.../cassandra/db/compaction/TTLExpiryTest.java | 25 +-
.../db/index/PerRowSecondaryIndexTest.java | 14 +-
.../cassandra/db/marshal/CompositeTypeTest.java | 4 +-
.../db/marshal/DynamicCompositeTypeTest.java | 4 +-
.../io/sstable/IndexSummaryManagerTest.java | 6 +-
.../io/sstable/SSTableMetadataTest.java | 21 +-
.../cassandra/io/sstable/SSTableReaderTest.java | 20 +-
.../io/sstable/SSTableScannerTest.java | 2 +-
.../service/AntiEntropyServiceCounterTest.java | 2 +-
.../service/AntiEntropyServiceStandardTest.java | 4 +-
.../cassandra/service/QueryPagerTest.java | 2 +-
.../streaming/StreamingTransferTest.java | 6 +-
96 files changed, 1114 insertions(+), 1189 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/examples/triggers/src/org/apache/cassandra/triggers/InvertedIndex.java
----------------------------------------------------------------------
diff --git a/examples/triggers/src/org/apache/cassandra/triggers/InvertedIndex.java b/examples/triggers/src/org/apache/cassandra/triggers/InvertedIndex.java
index 2e1d4cc..8ebc46e 100644
--- a/examples/triggers/src/org/apache/cassandra/triggers/InvertedIndex.java
+++ b/examples/triggers/src/org/apache/cassandra/triggers/InvertedIndex.java
@@ -24,12 +24,12 @@ import java.util.Collection;
import java.util.List;
import java.util.Properties;
-import org.apache.cassandra.db.Cell;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.apache.cassandra.db.Cell;
import org.apache.cassandra.db.ColumnFamily;
-import org.apache.cassandra.db.RowMutation;
+import org.apache.cassandra.db.Mutation;
import org.apache.cassandra.io.util.FileUtils;
public class InvertedIndex implements ITrigger
@@ -37,12 +37,12 @@ public class InvertedIndex implements ITrigger
private static final Logger logger = LoggerFactory.getLogger(InvertedIndex.class);
private Properties properties = loadProperties();
- public Collection<RowMutation> augment(ByteBuffer key, ColumnFamily update)
+ public Collection<Mutation> augment(ByteBuffer key, ColumnFamily update)
{
- List<RowMutation> mutations = new ArrayList<>();
+ List<Mutation> mutations = new ArrayList<>();
for (Cell cell : update)
{
- RowMutation mutation = new RowMutation(properties.getProperty("keyspace"), cell.value());
+ Mutation mutation = new Mutation(properties.getProperty("keyspace"), cell.value());
mutation.add(properties.getProperty("columnfamily"), cell.name(), key, System.currentTimeMillis());
mutations.add(mutation);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/config/CFMetaData.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/CFMetaData.java b/src/java/org/apache/cassandra/config/CFMetaData.java
index 097f150..ddc839c 100644
--- a/src/java/org/apache/cassandra/config/CFMetaData.java
+++ b/src/java/org/apache/cassandra/config/CFMetaData.java
@@ -1022,7 +1022,7 @@ public final class CFMetaData
/**
* Create CFMetaData from thrift {@link CqlRow} that contains columns from schema_columnfamilies.
*
- * @param row CqlRow containing columns from schema_columnfamilies.
+ * @param cf CqlRow containing columns from schema_columnfamilies.
* @return CFMetaData derived from CqlRow
*/
public static CFMetaData fromThriftCqlRow(CqlRow cf, CqlResult columnsRes)
@@ -1476,11 +1476,11 @@ public final class CFMetaData
*
* @return Difference between attributes in form of schema mutation
*/
- public RowMutation toSchemaUpdate(CFMetaData newState, long modificationTimestamp, boolean fromThrift)
+ public Mutation toSchemaUpdate(CFMetaData newState, long modificationTimestamp, boolean fromThrift)
{
- RowMutation rm = new RowMutation(Keyspace.SYSTEM_KS, SystemKeyspace.getSchemaKSKey(ksName));
+ Mutation mutation = new Mutation(Keyspace.SYSTEM_KS, SystemKeyspace.getSchemaKSKey(ksName));
- newState.toSchemaNoColumnsNoTriggers(rm, modificationTimestamp);
+ newState.toSchemaNoColumnsNoTriggers(mutation, modificationTimestamp);
MapDifference<ByteBuffer, ColumnDefinition> columnDiff = Maps.difference(columnMetadata, newState.columnMetadata);
@@ -1492,31 +1492,31 @@ public final class CFMetaData
if (fromThrift && cd.kind != ColumnDefinition.Kind.REGULAR)
continue;
- cd.deleteFromSchema(rm, modificationTimestamp);
+ cd.deleteFromSchema(mutation, modificationTimestamp);
}
// newly added columns
for (ColumnDefinition cd : columnDiff.entriesOnlyOnRight().values())
- cd.toSchema(rm, modificationTimestamp);
+ cd.toSchema(mutation, modificationTimestamp);
// old columns with updated attributes
for (ByteBuffer name : columnDiff.entriesDiffering().keySet())
{
ColumnDefinition cd = newState.columnMetadata.get(name);
- cd.toSchema(rm, modificationTimestamp);
+ cd.toSchema(mutation, modificationTimestamp);
}
MapDifference<String, TriggerDefinition> triggerDiff = Maps.difference(triggers, newState.triggers);
// dropped triggers
for (TriggerDefinition td : triggerDiff.entriesOnlyOnLeft().values())
- td.deleteFromSchema(rm, cfName, modificationTimestamp);
+ td.deleteFromSchema(mutation, cfName, modificationTimestamp);
// newly created triggers
for (TriggerDefinition td : triggerDiff.entriesOnlyOnRight().values())
- td.toSchema(rm, cfName, modificationTimestamp);
+ td.toSchema(mutation, cfName, modificationTimestamp);
- return rm;
+ return mutation;
}
/**
@@ -1524,24 +1524,24 @@ public final class CFMetaData
*
* @param timestamp Timestamp to use
*
- * @return RowMutation to use to completely remove cf from schema
+ * @return Mutation to use to completely remove cf from schema
*/
- public RowMutation dropFromSchema(long timestamp)
+ public Mutation dropFromSchema(long timestamp)
{
- RowMutation rm = new RowMutation(Keyspace.SYSTEM_KS, SystemKeyspace.getSchemaKSKey(ksName));
- ColumnFamily cf = rm.addOrGet(SchemaColumnFamiliesCf);
+ Mutation mutation = new Mutation(Keyspace.SYSTEM_KS, SystemKeyspace.getSchemaKSKey(ksName));
+ ColumnFamily cf = mutation.addOrGet(SchemaColumnFamiliesCf);
int ldt = (int) (System.currentTimeMillis() / 1000);
Composite prefix = SchemaColumnFamiliesCf.comparator.make(cfName);
cf.addAtom(new RangeTombstone(prefix, prefix.end(), timestamp, ldt));
for (ColumnDefinition cd : allColumns())
- cd.deleteFromSchema(rm, timestamp);
+ cd.deleteFromSchema(mutation, timestamp);
for (TriggerDefinition td : triggers.values())
- td.deleteFromSchema(rm, cfName, timestamp);
+ td.deleteFromSchema(mutation, cfName, timestamp);
- return rm;
+ return mutation;
}
public boolean isPurged()
@@ -1554,19 +1554,19 @@ public final class CFMetaData
isPurged = true;
}
- public void toSchema(RowMutation rm, long timestamp)
+ public void toSchema(Mutation mutation, long timestamp)
{
- toSchemaNoColumnsNoTriggers(rm, timestamp);
+ toSchemaNoColumnsNoTriggers(mutation, timestamp);
for (ColumnDefinition cd : allColumns())
- cd.toSchema(rm, timestamp);
+ cd.toSchema(mutation, timestamp);
}
- private void toSchemaNoColumnsNoTriggers(RowMutation rm, long timestamp)
+ private void toSchemaNoColumnsNoTriggers(Mutation mutation, long timestamp)
{
// For property that can be null (and can be changed), we insert tombstones, to make sure
// we don't keep a property the user has removed
- ColumnFamily cf = rm.addOrGet(SchemaColumnFamiliesCf);
+ ColumnFamily cf = mutation.addOrGet(SchemaColumnFamiliesCf);
Composite prefix = SchemaColumnFamiliesCf.comparator.make(cfName);
CFRowAdder adder = new CFRowAdder(cf, prefix, timestamp);
@@ -1790,11 +1790,11 @@ public final class CFMetaData
*
* @throws ConfigurationException if any of the attributes didn't pass validation
*/
- public RowMutation toSchema(long timestamp) throws ConfigurationException
+ public Mutation toSchema(long timestamp) throws ConfigurationException
{
- RowMutation rm = new RowMutation(Keyspace.SYSTEM_KS, SystemKeyspace.getSchemaKSKey(ksName));
- toSchema(rm, timestamp);
- return rm;
+ Mutation mutation = new Mutation(Keyspace.SYSTEM_KS, SystemKeyspace.getSchemaKSKey(ksName));
+ toSchema(mutation, timestamp);
+ return mutation;
}
// The comparator to validate the definition name.
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/config/ColumnDefinition.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/ColumnDefinition.java b/src/java/org/apache/cassandra/config/ColumnDefinition.java
index f16a0a6..79f50bf 100644
--- a/src/java/org/apache/cassandra/config/ColumnDefinition.java
+++ b/src/java/org/apache/cassandra/config/ColumnDefinition.java
@@ -279,14 +279,14 @@ public class ColumnDefinition extends ColumnSpecification
}
/**
- * Drop specified column from the schema using given row.
+ * Drop specified column from the schema using given mutation.
*
- * @param rm The schema row mutation
- * @param timestamp The timestamp to use for column modification
+ * @param mutation The schema mutation
+ * @param timestamp The timestamp to use for column modification
*/
- public void deleteFromSchema(RowMutation rm, long timestamp)
+ public void deleteFromSchema(Mutation mutation, long timestamp)
{
- ColumnFamily cf = rm.addOrGet(CFMetaData.SchemaColumnsCf);
+ ColumnFamily cf = mutation.addOrGet(CFMetaData.SchemaColumnsCf);
int ldt = (int) (System.currentTimeMillis() / 1000);
// Note: we do want to use name.toString(), not name.bytes directly for backward compatibility (For CQL3, this won't make a difference).
@@ -294,9 +294,9 @@ public class ColumnDefinition extends ColumnSpecification
cf.addAtom(new RangeTombstone(prefix, prefix.end(), timestamp, ldt));
}
- public void toSchema(RowMutation rm, long timestamp)
+ public void toSchema(Mutation mutation, long timestamp)
{
- ColumnFamily cf = rm.addOrGet(CFMetaData.SchemaColumnsCf);
+ ColumnFamily cf = mutation.addOrGet(CFMetaData.SchemaColumnsCf);
Composite prefix = CFMetaData.SchemaColumnsCf.comparator.make(cfName, name.toString());
CFRowAdder adder = new CFRowAdder(cf, prefix, timestamp);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/config/KSMetaData.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/KSMetaData.java b/src/java/org/apache/cassandra/config/KSMetaData.java
index 3dfea03..c3fe641 100644
--- a/src/java/org/apache/cassandra/config/KSMetaData.java
+++ b/src/java/org/apache/cassandra/config/KSMetaData.java
@@ -194,7 +194,7 @@ public final class KSMetaData
return ksdef;
}
- public RowMutation toSchemaUpdate(KSMetaData newState, long modificationTimestamp)
+ public Mutation toSchemaUpdate(KSMetaData newState, long modificationTimestamp)
{
return newState.toSchema(modificationTimestamp);
}
@@ -226,21 +226,22 @@ public final class KSMetaData
return fromSchema(ksDefRow, Collections.<CFMetaData>emptyList());
}
- public RowMutation dropFromSchema(long timestamp)
+ public Mutation dropFromSchema(long timestamp)
{
- RowMutation rm = new RowMutation(Keyspace.SYSTEM_KS, SystemKeyspace.getSchemaKSKey(name));
- rm.delete(SystemKeyspace.SCHEMA_KEYSPACES_CF, timestamp);
- rm.delete(SystemKeyspace.SCHEMA_COLUMNFAMILIES_CF, timestamp);
- rm.delete(SystemKeyspace.SCHEMA_COLUMNS_CF, timestamp);
- rm.delete(SystemKeyspace.SCHEMA_TRIGGERS_CF, timestamp);
+ Mutation mutation = new Mutation(Keyspace.SYSTEM_KS, SystemKeyspace.getSchemaKSKey(name));
- return rm;
+ mutation.delete(SystemKeyspace.SCHEMA_KEYSPACES_CF, timestamp);
+ mutation.delete(SystemKeyspace.SCHEMA_COLUMNFAMILIES_CF, timestamp);
+ mutation.delete(SystemKeyspace.SCHEMA_COLUMNS_CF, timestamp);
+ mutation.delete(SystemKeyspace.SCHEMA_TRIGGERS_CF, timestamp);
+
+ return mutation;
}
- public RowMutation toSchema(long timestamp)
+ public Mutation toSchema(long timestamp)
{
- RowMutation rm = new RowMutation(Keyspace.SYSTEM_KS, SystemKeyspace.getSchemaKSKey(name));
- ColumnFamily cf = rm.addOrGet(CFMetaData.SchemaKeyspacesCf);
+ Mutation mutation = new Mutation(Keyspace.SYSTEM_KS, SystemKeyspace.getSchemaKSKey(name));
+ ColumnFamily cf = mutation.addOrGet(CFMetaData.SchemaKeyspacesCf);
CFRowAdder adder = new CFRowAdder(cf, CFMetaData.SchemaKeyspacesCf.comparator.builder().build(), timestamp);
adder.add("durable_writes", durableWrites);
@@ -248,9 +249,9 @@ public final class KSMetaData
adder.add("strategy_options", json(strategyOptions));
for (CFMetaData cfm : cfMetaData.values())
- cfm.toSchema(rm, timestamp);
+ cfm.toSchema(mutation, timestamp);
- return rm;
+ return mutation;
}
/**
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/config/TriggerDefinition.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/TriggerDefinition.java b/src/java/org/apache/cassandra/config/TriggerDefinition.java
index e1809eb..aaaf631 100644
--- a/src/java/org/apache/cassandra/config/TriggerDefinition.java
+++ b/src/java/org/apache/cassandra/config/TriggerDefinition.java
@@ -72,15 +72,15 @@ public class TriggerDefinition
}
/**
- * Add specified trigger to the schema using given row.
+ * Add specified trigger to the schema using given mutation.
*
- * @param rm The schema row mutation
+ * @param mutation The schema mutation
* @param cfName The name of the parent ColumnFamily
* @param timestamp The timestamp to use for the columns
*/
- public void toSchema(RowMutation rm, String cfName, long timestamp)
+ public void toSchema(Mutation mutation, String cfName, long timestamp)
{
- ColumnFamily cf = rm.addOrGet(SystemKeyspace.SCHEMA_TRIGGERS_CF);
+ ColumnFamily cf = mutation.addOrGet(SystemKeyspace.SCHEMA_TRIGGERS_CF);
CFMetaData cfm = CFMetaData.SchemaTriggersCf;
Composite prefix = cfm.comparator.make(cfName, name);
@@ -90,15 +90,15 @@ public class TriggerDefinition
}
/**
- * Drop specified trigger from the schema using given row.
+ * Drop specified trigger from the schema using given mutation.
*
- * @param rm The schema row mutation
+ * @param mutation The schema mutation
* @param cfName The name of the parent ColumnFamily
* @param timestamp The timestamp to use for the tombstone
*/
- public void deleteFromSchema(RowMutation rm, String cfName, long timestamp)
+ public void deleteFromSchema(Mutation mutation, String cfName, long timestamp)
{
- ColumnFamily cf = rm.addOrGet(SystemKeyspace.SCHEMA_TRIGGERS_CF);
+ ColumnFamily cf = mutation.addOrGet(SystemKeyspace.SCHEMA_TRIGGERS_CF);
int ldt = (int) (System.currentTimeMillis() / 1000);
Composite prefix = CFMetaData.SchemaTriggersCf.comparator.make(cfName, name);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/config/UTMetaData.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/UTMetaData.java b/src/java/org/apache/cassandra/config/UTMetaData.java
index f78e645..76f3999 100644
--- a/src/java/org/apache/cassandra/config/UTMetaData.java
+++ b/src/java/org/apache/cassandra/config/UTMetaData.java
@@ -83,10 +83,10 @@ public final class UTMetaData
return fromSchema(result);
}
- public static RowMutation toSchema(UserType newType, long timestamp)
+ public static Mutation toSchema(UserType newType, long timestamp)
{
- RowMutation rm = new RowMutation(Keyspace.SYSTEM_KS, newType.name);
- ColumnFamily cf = rm.addOrGet(SystemKeyspace.SCHEMA_USER_TYPES_CF);
+ Mutation mutation = new Mutation(Keyspace.SYSTEM_KS, newType.name);
+ ColumnFamily cf = mutation.addOrGet(SystemKeyspace.SCHEMA_USER_TYPES_CF);
CFMetaData cfm = CFMetaData.SchemaUserTypesCf;
UpdateParameters params = new UpdateParameters(cfm, Collections.<ByteBuffer>emptyList(), timestamp, 0, null);
@@ -106,14 +106,14 @@ public final class UTMetaData
throw new AssertionError();
}
- return rm;
+ return mutation;
}
- public static RowMutation dropFromSchema(UserType droppedType, long timestamp)
+ public static Mutation dropFromSchema(UserType droppedType, long timestamp)
{
- RowMutation rm = new RowMutation(Keyspace.SYSTEM_KS, droppedType.name);
- rm.delete(SystemKeyspace.SCHEMA_USER_TYPES_CF, timestamp);
- return rm;
+ Mutation mutation = new Mutation(Keyspace.SYSTEM_KS, droppedType.name);
+ mutation.delete(SystemKeyspace.SCHEMA_USER_TYPES_CF, timestamp);
+ return mutation;
}
public void addAll(UTMetaData types)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/cql/DeleteStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/DeleteStatement.java b/src/java/org/apache/cassandra/cql/DeleteStatement.java
index bcc63e1..71942e4 100644
--- a/src/java/org/apache/cassandra/cql/DeleteStatement.java
+++ b/src/java/org/apache/cassandra/cql/DeleteStatement.java
@@ -24,9 +24,9 @@ import java.util.List;
import org.apache.cassandra.auth.Permission;
import org.apache.cassandra.config.CFMetaData;
import org.apache.cassandra.config.Schema;
+import org.apache.cassandra.db.Mutation;
import org.apache.cassandra.db.composites.CellName;
import org.apache.cassandra.db.IMutation;
-import org.apache.cassandra.db.RowMutation;
import org.apache.cassandra.db.marshal.AbstractType;
import org.apache.cassandra.exceptions.InvalidRequestException;
import org.apache.cassandra.exceptions.UnauthorizedException;
@@ -76,27 +76,25 @@ public class DeleteStatement extends AbstractModification
clientState.hasColumnFamilyAccess(keyspace, columnFamily, Permission.MODIFY);
AbstractType<?> keyType = Schema.instance.getCFMetaData(keyspace, columnFamily).getKeyValidator();
- List<IMutation> rowMutations = new ArrayList<IMutation>(keys.size());
+ List<IMutation> mutations = new ArrayList<IMutation>(keys.size());
for (Term key : keys)
- {
- rowMutations.add(mutationForKey(key.getByteBuffer(keyType, variables), keyspace, timestamp, clientState, variables, metadata));
- }
+ mutations.add(mutationForKey(key.getByteBuffer(keyType, variables), keyspace, timestamp, clientState, variables, metadata));
- return rowMutations;
+ return mutations;
}
- public RowMutation mutationForKey(ByteBuffer key, String keyspace, Long timestamp, ThriftClientState clientState, List<ByteBuffer> variables, CFMetaData metadata)
+ public Mutation mutationForKey(ByteBuffer key, String keyspace, Long timestamp, ThriftClientState clientState, List<ByteBuffer> variables, CFMetaData metadata)
throws InvalidRequestException
{
- RowMutation rm = new RowMutation(keyspace, key);
+ Mutation mutation = new Mutation(keyspace, key);
QueryProcessor.validateKeyAlias(metadata, keyName);
if (columns.size() < 1)
{
- // No columns, delete the row
- rm.delete(columnFamily, (timestamp == null) ? getTimestamp(clientState) : timestamp);
+ // No columns, delete the partition
+ mutation.delete(columnFamily, (timestamp == null) ? getTimestamp(clientState) : timestamp);
}
else
{
@@ -106,11 +104,11 @@ public class DeleteStatement extends AbstractModification
{
CellName columnName = metadata.comparator.cellFromByteBuffer(column.getByteBuffer(at, variables));
validateColumnName(columnName);
- rm.delete(columnFamily, columnName, (timestamp == null) ? getTimestamp(clientState) : timestamp);
+ mutation.delete(columnFamily, columnName, (timestamp == null) ? getTimestamp(clientState) : timestamp);
}
}
- return rm;
+ return mutation;
}
public String toString()
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/cql/UpdateStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/UpdateStatement.java b/src/java/org/apache/cassandra/cql/UpdateStatement.java
index 446c5a2..16a0d76 100644
--- a/src/java/org/apache/cassandra/cql/UpdateStatement.java
+++ b/src/java/org/apache/cassandra/cql/UpdateStatement.java
@@ -23,12 +23,9 @@ import java.util.*;
import org.apache.cassandra.auth.Permission;
import org.apache.cassandra.config.CFMetaData;
import org.apache.cassandra.config.Schema;
+import org.apache.cassandra.db.*;
import org.apache.cassandra.db.composites.CellName;
import org.apache.cassandra.db.composites.CellNameType;
-import org.apache.cassandra.db.CounterMutation;
-import org.apache.cassandra.db.ConsistencyLevel;
-import org.apache.cassandra.db.IMutation;
-import org.apache.cassandra.db.RowMutation;
import org.apache.cassandra.db.marshal.AbstractType;
import org.apache.cassandra.exceptions.InvalidRequestException;
import org.apache.cassandra.exceptions.UnauthorizedException;
@@ -151,18 +148,16 @@ public class UpdateStatement extends AbstractModification
clientState.hasColumnFamilyAccess(keyspace, columnFamily, Permission.MODIFY);
- List<IMutation> rowMutations = new LinkedList<IMutation>();
+ List<IMutation> mutations = new LinkedList<>();
for (Term key: keys)
- {
- rowMutations.add(mutationForKey(keyspace, key.getByteBuffer(getKeyType(keyspace),variables), metadata, timestamp, clientState, variables));
- }
+ mutations.add(mutationForKey(keyspace, key.getByteBuffer(getKeyType(keyspace),variables), metadata, timestamp, clientState, variables));
- return rowMutations;
+ return mutations;
}
/**
- * Compute a row mutation for a single key
+ * Compute a mutation for a single key
*
*
* @param keyspace working keyspace
@@ -171,7 +166,7 @@ public class UpdateStatement extends AbstractModification
* @param timestamp global timestamp to use for every key mutation
*
* @param clientState
- * @return row mutation
+ * @return mutation
*
* @throws InvalidRequestException on the wrong request
*/
@@ -182,9 +177,9 @@ public class UpdateStatement extends AbstractModification
CellNameType comparator = metadata.comparator;
AbstractType<?> at = comparator.asAbstractType();
- // if true we need to wrap RowMutation into CounterMutation
+ // if true we need to wrap Mutation into CounterMutation
boolean hasCounterColumn = false;
- RowMutation rm = new RowMutation(keyspace, key);
+ Mutation mutation = new Mutation(keyspace, key);
for (Map.Entry<Term, Operation> column : getColumns().entrySet())
{
@@ -199,11 +194,11 @@ public class UpdateStatement extends AbstractModification
ByteBuffer colValue = op.a.getByteBuffer(metadata.getValueValidator(colName),variables);
validateColumn(metadata, colName, colValue);
- rm.add(columnFamily,
- colName,
- colValue,
- (timestamp == null) ? getTimestamp(clientState) : timestamp,
- getTimeToLive());
+ mutation.add(columnFamily,
+ colName,
+ colValue,
+ (timestamp == null) ? getTimestamp(clientState) : timestamp,
+ getTimeToLive());
}
else
{
@@ -224,11 +219,11 @@ public class UpdateStatement extends AbstractModification
op.b.getText()));
}
- rm.addCounter(columnFamily, colName, value);
+ mutation.addCounter(columnFamily, colName, value);
}
}
- return (hasCounterColumn) ? new CounterMutation(rm, getConsistencyLevel()) : rm;
+ return (hasCounterColumn) ? new CounterMutation(mutation, getConsistencyLevel()) : mutation;
}
public String getColumnFamily()
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java b/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java
index a396ef4..d164816 100644
--- a/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java
@@ -516,18 +516,18 @@ public abstract class ModificationStatement implements CQLStatement, MeasurableF
private IMutation makeMutation(ByteBuffer key, ColumnFamily cf, ConsistencyLevel cl, boolean isBatch)
{
- RowMutation rm;
+ Mutation mutation;
if (isBatch)
{
// we might group other mutations together with this one later, so make it mutable
- rm = new RowMutation(cfm.ksName, key);
- rm.add(cf);
+ mutation = new Mutation(cfm.ksName, key);
+ mutation.add(cf);
}
else
{
- rm = new RowMutation(cfm.ksName, key, cf);
+ mutation = new Mutation(cfm.ksName, key, cf);
}
- return isCounter() ? new CounterMutation(rm, cl) : rm;
+ return isCounter() ? new CounterMutation(mutation, cl) : mutation;
}
private ColumnFamily buildConditions(ByteBuffer key, Composite clusteringPrefix, UpdateParameters params)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/db/BatchlogManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/BatchlogManager.java b/src/java/org/apache/cassandra/db/BatchlogManager.java
index 24fb0c5..b103b69 100644
--- a/src/java/org/apache/cassandra/db/BatchlogManager.java
+++ b/src/java/org/apache/cassandra/db/BatchlogManager.java
@@ -35,7 +35,6 @@ import javax.management.ObjectName;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
-import org.apache.cassandra.db.composites.CellName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,6 +43,7 @@ import org.apache.cassandra.config.CFMetaData;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.cql3.QueryProcessor;
import org.apache.cassandra.cql3.UntypedResultSet;
+import org.apache.cassandra.db.composites.CellName;
import org.apache.cassandra.db.compaction.CompactionManager;
import org.apache.cassandra.db.marshal.LongType;
import org.apache.cassandra.db.marshal.UUIDType;
@@ -121,21 +121,21 @@ public class BatchlogManager implements BatchlogManagerMBean
batchlogTasks.execute(runnable);
}
- public static RowMutation getBatchlogMutationFor(Collection<RowMutation> mutations, UUID uuid)
+ public static Mutation getBatchlogMutationFor(Collection<Mutation> mutations, UUID uuid)
{
long timestamp = FBUtilities.timestampMicros();
ByteBuffer writtenAt = LongType.instance.decompose(timestamp / 1000);
- ByteBuffer data = serializeRowMutations(mutations);
+ ByteBuffer data = serializeMutations(mutations);
ColumnFamily cf = ArrayBackedSortedColumns.factory.create(CFMetaData.BatchlogCf);
cf.addColumn(new Cell(cellName(""), ByteBufferUtil.EMPTY_BYTE_BUFFER, timestamp));
cf.addColumn(new Cell(cellName("data"), data, timestamp));
cf.addColumn(new Cell(cellName("written_at"), writtenAt, timestamp));
- return new RowMutation(Keyspace.SYSTEM_KS, UUIDType.instance.decompose(uuid), cf);
+ return new Mutation(Keyspace.SYSTEM_KS, UUIDType.instance.decompose(uuid), cf);
}
- private static ByteBuffer serializeRowMutations(Collection<RowMutation> mutations)
+ private static ByteBuffer serializeMutations(Collection<Mutation> mutations)
{
FastByteArrayOutputStream bos = new FastByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(bos);
@@ -143,8 +143,8 @@ public class BatchlogManager implements BatchlogManagerMBean
try
{
out.writeInt(mutations.size());
- for (RowMutation rm : mutations)
- RowMutation.serializer.serialize(rm, out, VERSION);
+ for (Mutation mutation : mutations)
+ Mutation.serializer.serialize(mutation, out, VERSION);
}
catch (IOException e)
{
@@ -204,14 +204,14 @@ public class BatchlogManager implements BatchlogManagerMBean
DataInputStream in = new DataInputStream(ByteBufferUtil.inputStream(data));
int size = in.readInt();
for (int i = 0; i < size; i++)
- replaySerializedMutation(RowMutation.serializer.deserialize(in, VERSION), writtenAt);
+ replaySerializedMutation(Mutation.serializer.deserialize(in, VERSION), writtenAt);
}
/*
* We try to deliver the mutations to the replicas ourselves if they are alive and only resort to writing hints
* when a replica is down or a write request times out.
*/
- private void replaySerializedMutation(RowMutation mutation, long writtenAt)
+ private void replaySerializedMutation(Mutation mutation, long writtenAt)
{
int ttl = calculateHintTTL(mutation, writtenAt);
if (ttl <= 0)
@@ -235,7 +235,7 @@ public class BatchlogManager implements BatchlogManagerMBean
attemptDirectDelivery(mutation, writtenAt, liveEndpoints);
}
- private void attemptDirectDelivery(RowMutation mutation, long writtenAt, Set<InetAddress> endpoints)
+ private void attemptDirectDelivery(Mutation mutation, long writtenAt, Set<InetAddress> endpoints)
{
List<WriteResponseHandler> handlers = Lists.newArrayList();
final CopyOnWriteArraySet<InetAddress> undelivered = new CopyOnWriteArraySet<InetAddress>(endpoints);
@@ -277,7 +277,7 @@ public class BatchlogManager implements BatchlogManagerMBean
// calculate ttl for the mutation's hint (and reduce ttl by the time the mutation spent in the batchlog).
// this ensures that deletes aren't "undone" by an old batch replay.
- private int calculateHintTTL(RowMutation mutation, long writtenAt)
+ private int calculateHintTTL(Mutation mutation, long writtenAt)
{
return (int) ((HintedHandOffManager.calculateHintTTL(mutation) * 1000 - (System.currentTimeMillis() - writtenAt)) / 1000);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/db/CollationController.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/CollationController.java b/src/java/org/apache/cassandra/db/CollationController.java
index c7c09bf..1f164a9 100644
--- a/src/java/org/apache/cassandra/db/CollationController.java
+++ b/src/java/org/apache/cassandra/db/CollationController.java
@@ -149,9 +149,9 @@ public class CollationController
&& cfs.getCompactionStrategy() instanceof SizeTieredCompactionStrategy)
{
Tracing.trace("Defragmenting requested data");
- RowMutation rm = new RowMutation(cfs.keyspace.getName(), filter.key.key, returnCF.cloneMe());
+ Mutation mutation = new Mutation(cfs.keyspace.getName(), filter.key.key, returnCF.cloneMe());
// skipping commitlog and index updates is fine since we're just de-fragmenting existing data
- Keyspace.open(rm.getKeyspaceName()).apply(rm, false, false);
+ Keyspace.open(mutation.getKeyspaceName()).apply(mutation, false, false);
}
// Caller is responsible for final removeDeletedCF. This is important for cacheRow to work correctly:
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/db/CounterCell.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/CounterCell.java b/src/java/org/apache/cassandra/db/CounterCell.java
index 0391eb8..297ec73 100644
--- a/src/java/org/apache/cassandra/db/CounterCell.java
+++ b/src/java/org/apache/cassandra/db/CounterCell.java
@@ -349,12 +349,12 @@ public class CounterCell extends Cell
private static void sendToOtherReplica(DecoratedKey key, ColumnFamily cf) throws RequestExecutionException
{
- RowMutation rm = new RowMutation(cf.metadata().ksName, key.key, cf);
+ Mutation mutation = new Mutation(cf.metadata().ksName, key.key, cf);
final InetAddress local = FBUtilities.getBroadcastAddress();
String localDataCenter = DatabaseDescriptor.getEndpointSnitch().getDatacenter(local);
- StorageProxy.performWrite(rm, ConsistencyLevel.ANY, localDataCenter, new StorageProxy.WritePerformer()
+ StorageProxy.performWrite(mutation, ConsistencyLevel.ANY, localDataCenter, new StorageProxy.WritePerformer()
{
public void apply(IMutation mutation, Iterable<InetAddress> targets, AbstractWriteResponseHandler responseHandler, String localDataCenter, ConsistencyLevel consistency_level)
throws OverloadedException
@@ -363,7 +363,7 @@ public class CounterCell extends Cell
Set<InetAddress> remotes = Sets.difference(ImmutableSet.copyOf(targets), ImmutableSet.of(local));
// Fake local response to be a good lad but we won't wait on the responseHandler
responseHandler.response(null);
- StorageProxy.sendToHintedEndpoints((RowMutation) mutation, remotes, responseHandler, localDataCenter);
+ StorageProxy.sendToHintedEndpoints((Mutation) mutation, remotes, responseHandler, localDataCenter);
}
}, null, WriteType.SIMPLE);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/db/CounterMutation.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/CounterMutation.java b/src/java/org/apache/cassandra/db/CounterMutation.java
index f0942e2..a07dd9b 100644
--- a/src/java/org/apache/cassandra/db/CounterMutation.java
+++ b/src/java/org/apache/cassandra/db/CounterMutation.java
@@ -42,38 +42,33 @@ public class CounterMutation implements IMutation
{
public static final CounterMutationSerializer serializer = new CounterMutationSerializer();
- private final RowMutation rowMutation;
+ private final Mutation mutation;
private final ConsistencyLevel consistency;
- public CounterMutation(RowMutation rowMutation, ConsistencyLevel consistency)
+ public CounterMutation(Mutation mutation, ConsistencyLevel consistency)
{
- this.rowMutation = rowMutation;
+ this.mutation = mutation;
this.consistency = consistency;
}
public String getKeyspaceName()
{
- return rowMutation.getKeyspaceName();
+ return mutation.getKeyspaceName();
}
public Collection<UUID> getColumnFamilyIds()
{
- return rowMutation.getColumnFamilyIds();
+ return mutation.getColumnFamilyIds();
}
public Collection<ColumnFamily> getColumnFamilies()
{
- return rowMutation.getColumnFamilies();
+ return mutation.getColumnFamilies();
}
public ByteBuffer key()
{
- return rowMutation.key();
- }
-
- public RowMutation rowMutation()
- {
- return rowMutation;
+ return mutation.key();
}
public ConsistencyLevel consistency()
@@ -81,19 +76,19 @@ public class CounterMutation implements IMutation
return consistency;
}
- public RowMutation makeReplicationMutation()
+ public Mutation makeReplicationMutation()
{
List<ReadCommand> readCommands = new LinkedList<ReadCommand>();
long timestamp = System.currentTimeMillis();
- for (ColumnFamily columnFamily : rowMutation.getColumnFamilies())
+ for (ColumnFamily columnFamily : mutation.getColumnFamilies())
{
if (!columnFamily.metadata().getReplicateOnWrite())
continue;
- addReadCommandFromColumnFamily(rowMutation.getKeyspaceName(), rowMutation.key(), columnFamily, timestamp, readCommands);
+ addReadCommandFromColumnFamily(mutation.getKeyspaceName(), mutation.key(), columnFamily, timestamp, readCommands);
}
- // create a replication RowMutation
- RowMutation replicationMutation = new RowMutation(rowMutation.getKeyspaceName(), rowMutation.key());
+ // create a replication Mutation
+ Mutation replicationMutation = new Mutation(mutation.getKeyspaceName(), mutation.key());
for (ReadCommand readCommand : readCommands)
{
Keyspace keyspace = Keyspace.open(readCommand.ksName);
@@ -121,7 +116,7 @@ public class CounterMutation implements IMutation
public boolean shouldReplicateOnWrite()
{
- for (ColumnFamily cf : rowMutation.getColumnFamilies())
+ for (ColumnFamily cf : mutation.getColumnFamilies())
if (cf.metadata().getReplicateOnWrite())
return true;
return false;
@@ -130,10 +125,10 @@ public class CounterMutation implements IMutation
public void apply()
{
// transform all CounterUpdateCell to CounterCell: accomplished by localCopy
- RowMutation rm = new RowMutation(rowMutation.getKeyspaceName(), ByteBufferUtil.clone(rowMutation.key()));
- Keyspace keyspace = Keyspace.open(rm.getKeyspaceName());
+ Mutation m = new Mutation(mutation.getKeyspaceName(), ByteBufferUtil.clone(mutation.key()));
+ Keyspace keyspace = Keyspace.open(m.getKeyspaceName());
- for (ColumnFamily cf_ : rowMutation.getColumnFamilies())
+ for (ColumnFamily cf_ : mutation.getColumnFamilies())
{
ColumnFamily cf = cf_.cloneMeShallow();
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(cf.id());
@@ -141,9 +136,9 @@ public class CounterMutation implements IMutation
{
cf.addColumn(cell.localCopy(cfs), HeapAllocator.instance);
}
- rm.add(cf);
+ m.add(cf);
}
- rm.apply();
+ m.apply();
}
public void addAll(IMutation m)
@@ -152,7 +147,7 @@ public class CounterMutation implements IMutation
throw new IllegalArgumentException();
CounterMutation cm = (CounterMutation)m;
- rowMutation.addAll(cm.rowMutation);
+ mutation.addAll(cm.mutation);
}
@Override
@@ -164,30 +159,30 @@ public class CounterMutation implements IMutation
public String toString(boolean shallow)
{
StringBuilder buff = new StringBuilder("CounterMutation(");
- buff.append(rowMutation.toString(shallow));
+ buff.append(mutation.toString(shallow));
buff.append(", ").append(consistency.toString());
return buff.append(")").toString();
}
-}
-class CounterMutationSerializer implements IVersionedSerializer<CounterMutation>
-{
- public void serialize(CounterMutation cm, DataOutput out, int version) throws IOException
+ public static class CounterMutationSerializer implements IVersionedSerializer<CounterMutation>
{
- RowMutation.serializer.serialize(cm.rowMutation(), out, version);
- out.writeUTF(cm.consistency().name());
- }
+ public void serialize(CounterMutation cm, DataOutput out, int version) throws IOException
+ {
+ Mutation.serializer.serialize(cm.mutation, out, version);
+ out.writeUTF(cm.consistency.name());
+ }
- public CounterMutation deserialize(DataInput in, int version) throws IOException
- {
- RowMutation rm = RowMutation.serializer.deserialize(in, version);
- ConsistencyLevel consistency = Enum.valueOf(ConsistencyLevel.class, in.readUTF());
- return new CounterMutation(rm, consistency);
- }
+ public CounterMutation deserialize(DataInput in, int version) throws IOException
+ {
+ Mutation m = Mutation.serializer.deserialize(in, version);
+ ConsistencyLevel consistency = Enum.valueOf(ConsistencyLevel.class, in.readUTF());
+ return new CounterMutation(m, consistency);
+ }
- public long serializedSize(CounterMutation cm, int version)
- {
- return RowMutation.serializer.serializedSize(cm.rowMutation(), version)
- + TypeSizes.NATIVE.sizeof(cm.consistency().name());
+ public long serializedSize(CounterMutation cm, int version)
+ {
+ return Mutation.serializer.serializedSize(cm.mutation, version)
+ + TypeSizes.NATIVE.sizeof(cm.consistency.name());
+ }
}
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/db/DefinitionsUpdateVerbHandler.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/DefinitionsUpdateVerbHandler.java b/src/java/org/apache/cassandra/db/DefinitionsUpdateVerbHandler.java
index cab094d..5cb62ed 100644
--- a/src/java/org/apache/cassandra/db/DefinitionsUpdateVerbHandler.java
+++ b/src/java/org/apache/cassandra/db/DefinitionsUpdateVerbHandler.java
@@ -32,13 +32,13 @@ import org.apache.cassandra.utils.WrappedRunnable;
* Called when node receives updated schema state from the schema migration coordinator node.
* Such happens when user makes local schema migration on one of the nodes in the ring
* (which is going to act as coordinator) and that node sends (pushes) it's updated schema state
- * (in form of row mutations) to all the alive nodes in the cluster.
+ * (in form of mutations) to all the alive nodes in the cluster.
*/
-public class DefinitionsUpdateVerbHandler implements IVerbHandler<Collection<RowMutation>>
+public class DefinitionsUpdateVerbHandler implements IVerbHandler<Collection<Mutation>>
{
private static final Logger logger = LoggerFactory.getLogger(DefinitionsUpdateVerbHandler.class);
- public void doVerb(final MessageIn<Collection<RowMutation>> message, int id)
+ public void doVerb(final MessageIn<Collection<Mutation>> message, int id)
{
logger.debug("Received schema mutation push from {}", message.from);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/db/DefsTables.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/DefsTables.java b/src/java/org/apache/cassandra/db/DefsTables.java
index 693ef97..a9e1c74 100644
--- a/src/java/org/apache/cassandra/db/DefsTables.java
+++ b/src/java/org/apache/cassandra/db/DefsTables.java
@@ -37,11 +37,9 @@ import org.apache.cassandra.db.compaction.CompactionManager;
import org.apache.cassandra.db.filter.QueryFilter;
import org.apache.cassandra.db.marshal.AsciiType;
import org.apache.cassandra.db.marshal.UserType;
-import org.apache.cassandra.db.marshal.UTF8Type;
import org.apache.cassandra.exceptions.ConfigurationException;
import org.apache.cassandra.service.MigrationManager;
import org.apache.cassandra.service.StorageService;
-import org.apache.cassandra.utils.ByteBufferUtil;
/**
* SCHEMA_{KEYSPACES, COLUMNFAMILIES, COLUMNS}_CF are used to store Keyspace/ColumnFamily attributes to make schema
@@ -145,7 +143,7 @@ public class DefsTables
}
/**
- * Merge remote schema in form of row mutations with local and mutate ks/cf metadata objects
+ * Merge remote schema in form of mutations with local and mutate ks/cf metadata objects
* (which also involves fs operations on add/drop ks/cf)
*
* @param mutations the schema changes to apply
@@ -153,14 +151,14 @@ public class DefsTables
* @throws ConfigurationException If one of metadata attributes has invalid value
* @throws IOException If data was corrupted during transportation or failed to apply fs operations
*/
- public static synchronized void mergeSchema(Collection<RowMutation> mutations) throws ConfigurationException, IOException
+ public static synchronized void mergeSchema(Collection<Mutation> mutations) throws ConfigurationException, IOException
{
// current state of the schema
Map<DecoratedKey, ColumnFamily> oldKeyspaces = SystemKeyspace.getSchema(SystemKeyspace.SCHEMA_KEYSPACES_CF);
Map<DecoratedKey, ColumnFamily> oldColumnFamilies = SystemKeyspace.getSchema(SystemKeyspace.SCHEMA_COLUMNFAMILIES_CF);
List<Row> oldTypes = SystemKeyspace.serializedSchema(SystemKeyspace.SCHEMA_USER_TYPES_CF);
- for (RowMutation mutation : mutations)
+ for (Mutation mutation : mutations)
mutation.apply();
if (!StorageService.instance.isClientMode())
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/db/HintedHandOffManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/HintedHandOffManager.java b/src/java/org/apache/cassandra/db/HintedHandOffManager.java
index 9b470e4..51a1822 100644
--- a/src/java/org/apache/cassandra/db/HintedHandOffManager.java
+++ b/src/java/org/apache/cassandra/db/HintedHandOffManager.java
@@ -121,7 +121,7 @@ public class HintedHandOffManager implements HintedHandOffManagerMBean
* Returns a mutation representing a Hint to be sent to <code>targetId</code>
* as soon as it becomes available again.
*/
- public RowMutation hintFor(RowMutation mutation, int ttl, UUID targetId)
+ public Mutation hintFor(Mutation mutation, int ttl, UUID targetId)
{
assert ttl > 0;
@@ -135,18 +135,18 @@ public class HintedHandOffManager implements HintedHandOffManagerMBean
UUID hintId = UUIDGen.getTimeUUID();
// serialize the hint with id and version as a composite column name
CellName name = CFMetaData.HintsCf.comparator.makeCellName(hintId, MessagingService.current_version);
- ByteBuffer value = ByteBuffer.wrap(FBUtilities.serialize(mutation, RowMutation.serializer, MessagingService.current_version));
+ ByteBuffer value = ByteBuffer.wrap(FBUtilities.serialize(mutation, Mutation.serializer, MessagingService.current_version));
ColumnFamily cf = ArrayBackedSortedColumns.factory.create(Schema.instance.getCFMetaData(Keyspace.SYSTEM_KS, SystemKeyspace.HINTS_CF));
cf.addColumn(name, value, System.currentTimeMillis(), ttl);
- return new RowMutation(Keyspace.SYSTEM_KS, UUIDType.instance.decompose(targetId), cf);
+ return new Mutation(Keyspace.SYSTEM_KS, UUIDType.instance.decompose(targetId), cf);
}
/*
- * determine the TTL for the hint RowMutation
+ * determine the TTL for the hint Mutation
* this is set at the smallest GCGraceSeconds for any of the CFs in the RM
* this ensures that deletes aren't "undone" by delivery of an old hint
*/
- public static int calculateHintTTL(RowMutation mutation)
+ public static int calculateHintTTL(Mutation mutation)
{
int ttl = maxHintTTL;
for (ColumnFamily cf : mutation.getColumnFamilies())
@@ -181,9 +181,9 @@ public class HintedHandOffManager implements HintedHandOffManagerMBean
private static void deleteHint(ByteBuffer tokenBytes, CellName columnName, long timestamp)
{
- RowMutation rm = new RowMutation(Keyspace.SYSTEM_KS, tokenBytes);
- rm.delete(SystemKeyspace.HINTS_CF, columnName, timestamp);
- rm.applyUnsafe(); // don't bother with commitlog since we're going to flush as soon as we're done with delivery
+ Mutation mutation = new Mutation(Keyspace.SYSTEM_KS, tokenBytes);
+ mutation.delete(SystemKeyspace.HINTS_CF, columnName, timestamp);
+ mutation.applyUnsafe(); // don't bother with commitlog since we're going to flush as soon as we're done with delivery
}
public void deleteHintsForEndpoint(final String ipOrHostname)
@@ -206,8 +206,8 @@ public class HintedHandOffManager implements HintedHandOffManagerMBean
return;
UUID hostId = StorageService.instance.getTokenMetadata().getHostId(endpoint);
ByteBuffer hostIdBytes = ByteBuffer.wrap(UUIDGen.decompose(hostId));
- final RowMutation rm = new RowMutation(Keyspace.SYSTEM_KS, hostIdBytes);
- rm.delete(SystemKeyspace.HINTS_CF, System.currentTimeMillis());
+ final Mutation mutation = new Mutation(Keyspace.SYSTEM_KS, hostIdBytes);
+ mutation.delete(SystemKeyspace.HINTS_CF, System.currentTimeMillis());
// execute asynchronously to avoid blocking caller (which may be processing gossip)
Runnable runnable = new Runnable()
@@ -217,7 +217,7 @@ public class HintedHandOffManager implements HintedHandOffManagerMBean
try
{
logger.info("Deleting any stored hints for {}", endpoint);
- rm.apply();
+ mutation.apply();
compact();
}
catch (Exception e)
@@ -384,10 +384,10 @@ public class HintedHandOffManager implements HintedHandOffManagerMBean
int version = Int32Type.instance.compose(hint.name().get(1));
DataInputStream in = new DataInputStream(ByteBufferUtil.inputStream(hint.value()));
- RowMutation rm;
+ Mutation mutation;
try
{
- rm = RowMutation.serializer.deserialize(in, version);
+ mutation = Mutation.serializer.deserialize(in, version);
}
catch (UnknownColumnFamilyException e)
{
@@ -401,12 +401,12 @@ public class HintedHandOffManager implements HintedHandOffManagerMBean
}
truncationTimesCache.clear();
- for (UUID cfId : ImmutableSet.copyOf((rm.getColumnFamilyIds())))
+ for (UUID cfId : ImmutableSet.copyOf((mutation.getColumnFamilyIds())))
{
Long truncatedAt = truncationTimesCache.get(cfId);
if (truncatedAt == null)
{
- ColumnFamilyStore cfs = Keyspace.open(rm.getKeyspaceName()).getColumnFamilyStore(cfId);
+ ColumnFamilyStore cfs = Keyspace.open(mutation.getKeyspaceName()).getColumnFamilyStore(cfId);
truncatedAt = cfs.getTruncationTime();
truncationTimesCache.put(cfId, truncatedAt);
}
@@ -414,17 +414,17 @@ public class HintedHandOffManager implements HintedHandOffManagerMBean
if (hint.maxTimestamp() < truncatedAt)
{
logger.debug("Skipping delivery of hint for truncated columnfamily {}", cfId);
- rm = rm.without(cfId);
+ mutation = mutation.without(cfId);
}
}
- if (rm.isEmpty())
+ if (mutation.isEmpty())
{
deleteHint(hostIdBytes, hint.name(), hint.maxTimestamp());
continue;
}
- MessageOut<RowMutation> message = rm.createMessage();
+ MessageOut<Mutation> message = mutation.createMessage();
rateLimiter.acquire(message.serializedSize(MessagingService.current_version));
Runnable callback = new Runnable()
{
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/db/Keyspace.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/Keyspace.java b/src/java/org/apache/cassandra/db/Keyspace.java
index 14bcca1..c380e45 100644
--- a/src/java/org/apache/cassandra/db/Keyspace.java
+++ b/src/java/org/apache/cassandra/db/Keyspace.java
@@ -328,7 +328,7 @@ public class Keyspace
return new Row(filter.key, columnFamily);
}
- public void apply(RowMutation mutation, boolean writeCommitLog)
+ public void apply(Mutation mutation, boolean writeCommitLog)
{
apply(mutation, writeCommitLog, true);
}
@@ -341,7 +341,7 @@ public class Keyspace
* @param writeCommitLog false to disable commitlog append entirely
* @param updateIndexes false to disable index updates (used by CollationController "defragmenting")
*/
- public void apply(RowMutation mutation, boolean writeCommitLog, boolean updateIndexes)
+ public void apply(Mutation mutation, boolean writeCommitLog, boolean updateIndexes)
{
// write the mutation to the commitlog and memtables
Tracing.trace("Acquiring switchLock read lock");
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/db/MigrationRequestVerbHandler.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/MigrationRequestVerbHandler.java b/src/java/org/apache/cassandra/db/MigrationRequestVerbHandler.java
index 31a64a9..d4503ba 100644
--- a/src/java/org/apache/cassandra/db/MigrationRequestVerbHandler.java
+++ b/src/java/org/apache/cassandra/db/MigrationRequestVerbHandler.java
@@ -29,7 +29,7 @@ import org.apache.cassandra.net.MessagingService;
import org.apache.cassandra.service.MigrationManager;
/**
- * Sends it's current schema state in form of row mutations in reply to the remote node's request.
+ * Sends it's current schema state in form of mutations in reply to the remote node's request.
* Such a request is made when one of the nodes, by means of Gossip, detects schema disagreement in the ring.
*/
public class MigrationRequestVerbHandler implements IVerbHandler
@@ -39,9 +39,9 @@ public class MigrationRequestVerbHandler implements IVerbHandler
public void doVerb(MessageIn message, int id)
{
logger.debug("Received migration request from {}.", message.from);
- MessageOut<Collection<RowMutation>> response = new MessageOut<>(MessagingService.Verb.INTERNAL_RESPONSE,
- SystemKeyspace.serializeSchema(),
- MigrationManager.MigrationsSerializer.instance);
+ MessageOut<Collection<Mutation>> response = new MessageOut<>(MessagingService.Verb.INTERNAL_RESPONSE,
+ SystemKeyspace.serializeSchema(),
+ MigrationManager.MigrationsSerializer.instance);
MessagingService.instance().sendReply(response, id, message.from);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/db/Mutation.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/Mutation.java b/src/java/org/apache/cassandra/db/Mutation.java
new file mode 100644
index 0000000..d70d7f9
--- /dev/null
+++ b/src/java/org/apache/cassandra/db/Mutation.java
@@ -0,0 +1,336 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cassandra.db;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.*;
+
+import org.apache.commons.lang3.StringUtils;
+
+import org.apache.cassandra.config.CFMetaData;
+import org.apache.cassandra.config.Schema;
+import org.apache.cassandra.db.composites.CellName;
+import org.apache.cassandra.db.composites.Composite;
+import org.apache.cassandra.io.IVersionedSerializer;
+import org.apache.cassandra.net.MessageOut;
+import org.apache.cassandra.net.MessagingService;
+import org.apache.cassandra.utils.ByteBufferUtil;
+
+// TODO convert this to a Builder pattern instead of encouraging M.add directly,
+// which is less-efficient since we have to keep a mutable HashMap around
+public class Mutation implements IMutation
+{
+ public static final MutationSerializer serializer = new MutationSerializer();
+
+ public static final String FORWARD_TO = "FWD_TO";
+ public static final String FORWARD_FROM = "FWD_FRM";
+
+ // todo this is redundant
+ // when we remove it, also restore SerializationsTest.testMutationRead to not regenerate new Mutations each test
+ private final String keyspaceName;
+
+ private final ByteBuffer key;
+ // map of column family id to mutations for that column family.
+ private final Map<UUID, ColumnFamily> modifications;
+
+ public Mutation(String keyspaceName, ByteBuffer key)
+ {
+ this(keyspaceName, key, new HashMap<UUID, ColumnFamily>());
+ }
+
+ public Mutation(String keyspaceName, ByteBuffer key, ColumnFamily cf)
+ {
+ this(keyspaceName, key, Collections.singletonMap(cf.id(), cf));
+ }
+
+ public Mutation(String keyspaceName, Row row)
+ {
+ this(keyspaceName, row.key.key, row.cf);
+ }
+
+ protected Mutation(String keyspaceName, ByteBuffer key, Map<UUID, ColumnFamily> modifications)
+ {
+ this.keyspaceName = keyspaceName;
+ this.key = key;
+ this.modifications = modifications;
+ }
+
+ public Mutation(ByteBuffer key, ColumnFamily cf)
+ {
+ this(cf.metadata().ksName, key, cf);
+ }
+
+ public String getKeyspaceName()
+ {
+ return keyspaceName;
+ }
+
+ public Collection<UUID> getColumnFamilyIds()
+ {
+ return modifications.keySet();
+ }
+
+ public ByteBuffer key()
+ {
+ return key;
+ }
+
+ public Collection<ColumnFamily> getColumnFamilies()
+ {
+ return modifications.values();
+ }
+
+ public ColumnFamily getColumnFamily(UUID cfId)
+ {
+ return modifications.get(cfId);
+ }
+
+ /*
+ * Specify a column family name and the corresponding column
+ * family object.
+ * param @ cf - column family name
+ * param @ columnFamily - the column family.
+ */
+ public void add(ColumnFamily columnFamily)
+ {
+ assert columnFamily != null;
+ ColumnFamily prev = modifications.put(columnFamily.id(), columnFamily);
+ if (prev != null)
+ // developer error
+ throw new IllegalArgumentException("ColumnFamily " + columnFamily + " already has modifications in this mutation: " + prev);
+ }
+
+ /**
+ * @return the ColumnFamily in this Mutation corresponding to @param cfName, creating an empty one if necessary.
+ */
+ public ColumnFamily addOrGet(String cfName)
+ {
+ return addOrGet(Schema.instance.getCFMetaData(keyspaceName, cfName));
+ }
+
+ public ColumnFamily addOrGet(CFMetaData cfm)
+ {
+ ColumnFamily cf = modifications.get(cfm.cfId);
+ if (cf == null)
+ {
+ cf = TreeMapBackedSortedColumns.factory.create(cfm);
+ modifications.put(cfm.cfId, cf);
+ }
+ return cf;
+ }
+
+ public boolean isEmpty()
+ {
+ return modifications.isEmpty();
+ }
+
+ public void add(String cfName, CellName name, ByteBuffer value, long timestamp, int timeToLive)
+ {
+ addOrGet(cfName).addColumn(name, value, timestamp, timeToLive);
+ }
+
+ public void addCounter(String cfName, CellName name, long value)
+ {
+ addOrGet(cfName).addCounter(name, value);
+ }
+
+ public void add(String cfName, CellName name, ByteBuffer value, long timestamp)
+ {
+ add(cfName, name, value, timestamp, 0);
+ }
+
+ public void delete(String cfName, long timestamp)
+ {
+ int localDeleteTime = (int) (System.currentTimeMillis() / 1000);
+ addOrGet(cfName).delete(new DeletionInfo(timestamp, localDeleteTime));
+ }
+
+ public void delete(String cfName, CellName name, long timestamp)
+ {
+ int localDeleteTime = (int) (System.currentTimeMillis() / 1000);
+ addOrGet(cfName).addTombstone(name, localDeleteTime, timestamp);
+ }
+
+ public void deleteRange(String cfName, Composite start, Composite end, long timestamp)
+ {
+ int localDeleteTime = (int) (System.currentTimeMillis() / 1000);
+ addOrGet(cfName).addAtom(new RangeTombstone(start, end, timestamp, localDeleteTime));
+ }
+
+ public void addAll(IMutation m)
+ {
+ if (!(m instanceof Mutation))
+ throw new IllegalArgumentException();
+
+ Mutation mutation = (Mutation)m;
+ if (!keyspaceName.equals(mutation.keyspaceName) || !key.equals(mutation.key))
+ throw new IllegalArgumentException();
+
+ for (Map.Entry<UUID, ColumnFamily> entry : mutation.modifications.entrySet())
+ {
+ // It's slighty faster to assume the key wasn't present and fix if
+ // not in the case where it wasn't there indeed.
+ ColumnFamily cf = modifications.put(entry.getKey(), entry.getValue());
+ if (cf != null)
+ entry.getValue().resolve(cf);
+ }
+ }
+
+ /*
+ * This is equivalent to calling commit. Applies the changes to
+ * to the keyspace that is obtained by calling Keyspace.open().
+ */
+ public void apply()
+ {
+ Keyspace ks = Keyspace.open(keyspaceName);
+ ks.apply(this, ks.metadata.durableWrites);
+ }
+
+ public void applyUnsafe()
+ {
+ Keyspace.open(keyspaceName).apply(this, false);
+ }
+
+ public MessageOut<Mutation> createMessage()
+ {
+ return createMessage(MessagingService.Verb.MUTATION);
+ }
+
+ public MessageOut<Mutation> createMessage(MessagingService.Verb verb)
+ {
+ return new MessageOut<>(verb, this, serializer);
+ }
+
+ public String toString()
+ {
+ return toString(false);
+ }
+
+ public String toString(boolean shallow)
+ {
+ StringBuilder buff = new StringBuilder("Mutation(");
+ buff.append("keyspace='").append(keyspaceName).append('\'');
+ buff.append(", key='").append(ByteBufferUtil.bytesToHex(key)).append('\'');
+ buff.append(", modifications=[");
+ if (shallow)
+ {
+ List<String> cfnames = new ArrayList<String>(modifications.size());
+ for (UUID cfid : modifications.keySet())
+ {
+ CFMetaData cfm = Schema.instance.getCFMetaData(cfid);
+ cfnames.add(cfm == null ? "-dropped-" : cfm.cfName);
+ }
+ buff.append(StringUtils.join(cfnames, ", "));
+ }
+ else
+ buff.append(StringUtils.join(modifications.values(), ", "));
+ return buff.append("])").toString();
+ }
+
+ public Mutation without(UUID cfId)
+ {
+ Mutation mutation = new Mutation(keyspaceName, key);
+ for (Map.Entry<UUID, ColumnFamily> entry : modifications.entrySet())
+ if (!entry.getKey().equals(cfId))
+ mutation.add(entry.getValue());
+ return mutation;
+ }
+
+ public static class MutationSerializer implements IVersionedSerializer<Mutation>
+ {
+ public void serialize(Mutation mutation, DataOutput out, int version) throws IOException
+ {
+ if (version < MessagingService.VERSION_20)
+ out.writeUTF(mutation.getKeyspaceName());
+
+ ByteBufferUtil.writeWithShortLength(mutation.key(), out);
+
+ /* serialize the modifications in the mutation */
+ int size = mutation.modifications.size();
+ out.writeInt(size);
+ assert size > 0;
+ for (Map.Entry<UUID, ColumnFamily> entry : mutation.modifications.entrySet())
+ ColumnFamily.serializer.serialize(entry.getValue(), out, version);
+ }
+
+ public Mutation deserialize(DataInput in, int version, ColumnSerializer.Flag flag) throws IOException
+ {
+ String keyspaceName = null; // will always be set from cf.metadata but javac isn't smart enough to see that
+ if (version < MessagingService.VERSION_20)
+ keyspaceName = in.readUTF();
+
+ ByteBuffer key = ByteBufferUtil.readWithShortLength(in);
+ int size = in.readInt();
+ assert size > 0;
+
+ Map<UUID, ColumnFamily> modifications;
+ if (size == 1)
+ {
+ ColumnFamily cf = deserializeOneCf(in, version, flag);
+ modifications = Collections.singletonMap(cf.id(), cf);
+ keyspaceName = cf.metadata().ksName;
+ }
+ else
+ {
+ modifications = new HashMap<UUID, ColumnFamily>();
+ for (int i = 0; i < size; ++i)
+ {
+ ColumnFamily cf = deserializeOneCf(in, version, flag);
+ modifications.put(cf.id(), cf);
+ keyspaceName = cf.metadata().ksName;
+ }
+ }
+
+ return new Mutation(keyspaceName, key, modifications);
+ }
+
+ private ColumnFamily deserializeOneCf(DataInput in, int version, ColumnSerializer.Flag flag) throws IOException
+ {
+ ColumnFamily cf = ColumnFamily.serializer.deserialize(in, UnsortedColumns.factory, flag, version);
+ // We don't allow Mutation with null column family, so we should never get null back.
+ assert cf != null;
+ return cf;
+ }
+
+ public Mutation deserialize(DataInput in, int version) throws IOException
+ {
+ return deserialize(in, version, ColumnSerializer.Flag.FROM_REMOTE);
+ }
+
+ public long serializedSize(Mutation mutation, int version)
+ {
+ TypeSizes sizes = TypeSizes.NATIVE;
+ int size = 0;
+
+ if (version < MessagingService.VERSION_20)
+ size += sizes.sizeof(mutation.getKeyspaceName());
+
+ int keySize = mutation.key().remaining();
+ size += sizes.sizeof((short) keySize) + keySize;
+
+ size += sizes.sizeof(mutation.modifications.size());
+ for (Map.Entry<UUID,ColumnFamily> entry : mutation.modifications.entrySet())
+ size += ColumnFamily.serializer.serializedSize(entry.getValue(), TypeSizes.NATIVE, version);
+
+ return size;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/db/MutationVerbHandler.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/MutationVerbHandler.java b/src/java/org/apache/cassandra/db/MutationVerbHandler.java
new file mode 100644
index 0000000..43ffeae
--- /dev/null
+++ b/src/java/org/apache/cassandra/db/MutationVerbHandler.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cassandra.db;
+
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.net.InetAddress;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.cassandra.io.util.FastByteArrayInputStream;
+import org.apache.cassandra.net.*;
+import org.apache.cassandra.tracing.Tracing;
+
+public class MutationVerbHandler implements IVerbHandler<Mutation>
+{
+ private static final Logger logger = LoggerFactory.getLogger(MutationVerbHandler.class);
+
+ public void doVerb(MessageIn<Mutation> message, int id)
+ {
+ try
+ {
+ // Check if there were any forwarding headers in this message
+ byte[] from = message.parameters.get(Mutation.FORWARD_FROM);
+ InetAddress replyTo;
+ if (from == null)
+ {
+ replyTo = message.from;
+ byte[] forwardBytes = message.parameters.get(Mutation.FORWARD_TO);
+ if (forwardBytes != null)
+ forwardToLocalNodes(message.payload, message.verb, forwardBytes, message.from);
+ }
+ else
+ {
+ replyTo = InetAddress.getByAddress(from);
+ }
+
+ message.payload.apply();
+ WriteResponse response = new WriteResponse();
+ Tracing.trace("Enqueuing response to {}", replyTo);
+ MessagingService.instance().sendReply(response.createMessage(), id, replyTo);
+ }
+ catch (IOException e)
+ {
+ logger.error("Error in mutation", e);
+ }
+ }
+
+ /**
+ * Older version (< 1.0) will not send this message at all, hence we don't
+ * need to check the version of the data.
+ */
+ private void forwardToLocalNodes(Mutation mutation, MessagingService.Verb verb, byte[] forwardBytes, InetAddress from) throws IOException
+ {
+ DataInputStream in = new DataInputStream(new FastByteArrayInputStream(forwardBytes));
+ int size = in.readInt();
+
+ // tell the recipients who to send their ack to
+ MessageOut<Mutation> message = new MessageOut<>(verb, mutation, Mutation.serializer).withParameter(Mutation.FORWARD_FROM, from.getAddress());
+ // Send a message to each of the addresses on our Forward List
+ for (int i = 0; i < size; i++)
+ {
+ InetAddress address = CompactEndpointSerializationHelper.deserialize(in);
+ int id = in.readInt();
+ Tracing.trace("Enqueuing forwarded write to {}", address);
+ MessagingService.instance().sendOneWay(message, id, address);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/db/ReadRepairVerbHandler.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/ReadRepairVerbHandler.java b/src/java/org/apache/cassandra/db/ReadRepairVerbHandler.java
index fca4938..849ac70 100644
--- a/src/java/org/apache/cassandra/db/ReadRepairVerbHandler.java
+++ b/src/java/org/apache/cassandra/db/ReadRepairVerbHandler.java
@@ -21,12 +21,11 @@ import org.apache.cassandra.net.IVerbHandler;
import org.apache.cassandra.net.MessageIn;
import org.apache.cassandra.net.MessagingService;
-public class ReadRepairVerbHandler implements IVerbHandler<RowMutation>
+public class ReadRepairVerbHandler implements IVerbHandler<Mutation>
{
- public void doVerb(MessageIn<RowMutation> message, int id)
+ public void doVerb(MessageIn<Mutation> message, int id)
{
- RowMutation rm = message.payload;
- rm.apply();
+ message.payload.apply();
WriteResponse response = new WriteResponse();
MessagingService.instance().sendReply(response.createMessage(), id, message.from);
}
[3/4] Rename RowMutation->Mutation in preparation for Row->Partition
Posted by al...@apache.org.
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/db/RowMutation.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/RowMutation.java b/src/java/org/apache/cassandra/db/RowMutation.java
deleted file mode 100644
index c2c1780..0000000
--- a/src/java/org/apache/cassandra/db/RowMutation.java
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.cassandra.db;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.*;
-
-import org.apache.commons.lang3.StringUtils;
-
-import org.apache.cassandra.config.CFMetaData;
-import org.apache.cassandra.config.Schema;
-import org.apache.cassandra.db.composites.CellName;
-import org.apache.cassandra.db.composites.Composite;
-import org.apache.cassandra.io.IVersionedSerializer;
-import org.apache.cassandra.net.MessageOut;
-import org.apache.cassandra.net.MessagingService;
-import org.apache.cassandra.utils.ByteBufferUtil;
-
-// TODO convert this to a Builder pattern instead of encouraging RM.add directly,
-// which is less-efficient since we have to keep a mutable HashMap around
-public class RowMutation implements IMutation
-{
- public static final RowMutationSerializer serializer = new RowMutationSerializer();
- public static final String FORWARD_TO = "FWD_TO";
- public static final String FORWARD_FROM = "FWD_FRM";
-
- // todo this is redundant
- // when we remove it, also restore SerializationsTest.testRowMutationRead to not regenerate new RowMutations each test
- private final String keyspaceName;
-
- private final ByteBuffer key;
- // map of column family id to mutations for that column family.
- private final Map<UUID, ColumnFamily> modifications;
-
- public RowMutation(String keyspaceName, ByteBuffer key)
- {
- this(keyspaceName, key, new HashMap<UUID, ColumnFamily>());
- }
-
- public RowMutation(String keyspaceName, ByteBuffer key, ColumnFamily cf)
- {
- this(keyspaceName, key, Collections.singletonMap(cf.id(), cf));
- }
-
- public RowMutation(String keyspaceName, Row row)
- {
- this(keyspaceName, row.key.key, row.cf);
- }
-
- protected RowMutation(String keyspaceName, ByteBuffer key, Map<UUID, ColumnFamily> modifications)
- {
- this.keyspaceName = keyspaceName;
- this.key = key;
- this.modifications = modifications;
- }
-
- public RowMutation(ByteBuffer key, ColumnFamily cf)
- {
- this(cf.metadata().ksName, key, cf);
- }
-
- public String getKeyspaceName()
- {
- return keyspaceName;
- }
-
- public Collection<UUID> getColumnFamilyIds()
- {
- return modifications.keySet();
- }
-
- public ByteBuffer key()
- {
- return key;
- }
-
- public Collection<ColumnFamily> getColumnFamilies()
- {
- return modifications.values();
- }
-
- public ColumnFamily getColumnFamily(UUID cfId)
- {
- return modifications.get(cfId);
- }
-
- /*
- * Specify a column family name and the corresponding column
- * family object.
- * param @ cf - column family name
- * param @ columnFamily - the column family.
- */
- public void add(ColumnFamily columnFamily)
- {
- assert columnFamily != null;
- ColumnFamily prev = modifications.put(columnFamily.id(), columnFamily);
- if (prev != null)
- // developer error
- throw new IllegalArgumentException("ColumnFamily " + columnFamily + " already has modifications in this mutation: " + prev);
- }
-
- /**
- * @return the ColumnFamily in this RowMutation corresponding to @param cfName, creating an empty one if necessary.
- */
- public ColumnFamily addOrGet(String cfName)
- {
- return addOrGet(Schema.instance.getCFMetaData(keyspaceName, cfName));
- }
-
- public ColumnFamily addOrGet(CFMetaData cfm)
- {
- ColumnFamily cf = modifications.get(cfm.cfId);
- if (cf == null)
- {
- cf = TreeMapBackedSortedColumns.factory.create(cfm);
- modifications.put(cfm.cfId, cf);
- }
- return cf;
- }
-
- public boolean isEmpty()
- {
- return modifications.isEmpty();
- }
-
- public void add(String cfName, CellName name, ByteBuffer value, long timestamp, int timeToLive)
- {
- addOrGet(cfName).addColumn(name, value, timestamp, timeToLive);
- }
-
- public void addCounter(String cfName, CellName name, long value)
- {
- addOrGet(cfName).addCounter(name, value);
- }
-
- public void add(String cfName, CellName name, ByteBuffer value, long timestamp)
- {
- add(cfName, name, value, timestamp, 0);
- }
-
- public void delete(String cfName, long timestamp)
- {
- int localDeleteTime = (int) (System.currentTimeMillis() / 1000);
- addOrGet(cfName).delete(new DeletionInfo(timestamp, localDeleteTime));
- }
-
- public void delete(String cfName, CellName name, long timestamp)
- {
- int localDeleteTime = (int) (System.currentTimeMillis() / 1000);
- addOrGet(cfName).addTombstone(name, localDeleteTime, timestamp);
- }
-
- public void deleteRange(String cfName, Composite start, Composite end, long timestamp)
- {
- int localDeleteTime = (int) (System.currentTimeMillis() / 1000);
- addOrGet(cfName).addAtom(new RangeTombstone(start, end, timestamp, localDeleteTime));
- }
-
- public void addAll(IMutation m)
- {
- if (!(m instanceof RowMutation))
- throw new IllegalArgumentException();
-
- RowMutation rm = (RowMutation)m;
- if (!keyspaceName.equals(rm.keyspaceName) || !key.equals(rm.key))
- throw new IllegalArgumentException();
-
- for (Map.Entry<UUID, ColumnFamily> entry : rm.modifications.entrySet())
- {
- // It's slighty faster to assume the key wasn't present and fix if
- // not in the case where it wasn't there indeed.
- ColumnFamily cf = modifications.put(entry.getKey(), entry.getValue());
- if (cf != null)
- entry.getValue().resolve(cf);
- }
- }
-
- /*
- * This is equivalent to calling commit. Applies the changes to
- * to the keyspace that is obtained by calling Keyspace.open().
- */
- public void apply()
- {
- Keyspace ks = Keyspace.open(keyspaceName);
- ks.apply(this, ks.metadata.durableWrites);
- }
-
- public void applyUnsafe()
- {
- Keyspace.open(keyspaceName).apply(this, false);
- }
-
- public MessageOut<RowMutation> createMessage()
- {
- return createMessage(MessagingService.Verb.MUTATION);
- }
-
- public MessageOut<RowMutation> createMessage(MessagingService.Verb verb)
- {
- return new MessageOut<>(verb, this, serializer);
- }
-
- public String toString()
- {
- return toString(false);
- }
-
- public String toString(boolean shallow)
- {
- StringBuilder buff = new StringBuilder("RowMutation(");
- buff.append("keyspace='").append(keyspaceName).append('\'');
- buff.append(", key='").append(ByteBufferUtil.bytesToHex(key)).append('\'');
- buff.append(", modifications=[");
- if (shallow)
- {
- List<String> cfnames = new ArrayList<String>(modifications.size());
- for (UUID cfid : modifications.keySet())
- {
- CFMetaData cfm = Schema.instance.getCFMetaData(cfid);
- cfnames.add(cfm == null ? "-dropped-" : cfm.cfName);
- }
- buff.append(StringUtils.join(cfnames, ", "));
- }
- else
- buff.append(StringUtils.join(modifications.values(), ", "));
- return buff.append("])").toString();
- }
-
- public RowMutation without(UUID cfId)
- {
- RowMutation rm = new RowMutation(keyspaceName, key);
- for (Map.Entry<UUID, ColumnFamily> entry : modifications.entrySet())
- if (!entry.getKey().equals(cfId))
- rm.add(entry.getValue());
- return rm;
- }
-
- public static class RowMutationSerializer implements IVersionedSerializer<RowMutation>
- {
- public void serialize(RowMutation rm, DataOutput out, int version) throws IOException
- {
- if (version < MessagingService.VERSION_20)
- out.writeUTF(rm.getKeyspaceName());
-
- ByteBufferUtil.writeWithShortLength(rm.key(), out);
-
- /* serialize the modifications in the mutation */
- int size = rm.modifications.size();
- out.writeInt(size);
- assert size > 0;
- for (Map.Entry<UUID, ColumnFamily> entry : rm.modifications.entrySet())
- ColumnFamily.serializer.serialize(entry.getValue(), out, version);
- }
-
- public RowMutation deserialize(DataInput in, int version, ColumnSerializer.Flag flag) throws IOException
- {
- String keyspaceName = null; // will always be set from cf.metadata but javac isn't smart enough to see that
- if (version < MessagingService.VERSION_20)
- keyspaceName = in.readUTF();
-
- ByteBuffer key = ByteBufferUtil.readWithShortLength(in);
- int size = in.readInt();
- assert size > 0;
-
- Map<UUID, ColumnFamily> modifications;
- if (size == 1)
- {
- ColumnFamily cf = deserializeOneCf(in, version, flag);
- modifications = Collections.singletonMap(cf.id(), cf);
- keyspaceName = cf.metadata().ksName;
- }
- else
- {
- modifications = new HashMap<UUID, ColumnFamily>();
- for (int i = 0; i < size; ++i)
- {
- ColumnFamily cf = deserializeOneCf(in, version, flag);
- modifications.put(cf.id(), cf);
- keyspaceName = cf.metadata().ksName;
- }
- }
-
- return new RowMutation(keyspaceName, key, modifications);
- }
-
- private ColumnFamily deserializeOneCf(DataInput in, int version, ColumnSerializer.Flag flag) throws IOException
- {
- ColumnFamily cf = ColumnFamily.serializer.deserialize(in, UnsortedColumns.factory, flag, version);
- // We don't allow RowMutation with null column family, so we should never get null back.
- assert cf != null;
- return cf;
- }
-
- public RowMutation deserialize(DataInput in, int version) throws IOException
- {
- return deserialize(in, version, ColumnSerializer.Flag.FROM_REMOTE);
- }
-
- public long serializedSize(RowMutation rm, int version)
- {
- TypeSizes sizes = TypeSizes.NATIVE;
- int size = 0;
-
- if (version < MessagingService.VERSION_20)
- size += sizes.sizeof(rm.getKeyspaceName());
-
- int keySize = rm.key().remaining();
- size += sizes.sizeof((short) keySize) + keySize;
-
- size += sizes.sizeof(rm.modifications.size());
- for (Map.Entry<UUID,ColumnFamily> entry : rm.modifications.entrySet())
- size += ColumnFamily.serializer.serializedSize(entry.getValue(), TypeSizes.NATIVE, version);
-
- return size;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/db/RowMutationVerbHandler.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/RowMutationVerbHandler.java b/src/java/org/apache/cassandra/db/RowMutationVerbHandler.java
deleted file mode 100644
index dcdfc2e..0000000
--- a/src/java/org/apache/cassandra/db/RowMutationVerbHandler.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.cassandra.db;
-
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.net.InetAddress;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.cassandra.io.util.FastByteArrayInputStream;
-import org.apache.cassandra.net.*;
-import org.apache.cassandra.tracing.Tracing;
-
-public class RowMutationVerbHandler implements IVerbHandler<RowMutation>
-{
- private static final Logger logger = LoggerFactory.getLogger(RowMutationVerbHandler.class);
-
- public void doVerb(MessageIn<RowMutation> message, int id)
- {
- try
- {
- RowMutation rm = message.payload;
-
- // Check if there were any forwarding headers in this message
- byte[] from = message.parameters.get(RowMutation.FORWARD_FROM);
- InetAddress replyTo;
- if (from == null)
- {
- replyTo = message.from;
- byte[] forwardBytes = message.parameters.get(RowMutation.FORWARD_TO);
- if (forwardBytes != null)
- forwardToLocalNodes(rm, message.verb, forwardBytes, message.from);
- }
- else
- {
- replyTo = InetAddress.getByAddress(from);
- }
-
- rm.apply();
- WriteResponse response = new WriteResponse();
- Tracing.trace("Enqueuing response to {}", replyTo);
- MessagingService.instance().sendReply(response.createMessage(), id, replyTo);
- }
- catch (IOException e)
- {
- logger.error("Error in row mutation", e);
- }
- }
-
- /**
- * Older version (< 1.0) will not send this message at all, hence we don't
- * need to check the version of the data.
- */
- private void forwardToLocalNodes(RowMutation rm, MessagingService.Verb verb, byte[] forwardBytes, InetAddress from) throws IOException
- {
- DataInputStream in = new DataInputStream(new FastByteArrayInputStream(forwardBytes));
- int size = in.readInt();
-
- // tell the recipients who to send their ack to
- MessageOut<RowMutation> message = new MessageOut<RowMutation>(verb, rm, RowMutation.serializer).withParameter(RowMutation.FORWARD_FROM, from.getAddress());
- // Send a message to each of the addresses on our Forward List
- for (int i = 0; i < size; i++)
- {
- InetAddress address = CompactEndpointSerializationHelper.deserialize(in);
- int id = in.readInt();
- Tracing.trace("Enqueuing forwarded write to {}", address);
- MessagingService.instance().sendOneWay(message, id, address);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/db/SystemKeyspace.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/SystemKeyspace.java b/src/java/org/apache/cassandra/db/SystemKeyspace.java
index 57ae146..34acf4e 100644
--- a/src/java/org/apache/cassandra/db/SystemKeyspace.java
+++ b/src/java/org/apache/cassandra/db/SystemKeyspace.java
@@ -29,12 +29,6 @@ import com.google.common.collect.HashMultimap;
import com.google.common.collect.Iterables;
import com.google.common.collect.SetMultimap;
import com.google.common.collect.Sets;
-
-import org.apache.cassandra.db.compaction.CompactionHistoryTabularData;
-import org.apache.cassandra.db.composites.Composite;
-import org.apache.cassandra.db.composites.Composites;
-import org.apache.cassandra.metrics.RestorableMeter;
-import org.apache.cassandra.transport.Server;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -47,6 +41,9 @@ import org.apache.cassandra.cql3.QueryProcessor;
import org.apache.cassandra.cql3.UntypedResultSet;
import org.apache.cassandra.db.columniterator.IdentityQueryFilter;
import org.apache.cassandra.db.commitlog.ReplayPosition;
+import org.apache.cassandra.db.compaction.CompactionHistoryTabularData;
+import org.apache.cassandra.db.composites.Composite;
+import org.apache.cassandra.db.composites.Composites;
import org.apache.cassandra.db.filter.QueryFilter;
import org.apache.cassandra.db.marshal.*;
import org.apache.cassandra.dht.Range;
@@ -55,10 +52,12 @@ import org.apache.cassandra.exceptions.ConfigurationException;
import org.apache.cassandra.io.sstable.SSTableReader;
import org.apache.cassandra.io.util.DataOutputBuffer;
import org.apache.cassandra.locator.IEndpointSnitch;
+import org.apache.cassandra.metrics.RestorableMeter;
import org.apache.cassandra.service.StorageService;
import org.apache.cassandra.service.paxos.Commit;
import org.apache.cassandra.service.paxos.PaxosState;
import org.apache.cassandra.thrift.cassandraConstants;
+import org.apache.cassandra.transport.Server;
import org.apache.cassandra.utils.*;
import static org.apache.cassandra.cql3.QueryProcessor.processInternal;
@@ -597,15 +596,14 @@ public class SystemKeyspace
{
ColumnFamily cf = ArrayBackedSortedColumns.factory.create(Keyspace.SYSTEM_KS, INDEX_CF);
cf.addColumn(new Cell(cf.getComparator().makeCellName(indexName), ByteBufferUtil.EMPTY_BYTE_BUFFER, FBUtilities.timestampMicros()));
- RowMutation rm = new RowMutation(Keyspace.SYSTEM_KS, ByteBufferUtil.bytes(keyspaceName), cf);
- rm.apply();
+ new Mutation(Keyspace.SYSTEM_KS, ByteBufferUtil.bytes(keyspaceName), cf).apply();
}
public static void setIndexRemoved(String keyspaceName, String indexName)
{
- RowMutation rm = new RowMutation(Keyspace.SYSTEM_KS, ByteBufferUtil.bytes(keyspaceName));
- rm.delete(INDEX_CF, CFMetaData.IndexCf.comparator.makeCellName(indexName), FBUtilities.timestampMicros());
- rm.apply();
+ Mutation mutation = new Mutation(Keyspace.SYSTEM_KS, ByteBufferUtil.bytes(keyspaceName));
+ mutation.delete(INDEX_CF, CFMetaData.IndexCf.comparator.makeCellName(indexName), FBUtilities.timestampMicros());
+ mutation.apply();
}
/**
@@ -676,8 +674,7 @@ public class SystemKeyspace
ColumnFamily cf = ArrayBackedSortedColumns.factory.create(Keyspace.SYSTEM_KS, COUNTER_ID_CF);
cf.addColumn(new Cell(cf.getComparator().makeCellName(newCounterId.bytes()), ip, now));
- RowMutation rm = new RowMutation(Keyspace.SYSTEM_KS, ALL_LOCAL_NODE_ID_KEY, cf);
- rm.apply();
+ new Mutation(Keyspace.SYSTEM_KS, ALL_LOCAL_NODE_ID_KEY, cf).apply();
forceBlockingFlush(COUNTER_ID_CF);
}
@@ -736,9 +733,9 @@ public class SystemKeyspace
System.currentTimeMillis());
}
- public static Collection<RowMutation> serializeSchema()
+ public static Collection<Mutation> serializeSchema()
{
- Map<DecoratedKey, RowMutation> mutationMap = new HashMap<>();
+ Map<DecoratedKey, Mutation> mutationMap = new HashMap<>();
for (String cf : allSchemaCfs)
serializeSchema(mutationMap, cf);
@@ -746,17 +743,17 @@ public class SystemKeyspace
return mutationMap.values();
}
- private static void serializeSchema(Map<DecoratedKey, RowMutation> mutationMap, String schemaCfName)
+ private static void serializeSchema(Map<DecoratedKey, Mutation> mutationMap, String schemaCfName)
{
for (Row schemaRow : serializedSchema(schemaCfName))
{
if (Schema.ignoredSchemaRow(schemaRow))
continue;
- RowMutation mutation = mutationMap.get(schemaRow.key);
+ Mutation mutation = mutationMap.get(schemaRow.key);
if (mutation == null)
{
- mutation = new RowMutation(Keyspace.SYSTEM_KS, schemaRow.key.key);
+ mutation = new Mutation(Keyspace.SYSTEM_KS, schemaRow.key.key);
mutationMap.put(schemaRow.key, mutation);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/db/commitlog/CommitLog.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/commitlog/CommitLog.java b/src/java/org/apache/cassandra/db/commitlog/CommitLog.java
index 7240aee..b6b32a0 100644
--- a/src/java/org/apache/cassandra/db/commitlog/CommitLog.java
+++ b/src/java/org/apache/cassandra/db/commitlog/CommitLog.java
@@ -21,7 +21,6 @@ import java.io.*;
import java.lang.management.ManagementFactory;
import java.nio.ByteBuffer;
import java.util.*;
-import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import javax.management.MBeanServer;
@@ -188,13 +187,13 @@ public class CommitLog implements CommitLogMBean
}
/**
- * Add a RowMutation to the commit log.
+ * Add a Mutation to the commit log.
*
- * @param rowMutation the RowMutation to add to the log
+ * @param mutation the Mutation to add to the log
*/
- public void add(RowMutation rowMutation)
+ public void add(Mutation mutation)
{
- long size = RowMutation.serializer.serializedSize(rowMutation, MessagingService.current_version);
+ long size = Mutation.serializer.serializedSize(mutation, MessagingService.current_version);
long totalSize = size + ENTRY_OVERHEAD_SIZE;
if (totalSize > MAX_MUTATION_SIZE)
@@ -203,7 +202,7 @@ public class CommitLog implements CommitLogMBean
return;
}
- Allocation alloc = allocator.allocate(rowMutation, (int) totalSize, new Allocation());
+ Allocation alloc = allocator.allocate(mutation, (int) totalSize, new Allocation());
try
{
PureJavaCrc32 checksum = new PureJavaCrc32();
@@ -215,7 +214,7 @@ public class CommitLog implements CommitLogMBean
buffer.putLong(checksum.getValue());
// checksummed mutation
- RowMutation.serializer.serialize(rowMutation, dos, MessagingService.current_version);
+ Mutation.serializer.serialize(mutation, dos, MessagingService.current_version);
buffer.putLong(checksum.getValue());
}
catch (IOException e)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java b/src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java
index 5e8dc9b..00c8bb4 100644
--- a/src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java
+++ b/src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java
@@ -164,7 +164,7 @@ public class CommitLogReplayer
private abstract static class ReplayFilter
{
- public abstract Iterable<ColumnFamily> filter(RowMutation rm);
+ public abstract Iterable<ColumnFamily> filter(Mutation mutation);
public static ReplayFilter create()
{
@@ -193,9 +193,9 @@ public class CommitLogReplayer
private static class AlwaysReplayFilter extends ReplayFilter
{
- public Iterable<ColumnFamily> filter(RowMutation rm)
+ public Iterable<ColumnFamily> filter(Mutation mutation)
{
- return rm.getColumnFamilies();
+ return mutation.getColumnFamilies();
}
}
@@ -208,13 +208,13 @@ public class CommitLogReplayer
this.toReplay = toReplay;
}
- public Iterable<ColumnFamily> filter(RowMutation rm)
+ public Iterable<ColumnFamily> filter(Mutation mutation)
{
- final Collection<String> cfNames = toReplay.get(rm.getKeyspaceName());
+ final Collection<String> cfNames = toReplay.get(mutation.getKeyspaceName());
if (cfNames == null)
return Collections.emptySet();
- return Iterables.filter(rm.getColumnFamilies(), new Predicate<ColumnFamily>()
+ return Iterables.filter(mutation.getColumnFamilies(), new Predicate<ColumnFamily>()
{
public boolean apply(ColumnFamily cf)
{
@@ -264,7 +264,7 @@ public class CommitLogReplayer
reader.seek(offset);
- /* read the logs populate RowMutation and apply */
+ /* read the logs populate Mutation and apply */
while (reader.getPosition() < end && !reader.isEOF())
{
if (logger.isDebugEnabled())
@@ -282,7 +282,7 @@ public class CommitLogReplayer
break main;
}
- // RowMutation must be at LEAST 10 bytes:
+ // Mutation must be at LEAST 10 bytes:
// 3 each for a non-empty Keyspace and Key (including the
// 2-byte length from writeUTF/writeWithShortLength) and 4 bytes for column count.
// This prevents CRC by being fooled by special-case garbage in the file; see CASSANDRA-2128
@@ -320,14 +320,14 @@ public class CommitLogReplayer
/* deserialize the commit log entry */
FastByteArrayInputStream bufIn = new FastByteArrayInputStream(buffer, 0, serializedSize);
- final RowMutation rm;
+ final Mutation mutation;
try
{
// assuming version here. We've gone to lengths to make sure what gets written to the CL is in
// the current version. so do make sure the CL is drained prior to upgrading a node.
- rm = RowMutation.serializer.deserialize(new DataInputStream(bufIn), version, ColumnSerializer.Flag.LOCAL);
+ mutation = Mutation.serializer.deserialize(new DataInputStream(bufIn), version, ColumnSerializer.Flag.LOCAL);
// doublecheck that what we read is [still] valid for the current schema
- for (ColumnFamily cf : rm.getColumnFamilies())
+ for (ColumnFamily cf : mutation.getColumnFamilies())
for (Cell cell : cf)
cf.getComparator().validate(cell.name());
}
@@ -364,27 +364,27 @@ public class CommitLogReplayer
}
if (logger.isDebugEnabled())
- logger.debug("replaying mutation for {}.{}: {}", rm.getKeyspaceName(), ByteBufferUtil.bytesToHex(rm.key()), "{" + StringUtils.join(rm.getColumnFamilies().iterator(), ", ") + "}");
+ logger.debug("replaying mutation for {}.{}: {}", mutation.getKeyspaceName(), ByteBufferUtil.bytesToHex(mutation.key()), "{" + StringUtils.join(mutation.getColumnFamilies().iterator(), ", ") + "}");
final long entryLocation = reader.getFilePointer();
Runnable runnable = new WrappedRunnable()
{
public void runMayThrow() throws IOException
{
- if (Schema.instance.getKSMetaData(rm.getKeyspaceName()) == null)
+ if (Schema.instance.getKSMetaData(mutation.getKeyspaceName()) == null)
return;
- if (pointInTimeExceeded(rm))
+ if (pointInTimeExceeded(mutation))
return;
- final Keyspace keyspace = Keyspace.open(rm.getKeyspaceName());
+ final Keyspace keyspace = Keyspace.open(mutation.getKeyspaceName());
- // Rebuild the row mutation, omitting column families that
+ // Rebuild the mutation, omitting column families that
// a) the user has requested that we ignore,
// b) have already been flushed,
// or c) are part of a cf that was dropped.
// Keep in mind that the cf.name() is suspect. do every thing based on the cfid instead.
- RowMutation newRm = null;
- for (ColumnFamily columnFamily : replayFilter.filter(rm))
+ Mutation newMutation = null;
+ for (ColumnFamily columnFamily : replayFilter.filter(mutation))
{
if (Schema.instance.getCF(columnFamily.id()) == null)
continue; // dropped
@@ -395,16 +395,16 @@ public class CommitLogReplayer
// if it is the last known segment, if we are after the replay position
if (segmentId > rp.segment || (segmentId == rp.segment && entryLocation > rp.position))
{
- if (newRm == null)
- newRm = new RowMutation(rm.getKeyspaceName(), rm.key());
- newRm.add(columnFamily);
+ if (newMutation == null)
+ newMutation = new Mutation(mutation.getKeyspaceName(), mutation.key());
+ newMutation.add(columnFamily);
replayedCount.incrementAndGet();
}
}
- if (newRm != null)
+ if (newMutation != null)
{
- assert !newRm.isEmpty();
- Keyspace.open(newRm.getKeyspaceName()).apply(newRm, false);
+ assert !newMutation.isEmpty();
+ Keyspace.open(newMutation.getKeyspaceName()).apply(newMutation, false);
keyspacesRecovered.add(keyspace);
}
}
@@ -431,11 +431,11 @@ public class CommitLogReplayer
}
}
- protected boolean pointInTimeExceeded(RowMutation frm)
+ protected boolean pointInTimeExceeded(Mutation fm)
{
long restoreTarget = CommitLog.instance.archiver.restorePointInTime;
- for (ColumnFamily families : frm.getColumnFamilies())
+ for (ColumnFamily families : fm.getColumnFamilies())
{
if (CommitLog.instance.archiver.precision.toMillis(families.maxTimestamp()) > restoreTarget)
return true;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java b/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
index bc5c7d1..9c80965 100644
--- a/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
+++ b/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
@@ -46,14 +46,14 @@ import org.apache.cassandra.config.CFMetaData;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.config.Schema;
import org.apache.cassandra.db.ColumnFamily;
-import org.apache.cassandra.db.RowMutation;
+import org.apache.cassandra.db.Mutation;
import org.apache.cassandra.io.FSWriteError;
import org.apache.cassandra.io.util.FileUtils;
import org.apache.cassandra.utils.PureJavaCrc32;
import org.apache.cassandra.utils.WaitQueue;
/*
- * A single commit log file on disk. Manages creation of the file and writing row mutations to disk,
+ * A single commit log file on disk. Manages creation of the file and writing mutations to disk,
* as well as tracking the last mutation position of any "dirty" CFs covered by the segment file. Segment
* files are initially allocated to a fixed size and can grow to accomidate a larger value if necessary.
*/
@@ -166,11 +166,11 @@ public class CommitLogSegment
}
/**
- * allocate space in this buffer for the provided row mutation, and populate the provided
+ * allocate space in this buffer for the provided mutation, and populate the provided
* Allocation object, returning true on success. False indicates there is not enough room in
* this segment, and a new segment is needed
*/
- boolean allocate(RowMutation rowMutation, int size, Allocation alloc)
+ boolean allocate(Mutation mutation, int size, Allocation alloc)
{
final AppendLock appendLock = lockForAppend();
try
@@ -185,7 +185,7 @@ public class CommitLogSegment
alloc.position = position;
alloc.segment = this;
alloc.appendLock = appendLock;
- markDirty(rowMutation, position);
+ markDirty(mutation, position);
return true;
}
catch (Throwable t)
@@ -386,9 +386,9 @@ public class CommitLogSegment
}
}
- void markDirty(RowMutation rowMutation, int allocatedPosition)
+ void markDirty(Mutation mutation, int allocatedPosition)
{
- for (ColumnFamily columnFamily : rowMutation.getColumnFamilies())
+ for (ColumnFamily columnFamily : mutation.getColumnFamilies())
{
// check for deleted CFS
CFMetaData cfm = columnFamily.metadata();
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManager.java b/src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManager.java
index dd96f35..4275362 100644
--- a/src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManager.java
+++ b/src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManager.java
@@ -29,7 +29,6 @@ import java.util.UUID;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;
import java.util.concurrent.LinkedBlockingQueue;
@@ -44,7 +43,7 @@ import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.config.Schema;
import org.apache.cassandra.db.ColumnFamilyStore;
import org.apache.cassandra.db.Keyspace;
-import org.apache.cassandra.db.RowMutation;
+import org.apache.cassandra.db.Mutation;
import org.apache.cassandra.io.util.FileUtils;
import org.apache.cassandra.net.MessagingService;
import org.apache.cassandra.service.StorageService;
@@ -168,16 +167,16 @@ public class CommitLogSegmentManager
}
/**
- * Reserve space in the current segment for the provided row mutation or, if there isn't space available,
+ * Reserve space in the current segment for the provided mutation or, if there isn't space available,
* create a new segment.
*
* @return the provided Allocation object
*/
- public Allocation allocate(RowMutation rowMutation, int size, Allocation alloc)
+ public Allocation allocate(Mutation mutation, int size, Allocation alloc)
{
CommitLogSegment segment = allocatingFrom();
- while (!segment.allocate(rowMutation, size, alloc))
+ while (!segment.allocate(mutation, size, alloc))
{
// failed to allocate, so move to a new segment with enough room
advanceAllocatingFrom(segment);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/net/MessagingService.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/net/MessagingService.java b/src/java/org/apache/cassandra/net/MessagingService.java
index b0e554d..894a29c 100644
--- a/src/java/org/apache/cassandra/net/MessagingService.java
+++ b/src/java/org/apache/cassandra/net/MessagingService.java
@@ -189,8 +189,8 @@ public final class MessagingService implements MessagingServiceMBean
put(Verb.REQUEST_RESPONSE, CallbackDeterminedSerializer.instance);
put(Verb.INTERNAL_RESPONSE, CallbackDeterminedSerializer.instance);
- put(Verb.MUTATION, RowMutation.serializer);
- put(Verb.READ_REPAIR, RowMutation.serializer);
+ put(Verb.MUTATION, Mutation.serializer);
+ put(Verb.READ_REPAIR, Mutation.serializer);
put(Verb.READ, ReadCommand.serializer);
put(Verb.RANGE_SLICE, RangeSliceCommand.serializer);
put(Verb.PAGED_RANGE, PagedRangeCommand.serializer);
@@ -334,8 +334,8 @@ public final class MessagingService implements MessagingServiceMBean
if (expiredCallbackInfo.shouldHint())
{
- RowMutation rm = (RowMutation) ((WriteCallbackInfo) expiredCallbackInfo).sentMessage.payload;
- return StorageProxy.submitHint(rm, expiredCallbackInfo.target, null);
+ Mutation mutation = (Mutation) ((WriteCallbackInfo) expiredCallbackInfo).sentMessage.payload;
+ return StorageProxy.submitHint(mutation, expiredCallbackInfo.target, null);
}
return null;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/service/MigrationManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/MigrationManager.java b/src/java/org/apache/cassandra/service/MigrationManager.java
index e4740ae..e308613 100644
--- a/src/java/org/apache/cassandra/service/MigrationManager.java
+++ b/src/java/org/apache/cassandra/service/MigrationManager.java
@@ -299,21 +299,21 @@ public class MigrationManager implements IEndpointStateChangeSubscriber
* actively announce a new version to active hosts via rpc
* @param schema The schema mutation to be applied
*/
- private static void announce(RowMutation schema)
+ private static void announce(Mutation schema)
{
FBUtilities.waitOnFuture(announce(Collections.singletonList(schema)));
}
- private static void pushSchemaMutation(InetAddress endpoint, Collection<RowMutation> schema)
+ private static void pushSchemaMutation(InetAddress endpoint, Collection<Mutation> schema)
{
- MessageOut<Collection<RowMutation>> msg = new MessageOut<>(MessagingService.Verb.DEFINITIONS_UPDATE,
- schema,
- MigrationsSerializer.instance);
+ MessageOut<Collection<Mutation>> msg = new MessageOut<>(MessagingService.Verb.DEFINITIONS_UPDATE,
+ schema,
+ MigrationsSerializer.instance);
MessagingService.instance().sendOneWay(msg, endpoint);
}
// Returns a future on the local application of the schema
- private static Future<?> announce(final Collection<RowMutation> schema)
+ private static Future<?> announce(final Collection<Mutation> schema)
{
Future<?> f = StageManager.getStage(Stage.MIGRATION).submit(new WrappedRunnable()
{
@@ -386,33 +386,33 @@ public class MigrationManager implements IEndpointStateChangeSubscriber
logger.info("Local schema reset is complete.");
}
- public static class MigrationsSerializer implements IVersionedSerializer<Collection<RowMutation>>
+ public static class MigrationsSerializer implements IVersionedSerializer<Collection<Mutation>>
{
public static MigrationsSerializer instance = new MigrationsSerializer();
- public void serialize(Collection<RowMutation> schema, DataOutput out, int version) throws IOException
+ public void serialize(Collection<Mutation> schema, DataOutput out, int version) throws IOException
{
out.writeInt(schema.size());
- for (RowMutation rm : schema)
- RowMutation.serializer.serialize(rm, out, version);
+ for (Mutation mutation : schema)
+ Mutation.serializer.serialize(mutation, out, version);
}
- public Collection<RowMutation> deserialize(DataInput in, int version) throws IOException
+ public Collection<Mutation> deserialize(DataInput in, int version) throws IOException
{
int count = in.readInt();
- Collection<RowMutation> schema = new ArrayList<RowMutation>(count);
+ Collection<Mutation> schema = new ArrayList<Mutation>(count);
for (int i = 0; i < count; i++)
- schema.add(RowMutation.serializer.deserialize(in, version));
+ schema.add(Mutation.serializer.deserialize(in, version));
return schema;
}
- public long serializedSize(Collection<RowMutation> schema, int version)
+ public long serializedSize(Collection<Mutation> schema, int version)
{
int size = TypeSizes.NATIVE.sizeof(schema.size());
- for (RowMutation rm : schema)
- size += RowMutation.serializer.serializedSize(rm, version);
+ for (Mutation mutation : schema)
+ size += Mutation.serializer.serializedSize(mutation, version);
return size;
}
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/service/MigrationTask.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/MigrationTask.java b/src/java/org/apache/cassandra/service/MigrationTask.java
index 93572f0..9fdbff4 100644
--- a/src/java/org/apache/cassandra/service/MigrationTask.java
+++ b/src/java/org/apache/cassandra/service/MigrationTask.java
@@ -24,9 +24,9 @@ import java.util.Collection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.apache.cassandra.db.Mutation;
import org.apache.cassandra.exceptions.ConfigurationException;
import org.apache.cassandra.db.DefsTables;
-import org.apache.cassandra.db.RowMutation;
import org.apache.cassandra.gms.FailureDetector;
import org.apache.cassandra.net.IAsyncCallback;
import org.apache.cassandra.net.MessageIn;
@@ -56,10 +56,10 @@ class MigrationTask extends WrappedRunnable
return;
}
- IAsyncCallback<Collection<RowMutation>> cb = new IAsyncCallback<Collection<RowMutation>>()
+ IAsyncCallback<Collection<Mutation>> cb = new IAsyncCallback<Collection<Mutation>>()
{
@Override
- public void response(MessageIn<Collection<RowMutation>> message)
+ public void response(MessageIn<Collection<Mutation>> message)
{
try
{
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/service/RowDataResolver.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/RowDataResolver.java b/src/java/org/apache/cassandra/service/RowDataResolver.java
index f1948cd..5422d82 100644
--- a/src/java/org/apache/cassandra/service/RowDataResolver.java
+++ b/src/java/org/apache/cassandra/service/RowDataResolver.java
@@ -115,13 +115,12 @@ public class RowDataResolver extends AbstractRowResolver
if (diffCf == null) // no repair needs to happen
continue;
- // create and send the row mutation message based on the diff
- RowMutation rowMutation = new RowMutation(keyspaceName, key.key, diffCf);
- MessageOut repairMessage;
+ // create and send the mutation message based on the diff
+ Mutation mutation = new Mutation(keyspaceName, key.key, diffCf);
// use a separate verb here because we don't want these to be get the white glove hint-
// on-timeout behavior that a "real" mutation gets
- repairMessage = rowMutation.createMessage(MessagingService.Verb.READ_REPAIR);
- results.add(MessagingService.instance().sendRR(repairMessage, endpoints.get(i)));
+ results.add(MessagingService.instance().sendRR(mutation.createMessage(MessagingService.Verb.READ_REPAIR),
+ endpoints.get(i)));
}
return results;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/service/StorageProxy.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/StorageProxy.java b/src/java/org/apache/cassandra/service/StorageProxy.java
index 49aa2be..4113029 100644
--- a/src/java/org/apache/cassandra/service/StorageProxy.java
+++ b/src/java/org/apache/cassandra/service/StorageProxy.java
@@ -122,8 +122,8 @@ public class StorageProxy implements StorageProxyMBean
ConsistencyLevel consistency_level)
throws OverloadedException
{
- assert mutation instanceof RowMutation;
- sendToHintedEndpoints((RowMutation) mutation, targets, responseHandler, localDataCenter);
+ assert mutation instanceof Mutation;
+ sendToHintedEndpoints((Mutation) mutation, targets, responseHandler, localDataCenter);
}
};
@@ -537,7 +537,7 @@ public class StorageProxy implements StorageProxyMBean
List<InetAddress> naturalEndpoints = StorageService.instance.getNaturalEndpoints(mutation.getKeyspaceName(), tk);
Collection<InetAddress> pendingEndpoints = StorageService.instance.getTokenMetadata().pendingEndpointsFor(tk, mutation.getKeyspaceName());
for (InetAddress target : Iterables.concat(naturalEndpoints, pendingEndpoints))
- submitHint((RowMutation) mutation, target, null);
+ submitHint((Mutation) mutation, target, null);
}
Tracing.trace("Wrote hint to satisfy CL.ANY after no replicas acknowledged the write");
}
@@ -571,10 +571,10 @@ public class StorageProxy implements StorageProxyMBean
public static void mutateWithTriggers(Collection<? extends IMutation> mutations, ConsistencyLevel consistencyLevel, boolean mutateAtomically) throws WriteTimeoutException, UnavailableException,
OverloadedException, InvalidRequestException
{
- Collection<RowMutation> tmutations = TriggerExecutor.instance.execute(mutations);
+ Collection<Mutation> tmutations = TriggerExecutor.instance.execute(mutations);
if (mutateAtomically || tmutations != null)
{
- Collection<RowMutation> allMutations = (Collection<RowMutation>) mutations;
+ Collection<Mutation> allMutations = (Collection<Mutation>) mutations;
if (tmutations != null)
allMutations.addAll(tmutations);
StorageProxy.mutateAtomically(allMutations, consistencyLevel);
@@ -591,10 +591,10 @@ public class StorageProxy implements StorageProxyMBean
* write the entire batch to a batchlog elsewhere in the cluster.
* After: remove the batchlog entry (after writing hints for the batch rows, if necessary).
*
- * @param mutations the RowMutations to be applied across the replicas
+ * @param mutations the Mutations to be applied across the replicas
* @param consistency_level the consistency level for the operation
*/
- public static void mutateAtomically(Collection<RowMutation> mutations, ConsistencyLevel consistency_level)
+ public static void mutateAtomically(Collection<Mutation> mutations, ConsistencyLevel consistency_level)
throws UnavailableException, OverloadedException, WriteTimeoutException
{
Tracing.trace("Determining replicas for atomic batch");
@@ -606,7 +606,7 @@ public class StorageProxy implements StorageProxyMBean
try
{
// add a handler for each mutation - includes checking availability, but doesn't initiate any writes, yet
- for (RowMutation mutation : mutations)
+ for (Mutation mutation : mutations)
{
WriteResponseHandlerWrapper wrapper = wrapResponseHandler(mutation, consistency_level, WriteType.BATCH);
// exit early if we can't fulfill the CL at this time.
@@ -645,17 +645,16 @@ public class StorageProxy implements StorageProxyMBean
}
}
- private static void syncWriteToBatchlog(Collection<RowMutation> mutations, Collection<InetAddress> endpoints, UUID uuid)
+ private static void syncWriteToBatchlog(Collection<Mutation> mutations, Collection<InetAddress> endpoints, UUID uuid)
throws WriteTimeoutException
{
- RowMutation rm = BatchlogManager.getBatchlogMutationFor(mutations, uuid);
AbstractWriteResponseHandler handler = new WriteResponseHandler(endpoints,
Collections.<InetAddress>emptyList(),
ConsistencyLevel.ONE,
Keyspace.open(Keyspace.SYSTEM_KS),
null,
WriteType.BATCH_LOG);
- updateBatchlog(rm, endpoints, handler);
+ updateBatchlog(BatchlogManager.getBatchlogMutationFor(mutations, uuid), endpoints, handler);
handler.get();
}
@@ -669,20 +668,19 @@ public class StorageProxy implements StorageProxyMBean
Keyspace.open(Keyspace.SYSTEM_KS),
null,
WriteType.SIMPLE);
- RowMutation rm = new RowMutation(Keyspace.SYSTEM_KS, UUIDType.instance.decompose(uuid), cf);
- updateBatchlog(rm, endpoints, handler);
+ updateBatchlog(new Mutation(Keyspace.SYSTEM_KS, UUIDType.instance.decompose(uuid), cf), endpoints, handler);
}
- private static void updateBatchlog(RowMutation rm, Collection<InetAddress> endpoints, AbstractWriteResponseHandler handler)
+ private static void updateBatchlog(Mutation mutation, Collection<InetAddress> endpoints, AbstractWriteResponseHandler handler)
{
if (endpoints.contains(FBUtilities.getBroadcastAddress()))
{
assert endpoints.size() == 1;
- insertLocal(rm, handler);
+ insertLocal(mutation, handler);
}
else
{
- MessageOut<RowMutation> message = rm.createMessage();
+ MessageOut<Mutation> message = mutation.createMessage();
for (InetAddress target : endpoints)
MessagingService.instance().sendRR(message, target, handler);
}
@@ -744,7 +742,7 @@ public class StorageProxy implements StorageProxyMBean
}
// same as above except does not initiate writes (but does perform availability checks).
- private static WriteResponseHandlerWrapper wrapResponseHandler(RowMutation mutation, ConsistencyLevel consistency_level, WriteType writeType)
+ private static WriteResponseHandlerWrapper wrapResponseHandler(Mutation mutation, ConsistencyLevel consistency_level, WriteType writeType)
{
AbstractReplicationStrategy rs = Keyspace.open(mutation.getKeyspaceName()).getReplicationStrategy();
String keyspaceName = mutation.getKeyspaceName();
@@ -759,9 +757,9 @@ public class StorageProxy implements StorageProxyMBean
private static class WriteResponseHandlerWrapper
{
final AbstractWriteResponseHandler handler;
- final RowMutation mutation;
+ final Mutation mutation;
- WriteResponseHandlerWrapper(AbstractWriteResponseHandler handler, RowMutation mutation)
+ WriteResponseHandlerWrapper(AbstractWriteResponseHandler handler, Mutation mutation)
{
this.handler = handler;
this.mutation = mutation;
@@ -823,7 +821,7 @@ public class StorageProxy implements StorageProxyMBean
*
* @throws OverloadedException if the hints cannot be written/enqueued
*/
- public static void sendToHintedEndpoints(final RowMutation rm,
+ public static void sendToHintedEndpoints(final Mutation mutation,
Iterable<InetAddress> targets,
AbstractWriteResponseHandler responseHandler,
String localDataCenter)
@@ -832,7 +830,7 @@ public class StorageProxy implements StorageProxyMBean
// extra-datacenter replicas, grouped by dc
Map<String, Collection<InetAddress>> dcGroups = null;
// only need to create a Message for non-local writes
- MessageOut<RowMutation> message = null;
+ MessageOut<Mutation> message = null;
for (InetAddress destination : targets)
{
@@ -851,13 +849,13 @@ public class StorageProxy implements StorageProxyMBean
{
if (destination.equals(FBUtilities.getBroadcastAddress()) && OPTIMIZE_LOCAL_REQUESTS)
{
- insertLocal(rm, responseHandler);
+ insertLocal(mutation, responseHandler);
}
else
{
// belongs on a different server
if (message == null)
- message = rm.createMessage();
+ message = mutation.createMessage();
String dc = DatabaseDescriptor.getEndpointSnitch().getDatacenter(destination);
// direct writes to local DC or old Cassandra versions
// (1.1 knows how to forward old-style String message IDs; updated to int in 2.0)
@@ -885,7 +883,7 @@ public class StorageProxy implements StorageProxyMBean
continue;
// Schedule a local hint
- submitHint(rm, destination, responseHandler);
+ submitHint(mutation, destination, responseHandler);
}
}
@@ -893,7 +891,7 @@ public class StorageProxy implements StorageProxyMBean
{
// for each datacenter, send the message to one node to relay the write to other replicas
if (message == null)
- message = rm.createMessage();
+ message = mutation.createMessage();
for (Collection<InetAddress> dcTargets : dcGroups.values())
sendMessagesToNonlocalDC(message, dcTargets, responseHandler);
@@ -912,7 +910,7 @@ public class StorageProxy implements StorageProxyMBean
}
}
- public static Future<Void> submitHint(final RowMutation mutation,
+ public static Future<Void> submitHint(final Mutation mutation,
final InetAddress target,
final AbstractWriteResponseHandler responseHandler)
{
@@ -949,7 +947,7 @@ public class StorageProxy implements StorageProxyMBean
return (Future<Void>) StageManager.getStage(Stage.MUTATION).submit(runnable);
}
- public static void writeHintForMutation(RowMutation mutation, int ttl, InetAddress target)
+ public static void writeHintForMutation(Mutation mutation, int ttl, InetAddress target)
{
assert ttl > 0;
UUID hostId = StorageService.instance.getTokenMetadata().getHostId(target);
@@ -976,7 +974,7 @@ public class StorageProxy implements StorageProxyMBean
out.writeInt(id);
logger.trace("Adding FWD message to {}@{}", id, destination);
}
- message = message.withParameter(RowMutation.FORWARD_TO, out.getData());
+ message = message.withParameter(Mutation.FORWARD_TO, out.getData());
// send the combined message + forward headers
int id = MessagingService.instance().sendRR(message, target, handler);
logger.trace("Sending message to {}@{}", id, target);
@@ -988,13 +986,13 @@ public class StorageProxy implements StorageProxyMBean
}
}
- private static void insertLocal(final RowMutation rm, final AbstractWriteResponseHandler responseHandler)
+ private static void insertLocal(final Mutation mutation, final AbstractWriteResponseHandler responseHandler)
{
StageManager.getStage(Stage.MUTATION).execute(new LocalMutationRunnable()
{
public void runMayThrow()
{
- IMutation processed = SinkManager.processWriteRequest(rm);
+ IMutation processed = SinkManager.processWriteRequest(mutation);
if (processed != null)
{
processed.apply();
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/service/StorageService.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/StorageService.java b/src/java/org/apache/cassandra/service/StorageService.java
index d088b42..ab095e6 100644
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@ -222,7 +222,7 @@ public class StorageService extends NotificationBroadcasterSupport implements IE
}
/* register the verb handlers */
- MessagingService.instance().registerVerbHandlers(MessagingService.Verb.MUTATION, new RowMutationVerbHandler());
+ MessagingService.instance().registerVerbHandlers(MessagingService.Verb.MUTATION, new MutationVerbHandler());
MessagingService.instance().registerVerbHandlers(MessagingService.Verb.READ_REPAIR, new ReadRepairVerbHandler());
MessagingService.instance().registerVerbHandlers(MessagingService.Verb.READ, new ReadVerbHandler());
MessagingService.instance().registerVerbHandlers(MessagingService.Verb.RANGE_SLICE, new RangeSliceVerbHandler());
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/service/paxos/Commit.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/paxos/Commit.java b/src/java/org/apache/cassandra/service/paxos/Commit.java
index 1f95d04..23f35db 100644
--- a/src/java/org/apache/cassandra/service/paxos/Commit.java
+++ b/src/java/org/apache/cassandra/service/paxos/Commit.java
@@ -30,12 +30,7 @@ import java.nio.ByteBuffer;
import com.google.common.base.Objects;
import org.apache.cassandra.config.CFMetaData;
-import org.apache.cassandra.db.Cell;
-import org.apache.cassandra.db.ColumnFamily;
-import org.apache.cassandra.db.ColumnSerializer;
-import org.apache.cassandra.db.EmptyColumns;
-import org.apache.cassandra.db.RowMutation;
-import org.apache.cassandra.db.UnsortedColumns;
+import org.apache.cassandra.db.*;
import org.apache.cassandra.io.IVersionedSerializer;
import org.apache.cassandra.utils.ByteBufferUtil;
import org.apache.cassandra.utils.UUIDGen;
@@ -85,10 +80,10 @@ public class Commit
return this.ballot.equals(ballot);
}
- public RowMutation makeMutation()
+ public Mutation makeMutation()
{
assert update != null;
- return new RowMutation(key, update);
+ return new Mutation(key, update);
}
@Override
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/service/paxos/PaxosState.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/paxos/PaxosState.java b/src/java/org/apache/cassandra/service/paxos/PaxosState.java
index ff0b02c..f893acf 100644
--- a/src/java/org/apache/cassandra/service/paxos/PaxosState.java
+++ b/src/java/org/apache/cassandra/service/paxos/PaxosState.java
@@ -27,7 +27,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.cassandra.config.CFMetaData;
-import org.apache.cassandra.db.RowMutation;
+import org.apache.cassandra.db.Mutation;
import org.apache.cassandra.db.Keyspace;
import org.apache.cassandra.db.SystemKeyspace;
import org.apache.cassandra.tracing.Tracing;
@@ -114,8 +114,8 @@ public class PaxosState
// if our current in-progress ballot is strictly greater than the proposal one, we shouldn't
// erase the in-progress update.
Tracing.trace("Committing proposal {}", proposal);
- RowMutation rm = proposal.makeMutation();
- Keyspace.open(rm.getKeyspaceName()).apply(rm, true);
+ Mutation mutation = proposal.makeMutation();
+ Keyspace.open(mutation.getKeyspaceName()).apply(mutation, true);
// We don't need to lock, we're just blindly updating
SystemKeyspace.savePaxosCommit(proposal);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/sink/IRequestSink.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/sink/IRequestSink.java b/src/java/org/apache/cassandra/sink/IRequestSink.java
index 8d68ce8..2873e46 100644
--- a/src/java/org/apache/cassandra/sink/IRequestSink.java
+++ b/src/java/org/apache/cassandra/sink/IRequestSink.java
@@ -22,9 +22,9 @@ import org.apache.cassandra.db.IMutation;
public interface IRequestSink
{
/**
- * Transform or drop a write request (represented by a RowMutation).
+ * Transform or drop a write request (represented by a Mutation).
*
- * @param mutation the RowMutation to be applied locally.
+ * @param mutation the Mutation to be applied locally.
* @return null if the mutation is to be dropped, or the transformed mutation to apply, which may be just
* the original mutation.
*/
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/thrift/CassandraServer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/thrift/CassandraServer.java b/src/java/org/apache/cassandra/thrift/CassandraServer.java
index 0e512bd..e91bea2 100644
--- a/src/java/org/apache/cassandra/thrift/CassandraServer.java
+++ b/src/java/org/apache/cassandra/thrift/CassandraServer.java
@@ -659,7 +659,7 @@ public class CassandraServer implements Cassandra.Iface
ThriftValidation.validateColumnNames(metadata, column_parent, Arrays.asList(column.name));
ThriftValidation.validateColumnData(metadata, column_parent.super_column, column);
- RowMutation rm;
+ org.apache.cassandra.db.Mutation mutation;
try
{
CellName name = metadata.isSuper()
@@ -668,13 +668,13 @@ public class CassandraServer implements Cassandra.Iface
ColumnFamily cf = ArrayBackedSortedColumns.factory.create(cState.getKeyspace(), column_parent.column_family);
cf.addColumn(name, column.value, column.timestamp, column.ttl);
- rm = new RowMutation(cState.getKeyspace(), key, cf);
+ mutation = new org.apache.cassandra.db.Mutation(cState.getKeyspace(), key, cf);
}
catch (MarshalException e)
{
throw new org.apache.cassandra.exceptions.InvalidRequestException(e.getMessage());
}
- doInsert(consistency_level, Arrays.asList(rm));
+ doInsert(consistency_level, Arrays.asList(mutation));
}
public void insert(ByteBuffer key, ColumnParent column_parent, Column column, ConsistencyLevel consistency_level)
@@ -805,7 +805,7 @@ public class CassandraServer implements Cassandra.Iface
boolean allowCounterMutations)
throws RequestValidationException
{
- List<IMutation> rowMutations = new ArrayList<IMutation>();
+ List<IMutation> mutations = new ArrayList<>();
ThriftClientState cState = state();
String keyspace = cState.getKeyspace();
@@ -813,10 +813,10 @@ public class CassandraServer implements Cassandra.Iface
{
ByteBuffer key = mutationEntry.getKey();
- // We need to separate row mutation for standard cf and counter cf (that will be encapsulated in a
+ // We need to separate mutation for standard cf and counter cf (that will be encapsulated in a
// CounterMutation) because it doesn't follow the same code path
- RowMutation rmStandard = null;
- RowMutation rmCounter = null;
+ org.apache.cassandra.db.Mutation standardMutation = null;
+ org.apache.cassandra.db.Mutation counterMutation = null;
Map<String, List<Mutation>> columnFamilyToMutations = mutationEntry.getValue();
for (Map.Entry<String, List<Mutation>> columnFamilyMutations : columnFamilyToMutations.entrySet())
@@ -828,112 +828,112 @@ public class CassandraServer implements Cassandra.Iface
CFMetaData metadata = ThriftValidation.validateColumnFamily(keyspace, cfName);
ThriftValidation.validateKey(metadata, key);
- RowMutation rm;
+ org.apache.cassandra.db.Mutation mutation;
if (metadata.getDefaultValidator().isCommutative())
{
ThriftConversion.fromThrift(consistency_level).validateCounterForWrite(metadata);
- rmCounter = rmCounter == null ? new RowMutation(keyspace, key) : rmCounter;
- rm = rmCounter;
+ counterMutation = counterMutation == null ? new org.apache.cassandra.db.Mutation(keyspace, key) : counterMutation;
+ mutation = counterMutation;
}
else
{
- rmStandard = rmStandard == null ? new RowMutation(keyspace, key) : rmStandard;
- rm = rmStandard;
+ standardMutation = standardMutation == null ? new org.apache.cassandra.db.Mutation(keyspace, key) : standardMutation;
+ mutation = standardMutation;
}
- for (Mutation mutation : columnFamilyMutations.getValue())
+ for (Mutation m : columnFamilyMutations.getValue())
{
- ThriftValidation.validateMutation(metadata, mutation);
+ ThriftValidation.validateMutation(metadata, m);
- if (mutation.deletion != null)
+ if (m.deletion != null)
{
- deleteColumnOrSuperColumn(rm, metadata, mutation.deletion);
+ deleteColumnOrSuperColumn(mutation, metadata, m.deletion);
}
- if (mutation.column_or_supercolumn != null)
+ if (m.column_or_supercolumn != null)
{
- addColumnOrSuperColumn(rm, metadata, mutation.column_or_supercolumn);
+ addColumnOrSuperColumn(mutation, metadata, m.column_or_supercolumn);
}
}
}
- if (rmStandard != null && !rmStandard.isEmpty())
- rowMutations.add(rmStandard);
+ if (standardMutation != null && !standardMutation.isEmpty())
+ mutations.add(standardMutation);
- if (rmCounter != null && !rmCounter.isEmpty())
+ if (counterMutation != null && !counterMutation.isEmpty())
{
if (allowCounterMutations)
- rowMutations.add(new CounterMutation(rmCounter, ThriftConversion.fromThrift(consistency_level)));
+ mutations.add(new CounterMutation(counterMutation, ThriftConversion.fromThrift(consistency_level)));
else
throw new org.apache.cassandra.exceptions.InvalidRequestException("Counter mutations are not allowed in atomic batches");
}
}
- return rowMutations;
+ return mutations;
}
- private void addColumnOrSuperColumn(RowMutation rm, CFMetaData cfm, ColumnOrSuperColumn cosc)
+ private void addColumnOrSuperColumn(org.apache.cassandra.db.Mutation mutation, CFMetaData cfm, ColumnOrSuperColumn cosc)
{
if (cosc.super_column != null)
{
for (Column column : cosc.super_column.columns)
{
- rm.add(cfm.cfName, cfm.comparator.makeCellName(cosc.super_column.name, column.name), column.value, column.timestamp, column.ttl);
+ mutation.add(cfm.cfName, cfm.comparator.makeCellName(cosc.super_column.name, column.name), column.value, column.timestamp, column.ttl);
}
}
else if (cosc.column != null)
{
- rm.add(cfm.cfName, cfm.comparator.cellFromByteBuffer(cosc.column.name), cosc.column.value, cosc.column.timestamp, cosc.column.ttl);
+ mutation.add(cfm.cfName, cfm.comparator.cellFromByteBuffer(cosc.column.name), cosc.column.value, cosc.column.timestamp, cosc.column.ttl);
}
else if (cosc.counter_super_column != null)
{
for (CounterColumn column : cosc.counter_super_column.columns)
{
- rm.addCounter(cfm.cfName, cfm.comparator.makeCellName(cosc.counter_super_column.name, column.name), column.value);
+ mutation.addCounter(cfm.cfName, cfm.comparator.makeCellName(cosc.counter_super_column.name, column.name), column.value);
}
}
else // cosc.counter_column != null
{
- rm.addCounter(cfm.cfName, cfm.comparator.cellFromByteBuffer(cosc.counter_column.name), cosc.counter_column.value);
+ mutation.addCounter(cfm.cfName, cfm.comparator.cellFromByteBuffer(cosc.counter_column.name), cosc.counter_column.value);
}
}
- private void deleteColumnOrSuperColumn(RowMutation rm, CFMetaData cfm, Deletion del)
+ private void deleteColumnOrSuperColumn(org.apache.cassandra.db.Mutation mutation, CFMetaData cfm, Deletion del)
{
if (del.predicate != null && del.predicate.column_names != null)
{
for (ByteBuffer c : del.predicate.column_names)
{
if (del.super_column == null && cfm.isSuper())
- rm.deleteRange(cfm.cfName, SuperColumns.startOf(c), SuperColumns.endOf(c), del.timestamp);
+ mutation.deleteRange(cfm.cfName, SuperColumns.startOf(c), SuperColumns.endOf(c), del.timestamp);
else if (del.super_column != null)
- rm.delete(cfm.cfName, cfm.comparator.makeCellName(del.super_column, c), del.timestamp);
+ mutation.delete(cfm.cfName, cfm.comparator.makeCellName(del.super_column, c), del.timestamp);
else
- rm.delete(cfm.cfName, cfm.comparator.cellFromByteBuffer(c), del.timestamp);
+ mutation.delete(cfm.cfName, cfm.comparator.cellFromByteBuffer(c), del.timestamp);
}
}
else if (del.predicate != null && del.predicate.slice_range != null)
{
if (del.super_column == null && cfm.isSuper())
- rm.deleteRange(cfm.cfName,
- SuperColumns.startOf(del.predicate.getSlice_range().start),
- SuperColumns.startOf(del.predicate.getSlice_range().finish),
- del.timestamp);
+ mutation.deleteRange(cfm.cfName,
+ SuperColumns.startOf(del.predicate.getSlice_range().start),
+ SuperColumns.startOf(del.predicate.getSlice_range().finish),
+ del.timestamp);
else if (del.super_column != null)
- rm.deleteRange(cfm.cfName,
- cfm.comparator.makeCellName(del.super_column, del.predicate.getSlice_range().start),
- cfm.comparator.makeCellName(del.super_column, del.predicate.getSlice_range().finish),
- del.timestamp);
+ mutation.deleteRange(cfm.cfName,
+ cfm.comparator.makeCellName(del.super_column, del.predicate.getSlice_range().start),
+ cfm.comparator.makeCellName(del.super_column, del.predicate.getSlice_range().finish),
+ del.timestamp);
else
- rm.deleteRange(cfm.cfName,
- cfm.comparator.cellFromByteBuffer(del.predicate.getSlice_range().start),
- cfm.comparator.cellFromByteBuffer(del.predicate.getSlice_range().finish),
- del.timestamp);
+ mutation.deleteRange(cfm.cfName,
+ cfm.comparator.cellFromByteBuffer(del.predicate.getSlice_range().start),
+ cfm.comparator.cellFromByteBuffer(del.predicate.getSlice_range().finish),
+ del.timestamp);
}
else
{
if (del.super_column != null)
- rm.deleteRange(cfm.cfName, SuperColumns.startOf(del.super_column), SuperColumns.endOf(del.super_column), del.timestamp);
+ mutation.deleteRange(cfm.cfName, SuperColumns.startOf(del.super_column), SuperColumns.endOf(del.super_column), del.timestamp);
else
- rm.delete(cfm.cfName, del.timestamp);
+ mutation.delete(cfm.cfName, del.timestamp);
}
}
@@ -1016,20 +1016,20 @@ public class CassandraServer implements Cassandra.Iface
if (isCommutativeOp)
ThriftConversion.fromThrift(consistency_level).validateCounterForWrite(metadata);
- RowMutation rm = new RowMutation(keyspace, key);
+ org.apache.cassandra.db.Mutation mutation = new org.apache.cassandra.db.Mutation(keyspace, key);
if (column_path.super_column == null && column_path.column == null)
- rm.delete(column_path.column_family, timestamp);
+ mutation.delete(column_path.column_family, timestamp);
else if (column_path.super_column == null)
- rm.delete(column_path.column_family, metadata.comparator.cellFromByteBuffer(column_path.column), timestamp);
+ mutation.delete(column_path.column_family, metadata.comparator.cellFromByteBuffer(column_path.column), timestamp);
else if (column_path.column == null)
- rm.deleteRange(column_path.column_family, SuperColumns.startOf(column_path.super_column), SuperColumns.endOf(column_path.super_column), timestamp);
+ mutation.deleteRange(column_path.column_family, SuperColumns.startOf(column_path.super_column), SuperColumns.endOf(column_path.super_column), timestamp);
else
- rm.delete(column_path.column_family, metadata.comparator.makeCellName(column_path.super_column, column_path.column), timestamp);
+ mutation.delete(column_path.column_family, metadata.comparator.makeCellName(column_path.super_column, column_path.column), timestamp);
if (isCommutativeOp)
- doInsert(consistency_level, Arrays.asList(new CounterMutation(rm, ThriftConversion.fromThrift(consistency_level))));
+ doInsert(consistency_level, Arrays.asList(new CounterMutation(mutation, ThriftConversion.fromThrift(consistency_level))));
else
- doInsert(consistency_level, Arrays.asList(rm));
+ doInsert(consistency_level, Arrays.asList(mutation));
}
public void remove(ByteBuffer key, ColumnPath column_path, long timestamp, ConsistencyLevel consistency_level)
@@ -1777,19 +1777,19 @@ public class CassandraServer implements Cassandra.Iface
ThriftValidation.validateColumnNames(metadata, column_parent, Arrays.asList(column.name));
- RowMutation rm = new RowMutation(keyspace, key);
+ org.apache.cassandra.db.Mutation mutation = new org.apache.cassandra.db.Mutation(keyspace, key);
try
{
if (metadata.isSuper())
- rm.addCounter(column_parent.column_family, metadata.comparator.makeCellName(column_parent.super_column, column.name), column.value);
+ mutation.addCounter(column_parent.column_family, metadata.comparator.makeCellName(column_parent.super_column, column.name), column.value);
else
- rm.addCounter(column_parent.column_family, metadata.comparator.cellFromByteBuffer(column.name), column.value);
+ mutation.addCounter(column_parent.column_family, metadata.comparator.cellFromByteBuffer(column.name), column.value);
}
catch (MarshalException e)
{
throw new InvalidRequestException(e.getMessage());
}
- doInsert(consistency_level, Arrays.asList(new CounterMutation(rm, ThriftConversion.fromThrift(consistency_level))));
+ doInsert(consistency_level, Arrays.asList(new CounterMutation(mutation, ThriftConversion.fromThrift(consistency_level))));
}
catch (RequestValidationException e)
{
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/tracing/TraceState.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tracing/TraceState.java b/src/java/org/apache/cassandra/tracing/TraceState.java
index 5fec633..7f60433 100644
--- a/src/java/org/apache/cassandra/tracing/TraceState.java
+++ b/src/java/org/apache/cassandra/tracing/TraceState.java
@@ -29,7 +29,7 @@ import org.apache.cassandra.concurrent.Stage;
import org.apache.cassandra.concurrent.StageManager;
import org.apache.cassandra.config.CFMetaData;
import org.apache.cassandra.db.ColumnFamily;
-import org.apache.cassandra.db.RowMutation;
+import org.apache.cassandra.db.Mutation;
import org.apache.cassandra.db.TreeMapBackedSortedColumns;
import org.apache.cassandra.utils.ByteBufferUtil;
import org.apache.cassandra.utils.FBUtilities;
@@ -101,7 +101,7 @@ public class TraceState
if (elapsed >= 0)
Tracing.addColumn(cf, Tracing.buildName(cfMeta, eventId, ByteBufferUtil.bytes("source_elapsed")), elapsed);
Tracing.addColumn(cf, Tracing.buildName(cfMeta, eventId, ByteBufferUtil.bytes("thread")), threadName);
- Tracing.mutateWithCatch(new RowMutation(Tracing.TRACE_KS, sessionIdBytes, cf));
+ Tracing.mutateWithCatch(new Mutation(Tracing.TRACE_KS, sessionIdBytes, cf));
}
});
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/tracing/Tracing.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tracing/Tracing.java b/src/java/org/apache/cassandra/tracing/Tracing.java
index 42ce12b..f22f273 100644
--- a/src/java/org/apache/cassandra/tracing/Tracing.java
+++ b/src/java/org/apache/cassandra/tracing/Tracing.java
@@ -167,7 +167,7 @@ public class Tracing
CFMetaData cfMeta = CFMetaData.TraceSessionsCf;
ColumnFamily cf = ArrayBackedSortedColumns.factory.create(cfMeta);
addColumn(cf, buildName(cfMeta, "duration"), elapsed);
- mutateWithCatch(new RowMutation(TRACE_KS, sessionIdBytes, cf));
+ mutateWithCatch(new Mutation(TRACE_KS, sessionIdBytes, cf));
}
});
@@ -208,7 +208,7 @@ public class Tracing
addParameterColumns(cf, parameters);
addColumn(cf, buildName(cfMeta, "request"), request);
addColumn(cf, buildName(cfMeta, "started_at"), started_at);
- mutateWithCatch(new RowMutation(TRACE_KS, sessionIdBytes, cf));
+ mutateWithCatch(new Mutation(TRACE_KS, sessionIdBytes, cf));
}
});
}
@@ -280,7 +280,7 @@ public class Tracing
state.trace(format, args);
}
- static void mutateWithCatch(RowMutation mutation)
+ static void mutateWithCatch(Mutation mutation)
{
try
{
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/triggers/ITrigger.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/triggers/ITrigger.java b/src/java/org/apache/cassandra/triggers/ITrigger.java
index 15ed7ba..208acea 100644
--- a/src/java/org/apache/cassandra/triggers/ITrigger.java
+++ b/src/java/org/apache/cassandra/triggers/ITrigger.java
@@ -25,7 +25,7 @@ import java.nio.ByteBuffer;
import java.util.Collection;
import org.apache.cassandra.db.ColumnFamily;
-import org.apache.cassandra.db.RowMutation;
+import org.apache.cassandra.db.Mutation;
/**
* Trigger interface, For every Mutation received by the coordinator {@link #augment(ByteBuffer, ColumnFamily)}
@@ -44,9 +44,9 @@ public interface ITrigger
/**
* Called exactly once per CF update, returned mutations are atomically updated.
*
- * @param key - Row Key for the update.
- * @param update - Update received for the CF
+ * @param key - parition Key for the update.
+ * @param update - update received for the CF
* @return modifications to be applied, null if no action to be performed.
*/
- public Collection<RowMutation> augment(ByteBuffer key, ColumnFamily update);
+ public Collection<Mutation> augment(ByteBuffer partitionKey, ColumnFamily update);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/java/org/apache/cassandra/triggers/TriggerExecutor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/triggers/TriggerExecutor.java b/src/java/org/apache/cassandra/triggers/TriggerExecutor.java
index c294128..91d0ea0 100644
--- a/src/java/org/apache/cassandra/triggers/TriggerExecutor.java
+++ b/src/java/org/apache/cassandra/triggers/TriggerExecutor.java
@@ -29,11 +29,8 @@ import com.google.common.collect.Maps;
import org.apache.cassandra.config.TriggerDefinition;
import org.apache.cassandra.cql.QueryProcessor;
+import org.apache.cassandra.db.*;
import org.apache.cassandra.db.composites.CellName;
-import org.apache.cassandra.db.ColumnFamily;
-import org.apache.cassandra.db.CounterMutation;
-import org.apache.cassandra.db.IMutation;
-import org.apache.cassandra.db.RowMutation;
import org.apache.cassandra.exceptions.InvalidRequestException;
import org.apache.cassandra.utils.FBUtilities;
@@ -63,15 +60,15 @@ public class TriggerExecutor
cachedTriggers.clear();
}
- public Collection<RowMutation> execute(Collection<? extends IMutation> updates) throws InvalidRequestException
+ public Collection<Mutation> execute(Collection<? extends IMutation> updates) throws InvalidRequestException
{
boolean hasCounters = false;
- Collection<RowMutation> tmutations = null;
+ Collection<Mutation> tmutations = null;
for (IMutation mutation : updates)
{
for (ColumnFamily cf : mutation.getColumnFamilies())
{
- List<RowMutation> intermediate = execute(mutation.key(), cf);
+ List<Mutation> intermediate = execute(mutation.key(), cf);
if (intermediate == null)
continue;
@@ -89,9 +86,9 @@ public class TriggerExecutor
return tmutations;
}
- private void validate(Collection<RowMutation> tmutations) throws InvalidRequestException
+ private void validate(Collection<Mutation> tmutations) throws InvalidRequestException
{
- for (RowMutation mutation : tmutations)
+ for (Mutation mutation : tmutations)
{
QueryProcessor.validateKey(mutation.key());
for (ColumnFamily tcf : mutation.getColumnFamilies())
@@ -104,12 +101,12 @@ public class TriggerExecutor
* Switch class loader before using the triggers for the column family, if
* not loaded them with the custom class loader.
*/
- private List<RowMutation> execute(ByteBuffer key, ColumnFamily columnFamily)
+ private List<Mutation> execute(ByteBuffer key, ColumnFamily columnFamily)
{
Map<String,TriggerDefinition> triggers = columnFamily.metadata().getTriggers();
if (triggers.isEmpty())
return null;
- List<RowMutation> tmutations = Lists.newLinkedList();
+ List<Mutation> tmutations = Lists.newLinkedList();
Thread.currentThread().setContextClassLoader(customClassLoader);
try
{
@@ -121,7 +118,7 @@ public class TriggerExecutor
trigger = loadTriggerInstance(td.classOption);
cachedTriggers.put(td.classOption, trigger);
}
- Collection<RowMutation> temp = trigger.augment(key, columnFamily);
+ Collection<Mutation> temp = trigger.augment(key, columnFamily);
if (temp != null)
tmutations.addAll(temp);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/src/resources/org/apache/cassandra/cli/CliHelp.yaml
----------------------------------------------------------------------
diff --git a/src/resources/org/apache/cassandra/cli/CliHelp.yaml b/src/resources/org/apache/cassandra/cli/CliHelp.yaml
index 3d4bd99..0202d19 100644
--- a/src/resources/org/apache/cassandra/cli/CliHelp.yaml
+++ b/src/resources/org/apache/cassandra/cli/CliHelp.yaml
@@ -250,7 +250,7 @@ commands:
Options have the form {key:value}, see the information on each
strategy and the examples.
- - durable_writes: When set to false all RowMutations on keyspace will by-pass CommitLog.
+ - durable_writes: When set to false all Mutations on keyspace will by-pass CommitLog.
Set to true by default.
Examples:
@@ -318,7 +318,7 @@ commands:
Options have the form {key:value}, see the information on each
strategy and the examples.
- - durable_writes: When set to false all RowMutations on keyspace will by-pass CommitLog.
+ - durable_writes: When set to false all Mutations on keyspace will by-pass CommitLog.
Set to true by default.
Examples:
[2/4] Rename RowMutation->Mutation in preparation for Row->Partition
Posted by al...@apache.org.
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/long/org/apache/cassandra/db/LongKeyspaceTest.java
----------------------------------------------------------------------
diff --git a/test/long/org/apache/cassandra/db/LongKeyspaceTest.java b/test/long/org/apache/cassandra/db/LongKeyspaceTest.java
index 0dd872c..d610efa 100644
--- a/test/long/org/apache/cassandra/db/LongKeyspaceTest.java
+++ b/test/long/org/apache/cassandra/db/LongKeyspaceTest.java
@@ -21,12 +21,10 @@ package org.apache.cassandra.db;
import org.junit.Test;
import org.apache.cassandra.SchemaLoader;
-import org.apache.cassandra.db.filter.QueryFilter;
import org.apache.cassandra.utils.WrappedRunnable;
import static org.apache.cassandra.Util.column;
import org.apache.cassandra.Util;
-import org.apache.cassandra.utils.ByteBufferUtil;
public class LongKeyspaceTest extends SchemaLoader
@@ -39,7 +37,7 @@ public class LongKeyspaceTest extends SchemaLoader
for (int i = 1; i < 5000; i += 100)
{
- RowMutation rm = new RowMutation("Keyspace1", Util.dk("key" + i).key);
+ Mutation rm = new Mutation("Keyspace1", Util.dk("key" + i).key);
ColumnFamily cf = TreeMapBackedSortedColumns.factory.create("Keyspace1", "Standard1");
for (int j = 0; j < i; j++)
cf.addColumn(column("c" + j, "v" + j, 1L));
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/long/org/apache/cassandra/db/MeteredFlusherTest.java
----------------------------------------------------------------------
diff --git a/test/long/org/apache/cassandra/db/MeteredFlusherTest.java b/test/long/org/apache/cassandra/db/MeteredFlusherTest.java
index 07ddbd6..4bab277 100644
--- a/test/long/org/apache/cassandra/db/MeteredFlusherTest.java
+++ b/test/long/org/apache/cassandra/db/MeteredFlusherTest.java
@@ -50,7 +50,7 @@ public class MeteredFlusherTest extends SchemaLoader
{
for (int i = 0; i < 100; i++)
{
- RowMutation rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes("key" + j));
+ Mutation rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("key" + j));
ColumnFamily cf = TreeMapBackedSortedColumns.factory.create("Keyspace1", "_CF" + i);
// don't cheat by allocating this outside of the loop; that defeats the purpose of deliberately using lots of memory
ByteBuffer value = ByteBuffer.allocate(100000);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/long/org/apache/cassandra/db/commitlog/ComitLogStress.java
----------------------------------------------------------------------
diff --git a/test/long/org/apache/cassandra/db/commitlog/ComitLogStress.java b/test/long/org/apache/cassandra/db/commitlog/ComitLogStress.java
index b212a22..d1db2f2 100644
--- a/test/long/org/apache/cassandra/db/commitlog/ComitLogStress.java
+++ b/test/long/org/apache/cassandra/db/commitlog/ComitLogStress.java
@@ -11,7 +11,7 @@ import java.util.concurrent.atomic.AtomicLong;
import org.apache.cassandra.Util;
import org.apache.cassandra.concurrent.JMXEnabledThreadPoolExecutor;
import org.apache.cassandra.concurrent.NamedThreadFactory;
-import org.apache.cassandra.db.RowMutation;
+import org.apache.cassandra.db.Mutation;
import org.apache.cassandra.utils.ByteBufferUtil;
import org.apache.cassandra.utils.UUIDGen;
@@ -64,7 +64,7 @@ public class ComitLogStress
public void run() {
String ks = "Keyspace1";
ByteBuffer key = ByteBufferUtil.bytes(keyString);
- RowMutation mutation = new RowMutation(ks, key);
+ Mutation mutation = new Mutation(ks, key);
mutation.add("Standard1", Util.cellname("name"), ByteBufferUtil.bytes("value"),
System.currentTimeMillis());
CommitLog.instance.add(mutation);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/long/org/apache/cassandra/db/compaction/LongCompactionsTest.java
----------------------------------------------------------------------
diff --git a/test/long/org/apache/cassandra/db/compaction/LongCompactionsTest.java b/test/long/org/apache/cassandra/db/compaction/LongCompactionsTest.java
index 5d68a3b..ce23a47 100644
--- a/test/long/org/apache/cassandra/db/compaction/LongCompactionsTest.java
+++ b/test/long/org/apache/cassandra/db/compaction/LongCompactionsTest.java
@@ -127,7 +127,7 @@ public class LongCompactionsTest extends SchemaLoader
for (int j = 0; j < SSTABLES; j++) {
for (int i = 0; i < ROWS_PER_SSTABLE; i++) {
DecoratedKey key = Util.dk(String.valueOf(i % 2));
- RowMutation rm = new RowMutation(KEYSPACE1, key.key);
+ Mutation rm = new Mutation(KEYSPACE1, key.key);
long timestamp = j * ROWS_PER_SSTABLE + i;
rm.add("Standard1", Util.cellname(String.valueOf(i / 2)),
ByteBufferUtil.EMPTY_BYTE_BUFFER,
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/long/org/apache/cassandra/db/compaction/LongLeveledCompactionStrategyTest.java
----------------------------------------------------------------------
diff --git a/test/long/org/apache/cassandra/db/compaction/LongLeveledCompactionStrategyTest.java b/test/long/org/apache/cassandra/db/compaction/LongLeveledCompactionStrategyTest.java
index 0de0395..54fc22f 100644
--- a/test/long/org/apache/cassandra/db/compaction/LongLeveledCompactionStrategyTest.java
+++ b/test/long/org/apache/cassandra/db/compaction/LongLeveledCompactionStrategyTest.java
@@ -27,12 +27,8 @@ import org.junit.Test;
import org.apache.cassandra.SchemaLoader;
import org.apache.cassandra.Util;
-import org.apache.cassandra.db.ColumnFamilyStore;
-import org.apache.cassandra.db.DecoratedKey;
-import org.apache.cassandra.db.RowMutation;
-import org.apache.cassandra.db.Keyspace;
+import org.apache.cassandra.db.*;
import org.apache.cassandra.io.sstable.SSTableReader;
-import org.apache.cassandra.utils.ByteBufferUtil;
import org.apache.cassandra.utils.FBUtilities;
public class LongLeveledCompactionStrategyTest extends SchemaLoader
@@ -58,7 +54,7 @@ public class LongLeveledCompactionStrategyTest extends SchemaLoader
for (int r = 0; r < rows; r++)
{
DecoratedKey key = Util.dk(String.valueOf(r));
- RowMutation rm = new RowMutation(ksname, key.key);
+ Mutation rm = new Mutation(ksname, key.key);
for (int c = 0; c < columns; c++)
{
rm.add(cfname, Util.cellname("column" + c), value, 0);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/SchemaLoader.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/SchemaLoader.java b/test/unit/org/apache/cassandra/SchemaLoader.java
index df74108..6866402 100644
--- a/test/unit/org/apache/cassandra/SchemaLoader.java
+++ b/test/unit/org/apache/cassandra/SchemaLoader.java
@@ -18,7 +18,6 @@
package org.apache.cassandra;
import java.io.File;
-import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.*;
@@ -399,9 +398,9 @@ public class SchemaLoader
for (int i = offset; i < offset + numberOfRows; i++)
{
ByteBuffer key = ByteBufferUtil.bytes("key" + i);
- RowMutation rowMutation = new RowMutation(keyspace, key);
- rowMutation.add(columnFamily, Util.cellname("col" + i), ByteBufferUtil.bytes("val" + i), System.currentTimeMillis());
- rowMutation.applyUnsafe();
+ Mutation mutation = new Mutation(keyspace, key);
+ mutation.add(columnFamily, Util.cellname("col" + i), ByteBufferUtil.bytes("val" + i), System.currentTimeMillis());
+ mutation.applyUnsafe();
}
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/Util.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/Util.java b/test/unit/org/apache/cassandra/Util.java
index f6e5b51..ec8f9d5 100644
--- a/test/unit/org/apache/cassandra/Util.java
+++ b/test/unit/org/apache/cassandra/Util.java
@@ -141,7 +141,7 @@ public class Util
return new Bounds<RowPosition>(rp(left), rp(right));
}
- public static void addMutation(RowMutation rm, String columnFamilyName, String superColumnName, long columnName, String value, long timestamp)
+ public static void addMutation(Mutation rm, String columnFamilyName, String superColumnName, long columnName, String value, long timestamp)
{
CellName cname = superColumnName == null
? CellNames.simpleDense(getBytes(columnName))
@@ -185,7 +185,7 @@ public class Util
/**
* Writes out a bunch of mutations for a single column family.
*
- * @param mutations A group of RowMutations for the same keyspace and column family.
+ * @param mutations A group of Mutations for the same keyspace and column family.
* @return The ColumnFamilyStore that was used.
*/
public static ColumnFamilyStore writeColumnFamily(List<IMutation> mutations) throws IOException, ExecutionException, InterruptedException
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/config/CFMetaDataTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/config/CFMetaDataTest.java b/test/unit/org/apache/cassandra/config/CFMetaDataTest.java
index fd8b637..0d2fa95 100644
--- a/test/unit/org/apache/cassandra/config/CFMetaDataTest.java
+++ b/test/unit/org/apache/cassandra/config/CFMetaDataTest.java
@@ -19,7 +19,6 @@
package org.apache.cassandra.config;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import java.util.HashMap;
import java.util.HashSet;
@@ -127,7 +126,7 @@ public class CFMetaDataTest extends SchemaLoader
assert before.equals(after) : String.format("\n%s\n!=\n%s", before, after);
// Test schema conversion
- RowMutation rm = cfm.toSchema(System.currentTimeMillis());
+ Mutation rm = cfm.toSchema(System.currentTimeMillis());
ColumnFamily serializedCf = rm.getColumnFamily(Schema.instance.getId(Keyspace.SYSTEM_KS, SystemKeyspace.SCHEMA_COLUMNFAMILIES_CF));
ColumnFamily serializedCD = rm.getColumnFamily(Schema.instance.getId(Keyspace.SYSTEM_KS, SystemKeyspace.SCHEMA_COLUMNS_CF));
UntypedResultSet.Row result = QueryProcessor.resultify("SELECT * FROM system.schema_columnfamilies", new Row(k, serializedCf)).one();
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/config/DefsTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/config/DefsTest.java b/test/unit/org/apache/cassandra/config/DefsTest.java
index edb2b8d..28d3589 100644
--- a/test/unit/org/apache/cassandra/config/DefsTest.java
+++ b/test/unit/org/apache/cassandra/config/DefsTest.java
@@ -171,7 +171,7 @@ public class DefsTest extends SchemaLoader
// now read and write to it.
CellName col0 = cellname("col0");
DecoratedKey dk = Util.dk("key0");
- RowMutation rm = new RowMutation(ks, dk.key);
+ Mutation rm = new Mutation(ks, dk.key);
rm.add(cf, col0, ByteBufferUtil.bytes("value0"), 1L);
rm.apply();
ColumnFamilyStore store = Keyspace.open(ks).getColumnFamilyStore(cf);
@@ -195,7 +195,7 @@ public class DefsTest extends SchemaLoader
assert cfm != null;
// write some data, force a flush, then verify that files exist on disk.
- RowMutation rm = new RowMutation(ks.name, dk.key);
+ Mutation rm = new Mutation(ks.name, dk.key);
for (int i = 0; i < 100; i++)
rm.add(cfm.cfName, cellname("col" + i), ByteBufferUtil.bytes("anyvalue"), 1L);
rm.apply();
@@ -209,7 +209,7 @@ public class DefsTest extends SchemaLoader
assert !Schema.instance.getKSMetaData(ks.name).cfMetaData().containsKey(cfm.cfName);
// any write should fail.
- rm = new RowMutation(ks.name, dk.key);
+ rm = new Mutation(ks.name, dk.key);
boolean success = true;
try
{
@@ -245,7 +245,7 @@ public class DefsTest extends SchemaLoader
// test reads and writes.
CellName col0 = cellname("col0");
- RowMutation rm = new RowMutation(newCf.ksName, dk.key);
+ Mutation rm = new Mutation(newCf.ksName, dk.key);
rm.add(newCf.cfName, col0, ByteBufferUtil.bytes("value0"), 1L);
rm.apply();
ColumnFamilyStore store = Keyspace.open(newCf.ksName).getColumnFamilyStore(newCf.cfName);
@@ -269,7 +269,7 @@ public class DefsTest extends SchemaLoader
assert cfm != null;
// write some data, force a flush, then verify that files exist on disk.
- RowMutation rm = new RowMutation(ks.name, dk.key);
+ Mutation rm = new Mutation(ks.name, dk.key);
for (int i = 0; i < 100; i++)
rm.add(cfm.cfName, cellname("col" + i), ByteBufferUtil.bytes("anyvalue"), 1L);
rm.apply();
@@ -283,7 +283,7 @@ public class DefsTest extends SchemaLoader
assert Schema.instance.getKSMetaData(ks.name) == null;
// write should fail.
- rm = new RowMutation(ks.name, dk.key);
+ rm = new Mutation(ks.name, dk.key);
boolean success = true;
try
{
@@ -320,7 +320,7 @@ public class DefsTest extends SchemaLoader
assert cfm != null;
// write some data
- RowMutation rm = new RowMutation(ks.name, dk.key);
+ Mutation rm = new Mutation(ks.name, dk.key);
for (int i = 0; i < 100; i++)
rm.add(cfm.cfName, cellname("col" + i), ByteBufferUtil.bytes("anyvalue"), 1L);
rm.apply();
@@ -354,7 +354,7 @@ public class DefsTest extends SchemaLoader
// now read and write to it.
CellName col0 = cellname("col0");
DecoratedKey dk = Util.dk("key0");
- RowMutation rm = new RowMutation(newKs.name, dk.key);
+ Mutation rm = new Mutation(newKs.name, dk.key);
rm.add(newCf.cfName, col0, ByteBufferUtil.bytes("value0"), 1L);
rm.apply();
ColumnFamilyStore store = Keyspace.open(newKs.name).getColumnFamilyStore(newCf.cfName);
@@ -503,7 +503,7 @@ public class DefsTest extends SchemaLoader
ColumnFamilyStore cfs = Keyspace.open("Keyspace6").getColumnFamilyStore("Indexed1");
// insert some data. save the sstable descriptor so we can make sure it's marked for delete after the drop
- RowMutation rm = new RowMutation("Keyspace6", ByteBufferUtil.bytes("k1"));
+ Mutation rm = new Mutation("Keyspace6", ByteBufferUtil.bytes("k1"));
rm.add("Indexed1", cellname("notbirthdate"), ByteBufferUtil.bytes(1L), 0);
rm.add("Indexed1", cellname("birthdate"), ByteBufferUtil.bytes(1L), 0);
rm.apply();
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/db/CleanupTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/CleanupTest.java b/test/unit/org/apache/cassandra/db/CleanupTest.java
index 29a538e..a068f1b 100644
--- a/test/unit/org/apache/cassandra/db/CleanupTest.java
+++ b/test/unit/org/apache/cassandra/db/CleanupTest.java
@@ -147,8 +147,8 @@ public class CleanupTest extends SchemaLoader
{
String key = String.valueOf(i);
// create a row and update the birthdate value, test that the index query fetches the new version
- RowMutation rm;
- rm = new RowMutation(KEYSPACE1, ByteBufferUtil.bytes(key));
+ Mutation rm;
+ rm = new Mutation(KEYSPACE1, ByteBufferUtil.bytes(key));
rm.add(cfs.name, Util.cellname(COLUMN), VALUE, System.currentTimeMillis());
rm.applyUnsafe();
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/db/CollationControllerTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/CollationControllerTest.java b/test/unit/org/apache/cassandra/db/CollationControllerTest.java
index 5b7197b..14325a4 100644
--- a/test/unit/org/apache/cassandra/db/CollationControllerTest.java
+++ b/test/unit/org/apache/cassandra/db/CollationControllerTest.java
@@ -21,7 +21,6 @@ package org.apache.cassandra.db;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
-import java.nio.ByteBuffer;
import java.util.concurrent.ExecutionException;
import org.apache.cassandra.SchemaLoader;
@@ -32,8 +31,6 @@ import org.apache.cassandra.utils.ByteBufferUtil;
import org.apache.cassandra.utils.FBUtilities;
import org.junit.Test;
-import org.apache.cassandra.io.sstable.SSTableReader;
-
public class CollationControllerTest extends SchemaLoader
{
@Test
@@ -42,30 +39,30 @@ public class CollationControllerTest extends SchemaLoader
{
Keyspace keyspace = Keyspace.open("Keyspace1");
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore("Standard1");
- RowMutation rm;
+ Mutation rm;
DecoratedKey dk = Util.dk("key1");
// add data
- rm = new RowMutation(keyspace.getName(), dk.key);
+ rm = new Mutation(keyspace.getName(), dk.key);
rm.add(cfs.name, Util.cellname("Column1"), ByteBufferUtil.bytes("asdf"), 0);
rm.apply();
cfs.forceBlockingFlush();
// remove
- rm = new RowMutation(keyspace.getName(), dk.key);
+ rm = new Mutation(keyspace.getName(), dk.key);
rm.delete(cfs.name, 10);
rm.apply();
// add another mutation because sstable maxtimestamp isn't set
// correctly during flush if the most recent mutation is a row delete
- rm = new RowMutation(keyspace.getName(), Util.dk("key2").key);
+ rm = new Mutation(keyspace.getName(), Util.dk("key2").key);
rm.add(cfs.name, Util.cellname("Column1"), ByteBufferUtil.bytes("zxcv"), 20);
rm.apply();
cfs.forceBlockingFlush();
// add yet one more mutation
- rm = new RowMutation(keyspace.getName(), dk.key);
+ rm = new Mutation(keyspace.getName(), dk.key);
rm.add(cfs.name, Util.cellname("Column1"), ByteBufferUtil.bytes("foobar"), 30);
rm.apply();
cfs.forceBlockingFlush();
@@ -94,18 +91,18 @@ public class CollationControllerTest extends SchemaLoader
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore("StandardGCGS0");
cfs.disableAutoCompaction();
- RowMutation rm;
+ Mutation rm;
DecoratedKey dk = Util.dk("key1");
CellName cellName = Util.cellname("Column1");
// add data
- rm = new RowMutation(keyspace.getName(), dk.key);
+ rm = new Mutation(keyspace.getName(), dk.key);
rm.add(cfs.name, cellName, ByteBufferUtil.bytes("asdf"), 0);
rm.apply();
cfs.forceBlockingFlush();
// remove
- rm = new RowMutation(keyspace.getName(), dk.key);
+ rm = new Mutation(keyspace.getName(), dk.key);
rm.delete(cfs.name, cellName, 0);
rm.apply();
cfs.forceBlockingFlush();
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java b/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
index d1a2af7..0a081c1 100644
--- a/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
+++ b/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
@@ -82,13 +82,13 @@ public class ColumnFamilyStoreTest extends SchemaLoader
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore("Standard1");
cfs.truncateBlocking();
- RowMutation rm;
- rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes("key1"));
+ Mutation rm;
+ rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("key1"));
rm.add("Standard1", cellname("Column1"), ByteBufferUtil.bytes("asdf"), 0);
rm.apply();
cfs.forceBlockingFlush();
- rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes("key1"));
+ rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("key1"));
rm.add("Standard1", cellname("Column1"), ByteBufferUtil.bytes("asdf"), 1);
rm.apply();
cfs.forceBlockingFlush();
@@ -106,8 +106,8 @@ public class ColumnFamilyStoreTest extends SchemaLoader
cfs.truncateBlocking();
List<IMutation> rms = new LinkedList<IMutation>();
- RowMutation rm;
- rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes("key1"));
+ Mutation rm;
+ rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("key1"));
rm.add("Standard1", cellname("Column1"), ByteBufferUtil.bytes("asdf"), 0);
rm.add("Standard1", cellname("Column2"), ByteBufferUtil.bytes("asdf"), 0);
rms.add(rm);
@@ -125,9 +125,9 @@ public class ColumnFamilyStoreTest extends SchemaLoader
{
Keyspace keyspace = Keyspace.open("Keyspace1");
final ColumnFamilyStore store = keyspace.getColumnFamilyStore("Standard2");
- RowMutation rm;
+ Mutation rm;
- rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes("key1"));
+ rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("key1"));
rm.delete("Standard2", System.currentTimeMillis());
rm.apply();
@@ -168,26 +168,26 @@ public class ColumnFamilyStoreTest extends SchemaLoader
public void testIndexScan()
{
ColumnFamilyStore cfs = Keyspace.open("Keyspace1").getColumnFamilyStore("Indexed1");
- RowMutation rm;
+ Mutation rm;
CellName nobirthdate = cellname("notbirthdate");
CellName birthdate = cellname("birthdate");
- rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes("k1"));
+ rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("k1"));
rm.add("Indexed1", nobirthdate, ByteBufferUtil.bytes(1L), 0);
rm.add("Indexed1", birthdate, ByteBufferUtil.bytes(1L), 0);
rm.apply();
- rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes("k2"));
+ rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("k2"));
rm.add("Indexed1", nobirthdate, ByteBufferUtil.bytes(2L), 0);
rm.add("Indexed1", birthdate, ByteBufferUtil.bytes(2L), 0);
rm.apply();
- rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes("k3"));
+ rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("k3"));
rm.add("Indexed1", nobirthdate, ByteBufferUtil.bytes(2L), 0);
rm.add("Indexed1", birthdate, ByteBufferUtil.bytes(1L), 0);
rm.apply();
- rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes("k4aaaa"));
+ rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("k4aaaa"));
rm.add("Indexed1", nobirthdate, ByteBufferUtil.bytes(2L), 0);
rm.add("Indexed1", birthdate, ByteBufferUtil.bytes(3L), 0);
rm.apply();
@@ -251,11 +251,11 @@ public class ColumnFamilyStoreTest extends SchemaLoader
@Test
public void testLargeScan()
{
- RowMutation rm;
+ Mutation rm;
ColumnFamilyStore cfs = Keyspace.open("Keyspace1").getColumnFamilyStore("Indexed1");
for (int i = 0; i < 100; i++)
{
- rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes("key" + i));
+ rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("key" + i));
rm.add("Indexed1", cellname("birthdate"), ByteBufferUtil.bytes(34L), 0);
rm.add("Indexed1", cellname("notbirthdate"), ByteBufferUtil.bytes((long) (i % 2)), 0);
rm.applyUnsafe();
@@ -281,9 +281,9 @@ public class ColumnFamilyStoreTest extends SchemaLoader
public void testIndexDeletions() throws IOException
{
ColumnFamilyStore cfs = Keyspace.open("Keyspace3").getColumnFamilyStore("Indexed1");
- RowMutation rm;
+ Mutation rm;
- rm = new RowMutation("Keyspace3", ByteBufferUtil.bytes("k1"));
+ rm = new Mutation("Keyspace3", ByteBufferUtil.bytes("k1"));
rm.add("Indexed1", cellname("birthdate"), ByteBufferUtil.bytes(1L), 0);
rm.apply();
@@ -297,7 +297,7 @@ public class ColumnFamilyStoreTest extends SchemaLoader
assert "k1".equals( key );
// delete the column directly
- rm = new RowMutation("Keyspace3", ByteBufferUtil.bytes("k1"));
+ rm = new Mutation("Keyspace3", ByteBufferUtil.bytes("k1"));
rm.delete("Indexed1", cellname("birthdate"), 1);
rm.apply();
rows = cfs.search(range, clause, filter, 100);
@@ -312,7 +312,7 @@ public class ColumnFamilyStoreTest extends SchemaLoader
assert rows.isEmpty();
// resurrect w/ a newer timestamp
- rm = new RowMutation("Keyspace3", ByteBufferUtil.bytes("k1"));
+ rm = new Mutation("Keyspace3", ByteBufferUtil.bytes("k1"));
rm.add("Indexed1", cellname("birthdate"), ByteBufferUtil.bytes(1L), 2);
rm.apply();
rows = cfs.search(range, clause, filter, 100);
@@ -321,7 +321,7 @@ public class ColumnFamilyStoreTest extends SchemaLoader
assert "k1".equals( key );
// verify that row and delete w/ older timestamp does nothing
- rm = new RowMutation("Keyspace3", ByteBufferUtil.bytes("k1"));
+ rm = new Mutation("Keyspace3", ByteBufferUtil.bytes("k1"));
rm.delete("Indexed1", 1);
rm.apply();
rows = cfs.search(range, clause, filter, 100);
@@ -330,7 +330,7 @@ public class ColumnFamilyStoreTest extends SchemaLoader
assert "k1".equals( key );
// similarly, column delete w/ older timestamp should do nothing
- rm = new RowMutation("Keyspace3", ByteBufferUtil.bytes("k1"));
+ rm = new Mutation("Keyspace3", ByteBufferUtil.bytes("k1"));
rm.delete("Indexed1", cellname("birthdate"), 1);
rm.apply();
rows = cfs.search(range, clause, filter, 100);
@@ -339,21 +339,21 @@ public class ColumnFamilyStoreTest extends SchemaLoader
assert "k1".equals( key );
// delete the entire row (w/ newer timestamp this time)
- rm = new RowMutation("Keyspace3", ByteBufferUtil.bytes("k1"));
+ rm = new Mutation("Keyspace3", ByteBufferUtil.bytes("k1"));
rm.delete("Indexed1", 3);
rm.apply();
rows = cfs.search(range, clause, filter, 100);
assert rows.isEmpty() : StringUtils.join(rows, ",");
// make sure obsolete mutations don't generate an index entry
- rm = new RowMutation("Keyspace3", ByteBufferUtil.bytes("k1"));
+ rm = new Mutation("Keyspace3", ByteBufferUtil.bytes("k1"));
rm.add("Indexed1", cellname("birthdate"), ByteBufferUtil.bytes(1L), 3);
rm.apply();
rows = cfs.search(range, clause, filter, 100);
assert rows.isEmpty() : StringUtils.join(rows, ",");
// try insert followed by row delete in the same mutation
- rm = new RowMutation("Keyspace3", ByteBufferUtil.bytes("k1"));
+ rm = new Mutation("Keyspace3", ByteBufferUtil.bytes("k1"));
rm.add("Indexed1", cellname("birthdate"), ByteBufferUtil.bytes(1L), 1);
rm.delete("Indexed1", 2);
rm.apply();
@@ -361,7 +361,7 @@ public class ColumnFamilyStoreTest extends SchemaLoader
assert rows.isEmpty() : StringUtils.join(rows, ",");
// try row delete followed by insert in the same mutation
- rm = new RowMutation("Keyspace3", ByteBufferUtil.bytes("k1"));
+ rm = new Mutation("Keyspace3", ByteBufferUtil.bytes("k1"));
rm.delete("Indexed1", 3);
rm.add("Indexed1", cellname("birthdate"), ByteBufferUtil.bytes(1L), 4);
rm.apply();
@@ -379,11 +379,11 @@ public class ColumnFamilyStoreTest extends SchemaLoader
CellName birthdate = cellname("birthdate");
// create a row and update the birthdate value, test that the index query fetches the new version
- RowMutation rm;
- rm = new RowMutation("Keyspace2", ByteBufferUtil.bytes("k1"));
+ Mutation rm;
+ rm = new Mutation("Keyspace2", ByteBufferUtil.bytes("k1"));
rm.add("Indexed1", birthdate, ByteBufferUtil.bytes(1L), 1);
rm.apply();
- rm = new RowMutation("Keyspace2", ByteBufferUtil.bytes("k1"));
+ rm = new Mutation("Keyspace2", ByteBufferUtil.bytes("k1"));
rm.add("Indexed1", birthdate, ByteBufferUtil.bytes(2L), 2);
rm.apply();
@@ -401,7 +401,7 @@ public class ColumnFamilyStoreTest extends SchemaLoader
assert "k1".equals( key );
// update the birthdate value with an OLDER timestamp, and test that the index ignores this
- rm = new RowMutation("Keyspace2", ByteBufferUtil.bytes("k1"));
+ rm = new Mutation("Keyspace2", ByteBufferUtil.bytes("k1"));
rm.add("Indexed1", birthdate, ByteBufferUtil.bytes(3L), 0);
rm.apply();
@@ -427,8 +427,8 @@ public class ColumnFamilyStoreTest extends SchemaLoader
ByteBuffer val2 = ByteBufferUtil.bytes(2L);
// create a row and update the "birthdate" value, test that the index query fetches this version
- RowMutation rm;
- rm = new RowMutation(keySpace, rowKey);
+ Mutation rm;
+ rm = new Mutation(keySpace, rowKey);
rm.add(cfName, colName, val1, 0);
rm.apply();
IndexExpression expr = new IndexExpression(ByteBufferUtil.bytes("birthdate"), IndexExpression.Operator.EQ, val1);
@@ -442,7 +442,7 @@ public class ColumnFamilyStoreTest extends SchemaLoader
keyspace.getColumnFamilyStore(cfName).forceBlockingFlush();
// now apply another update, but force the index update to be skipped
- rm = new RowMutation(keySpace, rowKey);
+ rm = new Mutation(keySpace, rowKey);
rm.add(cfName, colName, val2, 1);
keyspace.apply(rm, true, false);
@@ -462,7 +462,7 @@ public class ColumnFamilyStoreTest extends SchemaLoader
// now, reset back to the original value, still skipping the index update, to
// make sure the value was expunged from the index when it was discovered to be inconsistent
- rm = new RowMutation(keySpace, rowKey);
+ rm = new Mutation(keySpace, rowKey);
rm.add(cfName, colName, ByteBufferUtil.bytes(1L), 3);
keyspace.apply(rm, true, false);
@@ -495,8 +495,8 @@ public class ColumnFamilyStoreTest extends SchemaLoader
ByteBuffer val2 = ByteBufferUtil.bytes("v2");
// create a row and update the author value
- RowMutation rm;
- rm = new RowMutation(keySpace, rowKey);
+ Mutation rm;
+ rm = new Mutation(keySpace, rowKey);
rm.add(cfName, compositeName, val1, 0);
rm.apply();
@@ -514,7 +514,7 @@ public class ColumnFamilyStoreTest extends SchemaLoader
assertEquals(1, rows.size());
// now apply another update, but force the index update to be skipped
- rm = new RowMutation(keySpace, rowKey);
+ rm = new Mutation(keySpace, rowKey);
rm.add(cfName, compositeName, val2, 1);
keyspace.apply(rm, true, false);
@@ -534,7 +534,7 @@ public class ColumnFamilyStoreTest extends SchemaLoader
// now, reset back to the original value, still skipping the index update, to
// make sure the value was expunged from the index when it was discovered to be inconsistent
- rm = new RowMutation(keySpace, rowKey);
+ rm = new Mutation(keySpace, rowKey);
rm.add(cfName, compositeName, val1, 2);
keyspace.apply(rm, true, false);
@@ -567,13 +567,13 @@ public class ColumnFamilyStoreTest extends SchemaLoader
ByteBuffer val1 = ByteBufferUtil.bytes("v2");
// Insert indexed value.
- RowMutation rm;
- rm = new RowMutation(keySpace, rowKey);
+ Mutation rm;
+ rm = new Mutation(keySpace, rowKey);
rm.add(cfName, compositeName, val1, 0);
rm.apply();
// Now delete the value and flush too.
- rm = new RowMutation(keySpace, rowKey);
+ rm = new Mutation(keySpace, rowKey);
rm.delete(cfName, 1);
rm.apply();
@@ -597,27 +597,27 @@ public class ColumnFamilyStoreTest extends SchemaLoader
public void testIndexScanWithLimitOne()
{
ColumnFamilyStore cfs = Keyspace.open("Keyspace1").getColumnFamilyStore("Indexed1");
- RowMutation rm;
+ Mutation rm;
CellName nobirthdate = cellname("notbirthdate");
CellName birthdate = cellname("birthdate");
- rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes("kk1"));
+ rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("kk1"));
rm.add("Indexed1", nobirthdate, ByteBufferUtil.bytes(1L), 0);
rm.add("Indexed1", birthdate, ByteBufferUtil.bytes(1L), 0);
rm.apply();
- rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes("kk2"));
+ rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("kk2"));
rm.add("Indexed1", nobirthdate, ByteBufferUtil.bytes(2L), 0);
rm.add("Indexed1", birthdate, ByteBufferUtil.bytes(1L), 0);
rm.apply();
- rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes("kk3"));
+ rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("kk3"));
rm.add("Indexed1", nobirthdate, ByteBufferUtil.bytes(2L), 0);
rm.add("Indexed1", birthdate, ByteBufferUtil.bytes(1L), 0);
rm.apply();
- rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes("kk4"));
+ rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("kk4"));
rm.add("Indexed1", nobirthdate, ByteBufferUtil.bytes(2L), 0);
rm.add("Indexed1", birthdate, ByteBufferUtil.bytes(1L), 0);
rm.apply();
@@ -641,8 +641,8 @@ public class ColumnFamilyStoreTest extends SchemaLoader
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore("Indexed2");
// create a row and update the birthdate value, test that the index query fetches the new version
- RowMutation rm;
- rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes("k1"));
+ Mutation rm;
+ rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("k1"));
rm.add("Indexed2", cellname("birthdate"), ByteBufferUtil.bytes(1L), 1);
rm.apply();
@@ -722,7 +722,7 @@ public class ColumnFamilyStoreTest extends SchemaLoader
assertRowAndColCount(1, 6, false, cfs.getRangeSlice(Util.range("f", "g"), null, ThriftValidation.asIFilter(sp, cfs.metadata, scfName), 100));
// delete
- RowMutation rm = new RowMutation(keyspace.getName(), key.key);
+ Mutation rm = new Mutation(keyspace.getName(), key.key);
rm.deleteRange(cfName, SuperColumns.startOf(scfName), SuperColumns.endOf(scfName), 2);
rm.apply();
@@ -776,7 +776,7 @@ public class ColumnFamilyStoreTest extends SchemaLoader
ColumnFamily cf = TreeMapBackedSortedColumns.factory.create(cfs.keyspace.getName(), cfs.name);
for (Cell col : cols)
cf.addColumn(col.withUpdatedName(CellNames.compositeDense(scfName, col.name().toByteBuffer())));
- RowMutation rm = new RowMutation(cfs.keyspace.getName(), key.key, cf);
+ Mutation rm = new Mutation(cfs.keyspace.getName(), key.key, cf);
rm.apply();
}
@@ -785,7 +785,7 @@ public class ColumnFamilyStoreTest extends SchemaLoader
ColumnFamily cf = TreeMapBackedSortedColumns.factory.create(cfs.keyspace.getName(), cfs.name);
for (Cell col : cols)
cf.addColumn(col);
- RowMutation rm = new RowMutation(cfs.keyspace.getName(), key.key, cf);
+ Mutation rm = new Mutation(cfs.keyspace.getName(), key.key, cf);
rm.apply();
}
@@ -817,7 +817,7 @@ public class ColumnFamilyStoreTest extends SchemaLoader
assertRowAndColCount(1, 4, false, cfs.getRangeSlice(Util.range("f", "g"), null, ThriftValidation.asIFilter(sp, cfs.metadata, null), 100));
// delete (from sstable and memtable)
- RowMutation rm = new RowMutation(keyspace.getName(), key.key);
+ Mutation rm = new Mutation(keyspace.getName(), key.key);
rm.delete(cfs.name, 2);
rm.apply();
@@ -850,13 +850,13 @@ public class ColumnFamilyStoreTest extends SchemaLoader
{
ColumnFamilyStore cfs = Keyspace.open("Keyspace2").getColumnFamilyStore("Standard1");
List<IMutation> rms = new LinkedList<IMutation>();
- RowMutation rm;
- rm = new RowMutation("Keyspace2", ByteBufferUtil.bytes("key1"));
+ Mutation rm;
+ rm = new Mutation("Keyspace2", ByteBufferUtil.bytes("key1"));
rm.add("Standard1", cellname("Column1"), ByteBufferUtil.bytes("asdf"), 0);
rms.add(rm);
Util.writeColumnFamily(rms);
- rm = new RowMutation("Keyspace2", ByteBufferUtil.bytes("key2"));
+ rm = new Mutation("Keyspace2", ByteBufferUtil.bytes("key2"));
rm.add("Standard1", cellname("Column1"), ByteBufferUtil.bytes("asdf"), 0);
rms.add(rm);
return Util.writeColumnFamily(rms);
@@ -1270,7 +1270,7 @@ public class ColumnFamilyStoreTest extends SchemaLoader
for (int i = 0; i < 10; i++)
{
ByteBuffer key = ByteBufferUtil.bytes(String.valueOf("k" + i));
- RowMutation rm = new RowMutation("Keyspace1", key);
+ Mutation rm = new Mutation("Keyspace1", key);
rm.add("Indexed1", cellname("birthdate"), LongType.instance.decompose(1L), System.currentTimeMillis());
rm.apply();
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/db/CommitLogTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/CommitLogTest.java b/test/unit/org/apache/cassandra/db/CommitLogTest.java
index 587e731..b51c17e 100644
--- a/test/unit/org/apache/cassandra/db/CommitLogTest.java
+++ b/test/unit/org/apache/cassandra/db/CommitLogTest.java
@@ -99,7 +99,7 @@ public class CommitLogTest extends SchemaLoader
{
CommitLog.instance.resetUnsafe();
// Roughly 32 MB mutation
- RowMutation rm = new RowMutation("Keyspace1", bytes("k"));
+ Mutation rm = new Mutation("Keyspace1", bytes("k"));
rm.add("Standard1", Util.cellname("c1"), ByteBuffer.allocate(DatabaseDescriptor.getCommitLogSegmentSize()/4), 0);
// Adding it 5 times
@@ -110,7 +110,7 @@ public class CommitLogTest extends SchemaLoader
CommitLog.instance.add(rm);
// Adding new mutation on another CF
- RowMutation rm2 = new RowMutation("Keyspace1", bytes("k"));
+ Mutation rm2 = new Mutation("Keyspace1", bytes("k"));
rm2.add("Standard2", Util.cellname("c1"), ByteBuffer.allocate(4), 0);
CommitLog.instance.add(rm2);
@@ -129,7 +129,7 @@ public class CommitLogTest extends SchemaLoader
DatabaseDescriptor.getCommitLogSegmentSize();
CommitLog.instance.resetUnsafe();
// Roughly 32 MB mutation
- RowMutation rm = new RowMutation("Keyspace1", bytes("k"));
+ Mutation rm = new Mutation("Keyspace1", bytes("k"));
rm.add("Standard1", Util.cellname("c1"), ByteBuffer.allocate((DatabaseDescriptor.getCommitLogSegmentSize()/4) - 1), 0);
// Adding it twice (won't change segment)
@@ -146,7 +146,7 @@ public class CommitLogTest extends SchemaLoader
assert CommitLog.instance.activeSegments() == 1 : "Expecting 1 segment, got " + CommitLog.instance.activeSegments();
// Adding new mutation on another CF, large enough (including CL entry overhead) that a new segment is created
- RowMutation rm2 = new RowMutation("Keyspace1", bytes("k"));
+ Mutation rm2 = new Mutation("Keyspace1", bytes("k"));
rm2.add("Standard2", Util.cellname("c1"), ByteBuffer.allocate((DatabaseDescriptor.getCommitLogSegmentSize()/2) - 100), 0);
CommitLog.instance.add(rm2);
// also forces a new segment, since each entry-with-overhead is just under half the CL size
@@ -172,7 +172,7 @@ public class CommitLogTest extends SchemaLoader
{
CommitLog.instance.resetUnsafe();
- RowMutation rm = new RowMutation("Keyspace1", bytes("k"));
+ Mutation rm = new Mutation("Keyspace1", bytes("k"));
rm.add("Standard1", Util.cellname("c1"), ByteBuffer.allocate((DatabaseDescriptor.getCommitLogSegmentSize()) - 83), 0);
CommitLog.instance.add(rm);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/db/CounterMutationTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/CounterMutationTest.java b/test/unit/org/apache/cassandra/db/CounterMutationTest.java
index 5cc97e4..dcfb508 100644
--- a/test/unit/org/apache/cassandra/db/CounterMutationTest.java
+++ b/test/unit/org/apache/cassandra/db/CounterMutationTest.java
@@ -36,12 +36,12 @@ public class CounterMutationTest extends SchemaLoader
@Test
public void testMergeOldShards() throws IOException
{
- RowMutation rm;
+ Mutation rm;
CounterMutation cm;
CounterId id1 = CounterId.getLocalId();
- rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes("key1"));
+ rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("key1"));
rm.addCounter("Counter1", Util.cellname("Column1"), 3);
cm = new CounterMutation(rm, ConsistencyLevel.ONE);
cm.apply();
@@ -49,7 +49,7 @@ public class CounterMutationTest extends SchemaLoader
CounterId.renewLocalId(2L); // faking time of renewal for test
CounterId id2 = CounterId.getLocalId();
- rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes("key1"));
+ rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("key1"));
rm.addCounter("Counter1", Util.cellname("Column1"), 4);
cm = new CounterMutation(rm, ConsistencyLevel.ONE);
cm.apply();
@@ -57,7 +57,7 @@ public class CounterMutationTest extends SchemaLoader
CounterId.renewLocalId(4L); // faking time of renewal for test
CounterId id3 = CounterId.getLocalId();
- rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes("key1"));
+ rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("key1"));
rm.addCounter("Counter1", Util.cellname("Column1"), 5);
rm.addCounter("Counter1", Util.cellname("Column2"), 1);
cm = new CounterMutation(rm, ConsistencyLevel.ONE);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/db/HintedHandOffTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/HintedHandOffTest.java b/test/unit/org/apache/cassandra/db/HintedHandOffTest.java
index 4978c57..10a7289 100644
--- a/test/unit/org/apache/cassandra/db/HintedHandOffTest.java
+++ b/test/unit/org/apache/cassandra/db/HintedHandOffTest.java
@@ -63,7 +63,7 @@ public class HintedHandOffTest extends SchemaLoader
hintStore.disableAutoCompaction();
// insert 1 hint
- RowMutation rm = new RowMutation(KEYSPACE4, ByteBufferUtil.bytes(1));
+ Mutation rm = new Mutation(KEYSPACE4, ByteBufferUtil.bytes(1));
rm.add(STANDARD1_CF, Util.cellname(COLUMN1), ByteBufferUtil.EMPTY_BYTE_BUFFER, System.currentTimeMillis());
HintedHandOffManager.instance.hintFor(rm, HintedHandOffManager.calculateHintTTL(rm), UUID.randomUUID()).apply();
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/db/KeyCacheTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/KeyCacheTest.java b/test/unit/org/apache/cassandra/db/KeyCacheTest.java
index dc5b22c..6ca5487 100644
--- a/test/unit/org/apache/cassandra/db/KeyCacheTest.java
+++ b/test/unit/org/apache/cassandra/db/KeyCacheTest.java
@@ -17,7 +17,6 @@
*/
package org.apache.cassandra.db;
-import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutionException;
@@ -114,13 +113,13 @@ public class KeyCacheTest extends SchemaLoader
DecoratedKey key1 = Util.dk("key1");
DecoratedKey key2 = Util.dk("key2");
- RowMutation rm;
+ Mutation rm;
// inserts
- rm = new RowMutation(KEYSPACE1, key1.key);
+ rm = new Mutation(KEYSPACE1, key1.key);
rm.add(COLUMN_FAMILY1, Util.cellname("1"), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
rm.apply();
- rm = new RowMutation(KEYSPACE1, key2.key);
+ rm = new Mutation(KEYSPACE1, key2.key);
rm.add(COLUMN_FAMILY1, Util.cellname("2"), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
rm.apply();
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/db/KeyCollisionTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/KeyCollisionTest.java b/test/unit/org/apache/cassandra/db/KeyCollisionTest.java
index 0f3e6d9..2c37f03 100644
--- a/test/unit/org/apache/cassandra/db/KeyCollisionTest.java
+++ b/test/unit/org/apache/cassandra/db/KeyCollisionTest.java
@@ -88,8 +88,8 @@ public class KeyCollisionTest extends SchemaLoader
private void insert(String key) throws IOException
{
- RowMutation rm;
- rm = new RowMutation(KEYSPACE, ByteBufferUtil.bytes(key));
+ Mutation rm;
+ rm = new Mutation(KEYSPACE, ByteBufferUtil.bytes(key));
rm.add(CF, Util.cellname("column"), ByteBufferUtil.bytes("asdf"), 0);
rm.apply();
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/db/KeyspaceTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/KeyspaceTest.java b/test/unit/org/apache/cassandra/db/KeyspaceTest.java
index fa2ddaf..ef69518 100644
--- a/test/unit/org/apache/cassandra/db/KeyspaceTest.java
+++ b/test/unit/org/apache/cassandra/db/KeyspaceTest.java
@@ -65,7 +65,7 @@ public class KeyspaceTest extends SchemaLoader
ColumnFamily cf = TreeMapBackedSortedColumns.factory.create("Keyspace2", "Standard3");
cf.addColumn(column("col1","val1", 1L));
- RowMutation rm = new RowMutation("Keyspace2", TEST_KEY.key, cf);
+ Mutation rm = new Mutation("Keyspace2", TEST_KEY.key, cf);
rm.apply();
Runnable verify = new WrappedRunnable()
@@ -97,7 +97,7 @@ public class KeyspaceTest extends SchemaLoader
cf.addColumn(column("col1","val1", 1L));
cf.addColumn(column("col2","val2", 1L));
cf.addColumn(column("col3","val3", 1L));
- RowMutation rm = new RowMutation("Keyspace1", TEST_KEY.key, cf);
+ Mutation rm = new Mutation("Keyspace1", TEST_KEY.key, cf);
rm.apply();
Runnable verify = new WrappedRunnable()
@@ -127,7 +127,7 @@ public class KeyspaceTest extends SchemaLoader
cf.addColumn(column("a", "val1", 1L));
cf.addColumn(column("b", "val2", 1L));
cf.addColumn(column("c", "val3", 1L));
- RowMutation rm = new RowMutation("Keyspace1", key.key, cf);
+ Mutation rm = new Mutation("Keyspace1", key.key, cf);
rm.apply();
cf = cfStore.getColumnFamily(key, cellname("b"), cellname("c"), false, 100, System.currentTimeMillis());
@@ -146,7 +146,7 @@ public class KeyspaceTest extends SchemaLoader
Keyspace keyspace = Keyspace.open("Keyspace1");
ColumnFamily cf = TreeMapBackedSortedColumns.factory.create("Keyspace1", "Standard2");
cf.addColumn(column("col1", "val1", 1));
- RowMutation rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes("row1000"), cf);
+ Mutation rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("row1000"), cf);
rm.apply();
validateGetSliceNoMatch(keyspace);
@@ -173,7 +173,7 @@ public class KeyspaceTest extends SchemaLoader
// 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));
- RowMutation rm = new RowMutation("Keyspace1", ROW.key, cf);
+ Mutation rm = new Mutation("Keyspace1", ROW.key, cf);
rm.apply();
Runnable verify = new WrappedRunnable()
@@ -228,7 +228,7 @@ public class KeyspaceTest extends SchemaLoader
{
ColumnFamily cf = TreeMapBackedSortedColumns.factory.create("Keyspace1", "StandardLong1");
cf.addColumn(new Cell(cellname((long)i), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0));
- RowMutation rm = new RowMutation("Keyspace1", ROW.key, cf);
+ Mutation rm = new Mutation("Keyspace1", ROW.key, cf);
rm.apply();
}
@@ -238,7 +238,7 @@ public class KeyspaceTest extends SchemaLoader
{
ColumnFamily cf = TreeMapBackedSortedColumns.factory.create("Keyspace1", "StandardLong1");
cf.addColumn(new Cell(cellname((long)i), ByteBufferUtil.EMPTY_BYTE_BUFFER, 0));
- RowMutation rm = new RowMutation("Keyspace1", ROW.key, cf);
+ Mutation rm = new Mutation("Keyspace1", ROW.key, cf);
rm.apply();
cf = cfs.getColumnFamily(ROW, Composites.EMPTY, Composites.EMPTY, true, 1, System.currentTimeMillis());
@@ -276,10 +276,10 @@ public class KeyspaceTest extends SchemaLoader
cf.addColumn(column("col5", "val5", 1L));
cf.addColumn(column("col7", "val7", 1L));
cf.addColumn(column("col9", "val9", 1L));
- RowMutation rm = new RowMutation("Keyspace1", ROW.key, cf);
+ Mutation rm = new Mutation("Keyspace1", ROW.key, cf);
rm.apply();
- rm = new RowMutation("Keyspace1", ROW.key);
+ rm = new Mutation("Keyspace1", ROW.key);
rm.delete("Standard1", cellname("col4"), 2L);
rm.apply();
@@ -328,7 +328,7 @@ public class KeyspaceTest extends SchemaLoader
cf.addColumn(column("col1", "val1", 1L));
cf.addColumn(expiringColumn("col2", "val2", 1L, 60)); // long enough not to be tombstoned
cf.addColumn(column("col3", "val3", 1L));
- RowMutation rm = new RowMutation("Keyspace1", ROW.key, cf);
+ Mutation rm = new Mutation("Keyspace1", ROW.key, cf);
rm.apply();
Runnable verify = new WrappedRunnable()
@@ -365,7 +365,7 @@ public class KeyspaceTest extends SchemaLoader
cf.addColumn(column("col4", "val4", 1L));
cf.addColumn(column("col5", "val5", 1L));
cf.addColumn(column("col6", "val6", 1L));
- RowMutation rm = new RowMutation("Keyspace1", ROW.key, cf);
+ Mutation rm = new Mutation("Keyspace1", ROW.key, cf);
rm.apply();
cfStore.forceBlockingFlush();
@@ -373,7 +373,7 @@ public class KeyspaceTest extends SchemaLoader
cf.addColumn(column("col1", "valx", 2L));
cf.addColumn(column("col2", "valx", 2L));
cf.addColumn(column("col3", "valx", 2L));
- rm = new RowMutation("Keyspace1", ROW.key, cf);
+ rm = new Mutation("Keyspace1", ROW.key, cf);
rm.apply();
Runnable verify = new WrappedRunnable()
@@ -409,7 +409,7 @@ public class KeyspaceTest extends SchemaLoader
ColumnFamily cf = TreeMapBackedSortedColumns.factory.create("Keyspace1", "Standard1");
for (int i = 1000; i < 2000; i++)
cf.addColumn(column("col" + i, ("v" + i), 1L));
- RowMutation rm = new RowMutation("Keyspace1", key.key, cf);
+ Mutation rm = new Mutation("Keyspace1", key.key, cf);
rm.apply();
cfStore.forceBlockingFlush();
@@ -442,7 +442,7 @@ public class KeyspaceTest extends SchemaLoader
{
cf.addColumn(column("col" + i, ("v" + i), i));
}
- RowMutation rm = new RowMutation("Keyspace1", key.key, cf);
+ Mutation rm = new Mutation("Keyspace1", key.key, cf);
rm.apply();
cfStore.forceBlockingFlush();
}
@@ -506,7 +506,7 @@ public class KeyspaceTest extends SchemaLoader
{
for (int i = 0; i < 10; i++)
{
- RowMutation rm = new RowMutation("Keyspace1", key.key);
+ Mutation rm = new Mutation("Keyspace1", key.key);
CellName colName = type.makeCellName(ByteBufferUtil.bytes("a" + i), ByteBufferUtil.bytes(j*10 + i));
rm.add("StandardComposite2", colName, ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
rm.apply();
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/db/MultitableTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/MultitableTest.java b/test/unit/org/apache/cassandra/db/MultitableTest.java
index 3d0c8ac..dc8208e 100644
--- a/test/unit/org/apache/cassandra/db/MultitableTest.java
+++ b/test/unit/org/apache/cassandra/db/MultitableTest.java
@@ -39,18 +39,18 @@ public class MultitableTest extends SchemaLoader
Keyspace keyspace1 = Keyspace.open("Keyspace1");
Keyspace keyspace2 = Keyspace.open("Keyspace2");
- RowMutation rm;
+ Mutation rm;
DecoratedKey dk = Util.dk("keymulti");
ColumnFamily cf;
cf = TreeMapBackedSortedColumns.factory.create("Keyspace1", "Standard1");
cf.addColumn(column("col1", "val1", 1L));
- rm = new RowMutation("Keyspace1", dk.key, cf);
+ rm = new Mutation("Keyspace1", dk.key, cf);
rm.apply();
cf = TreeMapBackedSortedColumns.factory.create("Keyspace2", "Standard1");
cf.addColumn(column("col2", "val2", 1L));
- rm = new RowMutation("Keyspace2", dk.key, cf);
+ rm = new Mutation("Keyspace2", dk.key, cf);
rm.apply();
keyspace1.getColumnFamilyStore("Standard1").forceBlockingFlush();
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/db/NameSortTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/NameSortTest.java b/test/unit/org/apache/cassandra/db/NameSortTest.java
index 16a1bc0..6bd71c7 100644
--- a/test/unit/org/apache/cassandra/db/NameSortTest.java
+++ b/test/unit/org/apache/cassandra/db/NameSortTest.java
@@ -60,13 +60,13 @@ public class NameSortTest extends SchemaLoader
for (int i = 0; i < N; ++i)
{
ByteBuffer key = ByteBufferUtil.bytes(Integer.toString(i));
- RowMutation rm;
+ Mutation rm;
// standard
for (int j = 0; j < 8; ++j)
{
ByteBuffer bytes = j % 2 == 0 ? ByteBufferUtil.bytes("a") : ByteBufferUtil.bytes("b");
- rm = new RowMutation("Keyspace1", key);
+ rm = new Mutation("Keyspace1", key);
rm.add("Standard1", Util.cellname("Cell-" + j), bytes, j);
rm.applyUnsafe();
}
@@ -74,7 +74,7 @@ public class NameSortTest extends SchemaLoader
// super
for (int j = 0; j < 8; ++j)
{
- rm = new RowMutation("Keyspace1", key);
+ rm = new Mutation("Keyspace1", key);
for (int k = 0; k < 4; ++k)
{
String value = (j + k) % 2 == 0 ? "a" : "b";
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java b/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java
index 5c37a30..3bbf4b8 100644
--- a/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java
+++ b/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java
@@ -56,28 +56,28 @@ public class RangeTombstoneTest extends SchemaLoader
// Inserting data
String key = "k1";
- RowMutation rm;
+ Mutation rm;
ColumnFamily cf;
- rm = new RowMutation(KSNAME, ByteBufferUtil.bytes(key));
+ rm = new Mutation(KSNAME, ByteBufferUtil.bytes(key));
for (int i = 0; i < 40; i += 2)
add(rm, i, 0);
rm.apply();
cfs.forceBlockingFlush();
- rm = new RowMutation(KSNAME, ByteBufferUtil.bytes(key));
+ rm = new Mutation(KSNAME, ByteBufferUtil.bytes(key));
cf = rm.addOrGet(CFNAME);
delete(cf, 10, 22, 1);
rm.apply();
cfs.forceBlockingFlush();
- rm = new RowMutation(KSNAME, ByteBufferUtil.bytes(key));
+ rm = new Mutation(KSNAME, ByteBufferUtil.bytes(key));
for (int i = 1; i < 40; i += 2)
add(rm, i, 2);
rm.apply();
cfs.forceBlockingFlush();
- rm = new RowMutation(KSNAME, ByteBufferUtil.bytes(key));
+ rm = new Mutation(KSNAME, ByteBufferUtil.bytes(key));
cf = rm.addOrGet(CFNAME);
delete(cf, 19, 27, 3);
rm.apply();
@@ -116,28 +116,28 @@ public class RangeTombstoneTest extends SchemaLoader
// Inserting data
String key = "k2";
- RowMutation rm;
+ Mutation rm;
ColumnFamily cf;
- rm = new RowMutation(KSNAME, ByteBufferUtil.bytes(key));
+ rm = new Mutation(KSNAME, ByteBufferUtil.bytes(key));
for (int i = 0; i < 20; i++)
add(rm, i, 0);
rm.apply();
cfs.forceBlockingFlush();
- rm = new RowMutation(KSNAME, ByteBufferUtil.bytes(key));
+ rm = new Mutation(KSNAME, ByteBufferUtil.bytes(key));
cf = rm.addOrGet(CFNAME);
delete(cf, 5, 15, 1);
rm.apply();
cfs.forceBlockingFlush();
- rm = new RowMutation(KSNAME, ByteBufferUtil.bytes(key));
+ rm = new Mutation(KSNAME, ByteBufferUtil.bytes(key));
cf = rm.addOrGet(CFNAME);
delete(cf, 5, 10, 1);
rm.apply();
cfs.forceBlockingFlush();
- rm = new RowMutation(KSNAME, ByteBufferUtil.bytes(key));
+ rm = new Mutation(KSNAME, ByteBufferUtil.bytes(key));
cf = rm.addOrGet(CFNAME);
delete(cf, 5, 8, 2);
rm.apply();
@@ -172,15 +172,15 @@ public class RangeTombstoneTest extends SchemaLoader
// Inserting data
String key = "k3";
- RowMutation rm;
+ Mutation rm;
ColumnFamily cf;
- rm = new RowMutation(KSNAME, ByteBufferUtil.bytes(key));
+ rm = new Mutation(KSNAME, ByteBufferUtil.bytes(key));
add(rm, 2, 0);
rm.apply();
cfs.forceBlockingFlush();
- rm = new RowMutation(KSNAME, ByteBufferUtil.bytes(key));
+ rm = new Mutation(KSNAME, ByteBufferUtil.bytes(key));
// Deletes everything but without being a row tombstone
delete(rm.addOrGet(CFNAME), 0, 10, 1);
add(rm, 1, 2);
@@ -222,13 +222,13 @@ public class RangeTombstoneTest extends SchemaLoader
cfs.disableAutoCompaction();
cfs.setCompactionStrategyClass(SizeTieredCompactionStrategy.class.getCanonicalName());
- RowMutation rm = new RowMutation(KSNAME, key);
+ Mutation rm = new Mutation(KSNAME, key);
for (int i = 0; i < 10; i += 2)
add(rm, i, 0);
rm.apply();
cfs.forceBlockingFlush();
- rm = new RowMutation(KSNAME, key);
+ rm = new Mutation(KSNAME, key);
ColumnFamily cf = rm.addOrGet(CFNAME);
for (int i = 0; i < 10; i += 2)
delete(cf, 0, 7, 0);
@@ -280,7 +280,7 @@ public class RangeTombstoneTest extends SchemaLoader
TestIndex index = ((TestIndex)cfs.indexManager.getIndexForColumn(indexedColumnName));
index.resetCounts();
- RowMutation rm = new RowMutation(KSNAME, key);
+ Mutation rm = new Mutation(KSNAME, key);
for (int i = 0; i < 10; i++)
add(rm, i, 0);
rm.apply();
@@ -288,7 +288,7 @@ public class RangeTombstoneTest extends SchemaLoader
// We should have indexed 1 column
assertEquals(1, index.inserts.size());
- rm = new RowMutation(KSNAME, key);
+ rm = new Mutation(KSNAME, key);
ColumnFamily cf = rm.addOrGet(CFNAME);
for (int i = 0; i < 10; i += 2)
delete(cf, 0, 7, 0);
@@ -319,13 +319,13 @@ public class RangeTombstoneTest extends SchemaLoader
TestIndex index = ((TestIndex)cfs.indexManager.getIndexForColumn(indexedColumnName));
index.resetCounts();
- RowMutation rm = new RowMutation(KSNAME, key);
+ Mutation rm = new Mutation(KSNAME, key);
for (int i = 0; i < 10; i++)
add(rm, i, 0);
rm.apply();
cfs.forceBlockingFlush();
- rm = new RowMutation(KSNAME, key);
+ rm = new Mutation(KSNAME, key);
ColumnFamily cf = rm.addOrGet(CFNAME);
for (int i = 0; i < 10; i += 2)
delete(cf, 0, 7, 0);
@@ -360,7 +360,7 @@ public class RangeTombstoneTest extends SchemaLoader
return ByteBufferUtil.toInt(i.toByteBuffer());
}
- private static void add(RowMutation rm, int value, long timestamp)
+ private static void add(Mutation rm, int value, long timestamp)
{
rm.add(CFNAME, b(value), ByteBufferUtil.bytes(value), timestamp);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/db/ReadMessageTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/ReadMessageTest.java b/test/unit/org/apache/cassandra/db/ReadMessageTest.java
index 1f73b35..d54594f 100644
--- a/test/unit/org/apache/cassandra/db/ReadMessageTest.java
+++ b/test/unit/org/apache/cassandra/db/ReadMessageTest.java
@@ -83,11 +83,11 @@ public class ReadMessageTest extends SchemaLoader
{
Keyspace keyspace = Keyspace.open("Keyspace1");
CellNameType type = keyspace.getColumnFamilyStore("Standard1").getComparator();
- RowMutation rm;
+ Mutation rm;
DecoratedKey dk = Util.dk("key1");
// add data
- rm = new RowMutation("Keyspace1", dk.key);
+ rm = new Mutation("Keyspace1", dk.key);
rm.add("Standard1", Util.cellname("Column1"), ByteBufferUtil.bytes("abcd"), 0);
rm.apply();
@@ -100,11 +100,11 @@ public class ReadMessageTest extends SchemaLoader
@Test
public void testNoCommitLog() throws Exception
{
- RowMutation rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes("row"));
+ Mutation rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("row"));
rm.add("Standard1", Util.cellname("commit1"), ByteBufferUtil.bytes("abcd"), 0);
rm.apply();
- rm = new RowMutation("NoCommitlogSpace", ByteBufferUtil.bytes("row"));
+ rm = new Mutation("NoCommitlogSpace", ByteBufferUtil.bytes("row"));
rm.add("Standard1", Util.cellname("commit2"), ByteBufferUtil.bytes("abcd"), 0);
rm.apply();
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/db/RecoveryManager2Test.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/RecoveryManager2Test.java b/test/unit/org/apache/cassandra/db/RecoveryManager2Test.java
index ac2d642..8e4145c 100644
--- a/test/unit/org/apache/cassandra/db/RecoveryManager2Test.java
+++ b/test/unit/org/apache/cassandra/db/RecoveryManager2Test.java
@@ -73,7 +73,7 @@ public class RecoveryManager2Test extends SchemaLoader
{
ColumnFamily cf = TreeMapBackedSortedColumns.factory.create("Keyspace1", cfname);
cf.addColumn(column("col1", "val1", 1L));
- RowMutation rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes(key), cf);
+ Mutation rm = new Mutation("Keyspace1", ByteBufferUtil.bytes(key), cf);
rm.apply();
}
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/db/RecoveryManager3Test.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/RecoveryManager3Test.java b/test/unit/org/apache/cassandra/db/RecoveryManager3Test.java
index 8258970..be11967 100644
--- a/test/unit/org/apache/cassandra/db/RecoveryManager3Test.java
+++ b/test/unit/org/apache/cassandra/db/RecoveryManager3Test.java
@@ -44,18 +44,18 @@ public class RecoveryManager3Test extends SchemaLoader
Keyspace keyspace1 = Keyspace.open("Keyspace1");
Keyspace keyspace2 = Keyspace.open("Keyspace2");
- RowMutation rm;
+ Mutation rm;
DecoratedKey dk = Util.dk("keymulti");
ColumnFamily cf;
cf = TreeMapBackedSortedColumns.factory.create("Keyspace1", "Standard1");
cf.addColumn(column("col1", "val1", 1L));
- rm = new RowMutation("Keyspace1", dk.key, cf);
+ rm = new Mutation("Keyspace1", dk.key, cf);
rm.apply();
cf = TreeMapBackedSortedColumns.factory.create("Keyspace2", "Standard3");
cf.addColumn(column("col2", "val2", 1L));
- rm = new RowMutation("Keyspace2", dk.key, cf);
+ rm = new Mutation("Keyspace2", dk.key, cf);
rm.apply();
keyspace1.getColumnFamilyStore("Standard1").clearUnsafe();
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/db/RecoveryManagerTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/RecoveryManagerTest.java b/test/unit/org/apache/cassandra/db/RecoveryManagerTest.java
index 0c3c23a..9f73ff2 100644
--- a/test/unit/org/apache/cassandra/db/RecoveryManagerTest.java
+++ b/test/unit/org/apache/cassandra/db/RecoveryManagerTest.java
@@ -48,18 +48,18 @@ public class RecoveryManagerTest extends SchemaLoader
Keyspace keyspace1 = Keyspace.open("Keyspace1");
Keyspace keyspace2 = Keyspace.open("Keyspace2");
- RowMutation rm;
+ Mutation rm;
DecoratedKey dk = Util.dk("keymulti");
ColumnFamily cf;
cf = TreeMapBackedSortedColumns.factory.create("Keyspace1", "Standard1");
cf.addColumn(column("col1", "val1", 1L));
- rm = new RowMutation("Keyspace1", dk.key, cf);
+ rm = new Mutation("Keyspace1", dk.key, cf);
rm.apply();
cf = TreeMapBackedSortedColumns.factory.create("Keyspace2", "Standard3");
cf.addColumn(column("col2", "val2", 1L));
- rm = new RowMutation("Keyspace2", dk.key, cf);
+ rm = new Mutation("Keyspace2", dk.key, cf);
rm.apply();
keyspace1.getColumnFamilyStore("Standard1").clearUnsafe();
@@ -77,7 +77,7 @@ public class RecoveryManagerTest extends SchemaLoader
{
Keyspace keyspace1 = Keyspace.open("Keyspace1");
- RowMutation rm;
+ Mutation rm;
DecoratedKey dk = Util.dk("key");
ColumnFamily cf;
@@ -85,7 +85,7 @@ public class RecoveryManagerTest extends SchemaLoader
{
cf = TreeMapBackedSortedColumns.factory.create("Keyspace1", "Counter1");
cf.addColumn(new CounterCell(cellname("col"), 1L, 1L));
- rm = new RowMutation("Keyspace1", dk.key, cf);
+ rm = new Mutation("Keyspace1", dk.key, cf);
rm.apply();
}
@@ -116,7 +116,7 @@ public class RecoveryManagerTest extends SchemaLoader
long ts = TimeUnit.MILLISECONDS.toMicros(timeMS + (i * 1000));
ColumnFamily cf = TreeMapBackedSortedColumns.factory.create("Keyspace1", "Standard1");
cf.addColumn(column("name-" + i, "value", ts));
- RowMutation rm = new RowMutation("Keyspace1", dk.key, cf);
+ Mutation rm = new Mutation("Keyspace1", dk.key, cf);
rm.apply();
}
keyspace1.getColumnFamilyStore("Standard1").clearUnsafe();
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/db/RecoveryManagerTruncateTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/RecoveryManagerTruncateTest.java b/test/unit/org/apache/cassandra/db/RecoveryManagerTruncateTest.java
index a5e3876..16ab04a 100644
--- a/test/unit/org/apache/cassandra/db/RecoveryManagerTruncateTest.java
+++ b/test/unit/org/apache/cassandra/db/RecoveryManagerTruncateTest.java
@@ -42,13 +42,13 @@ public class RecoveryManagerTruncateTest extends SchemaLoader
Keyspace keyspace = Keyspace.open("Keyspace1");
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore("Standard1");
- RowMutation rm;
+ Mutation rm;
ColumnFamily cf;
// add a single cell
cf = TreeMapBackedSortedColumns.factory.create("Keyspace1", "Standard1");
cf.addColumn(column("col1", "val1", 1L));
- rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes("keymulti"), cf);
+ rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("keymulti"), cf);
rm.apply();
// Make sure data was written
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/db/RemoveCellTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/RemoveCellTest.java b/test/unit/org/apache/cassandra/db/RemoveCellTest.java
index 1b03122..629b40d 100644
--- a/test/unit/org/apache/cassandra/db/RemoveCellTest.java
+++ b/test/unit/org/apache/cassandra/db/RemoveCellTest.java
@@ -37,17 +37,17 @@ public class RemoveCellTest extends SchemaLoader
{
Keyspace keyspace = Keyspace.open("Keyspace1");
ColumnFamilyStore store = keyspace.getColumnFamilyStore("Standard1");
- RowMutation rm;
+ Mutation rm;
DecoratedKey dk = Util.dk("key1");
// add data
- rm = new RowMutation("Keyspace1", dk.key);
+ rm = new Mutation("Keyspace1", dk.key);
rm.add("Standard1", Util.cellname("Column1"), ByteBufferUtil.bytes("asdf"), 0);
rm.apply();
store.forceBlockingFlush();
// remove
- rm = new RowMutation("Keyspace1", dk.key);
+ rm = new Mutation("Keyspace1", dk.key);
rm.delete("Standard1", Util.cellname("Column1"), 1);
rm.apply();
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/db/RemoveColumnFamilyTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/RemoveColumnFamilyTest.java b/test/unit/org/apache/cassandra/db/RemoveColumnFamilyTest.java
index 236ba10..b80b9d1 100644
--- a/test/unit/org/apache/cassandra/db/RemoveColumnFamilyTest.java
+++ b/test/unit/org/apache/cassandra/db/RemoveColumnFamilyTest.java
@@ -35,16 +35,16 @@ public class RemoveColumnFamilyTest extends SchemaLoader
{
Keyspace keyspace = Keyspace.open("Keyspace1");
ColumnFamilyStore store = keyspace.getColumnFamilyStore("Standard1");
- RowMutation rm;
+ Mutation rm;
DecoratedKey dk = Util.dk("key1");
// add data
- rm = new RowMutation("Keyspace1", dk.key);
+ rm = new Mutation("Keyspace1", dk.key);
rm.add("Standard1", Util.cellname("Column1"), ByteBufferUtil.bytes("asdf"), 0);
rm.apply();
// remove
- rm = new RowMutation("Keyspace1", dk.key);
+ rm = new Mutation("Keyspace1", dk.key);
rm.delete("Standard1", 1);
rm.apply();
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush1Test.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush1Test.java b/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush1Test.java
index 1bfb140..c95ab97 100644
--- a/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush1Test.java
+++ b/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush1Test.java
@@ -35,18 +35,18 @@ public class RemoveColumnFamilyWithFlush1Test extends SchemaLoader
{
Keyspace keyspace = Keyspace.open("Keyspace1");
ColumnFamilyStore store = keyspace.getColumnFamilyStore("Standard1");
- RowMutation rm;
+ Mutation rm;
DecoratedKey dk = Util.dk("key1");
// add data
- rm = new RowMutation("Keyspace1", dk.key);
+ rm = new Mutation("Keyspace1", dk.key);
rm.add("Standard1", Util.cellname("Column1"), ByteBufferUtil.bytes("asdf"), 0);
rm.add("Standard1", Util.cellname("Column2"), ByteBufferUtil.bytes("asdf"), 0);
rm.apply();
store.forceBlockingFlush();
// remove
- rm = new RowMutation("Keyspace1", dk.key);
+ rm = new Mutation("Keyspace1", dk.key);
rm.delete("Standard1", 1);
rm.apply();
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush2Test.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush2Test.java b/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush2Test.java
index 9c8aba1..df81d58 100644
--- a/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush2Test.java
+++ b/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush2Test.java
@@ -35,15 +35,15 @@ public class RemoveColumnFamilyWithFlush2Test extends SchemaLoader
{
Keyspace keyspace = Keyspace.open("Keyspace1");
ColumnFamilyStore store = keyspace.getColumnFamilyStore("Standard1");
- RowMutation rm;
+ Mutation rm;
DecoratedKey dk = Util.dk("key1");
// add data
- rm = new RowMutation("Keyspace1", dk.key);
+ rm = new Mutation("Keyspace1", dk.key);
rm.add("Standard1", Util.cellname("Column1"), ByteBufferUtil.bytes("asdf"), 0);
rm.apply();
// remove
- rm = new RowMutation("Keyspace1", dk.key);
+ rm = new Mutation("Keyspace1", dk.key);
rm.delete("Standard1", 1);
rm.apply();
store.forceBlockingFlush();
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/db/RemoveSubCellTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/RemoveSubCellTest.java b/test/unit/org/apache/cassandra/db/RemoveSubCellTest.java
index 9c3d29c..3026897 100644
--- a/test/unit/org/apache/cassandra/db/RemoveSubCellTest.java
+++ b/test/unit/org/apache/cassandra/db/RemoveSubCellTest.java
@@ -26,7 +26,7 @@ import org.junit.Test;
import static org.junit.Assert.assertNull;
import org.apache.cassandra.db.composites.*;
import org.apache.cassandra.db.filter.QueryFilter;
-import org.apache.cassandra.db.marshal.CompositeType;
+
import static org.apache.cassandra.Util.getBytes;
import org.apache.cassandra.Util;
import org.apache.cassandra.SchemaLoader;
@@ -42,18 +42,18 @@ public class RemoveSubCellTest extends SchemaLoader
{
Keyspace keyspace = Keyspace.open("Keyspace1");
ColumnFamilyStore store = keyspace.getColumnFamilyStore("Super1");
- RowMutation rm;
+ Mutation rm;
DecoratedKey dk = Util.dk("key1");
// add data
- rm = new RowMutation("Keyspace1", dk.key);
+ rm = new Mutation("Keyspace1", dk.key);
Util.addMutation(rm, "Super1", "SC1", 1, "asdf", 0);
rm.apply();
store.forceBlockingFlush();
CellName cname = CellNames.compositeDense(ByteBufferUtil.bytes("SC1"), getBytes(1L));
// remove
- rm = new RowMutation("Keyspace1", dk.key);
+ rm = new Mutation("Keyspace1", dk.key);
rm.delete("Super1", cname, 1);
rm.apply();
@@ -67,11 +67,11 @@ public class RemoveSubCellTest extends SchemaLoader
{
Keyspace keyspace = Keyspace.open("Keyspace1");
ColumnFamilyStore store = keyspace.getColumnFamilyStore("Super1");
- RowMutation rm;
+ Mutation rm;
DecoratedKey dk = Util.dk("key2");
// add data
- rm = new RowMutation("Keyspace1", dk.key);
+ rm = new Mutation("Keyspace1", dk.key);
Util.addMutation(rm, "Super1", "SC1", 1, "asdf", 0);
rm.apply();
store.forceBlockingFlush();
@@ -79,7 +79,7 @@ public class RemoveSubCellTest extends SchemaLoader
// remove the SC
ByteBuffer scName = ByteBufferUtil.bytes("SC1");
CellName cname = CellNames.compositeDense(scName, getBytes(1L));
- rm = new RowMutation("Keyspace1", dk.key);
+ rm = new Mutation("Keyspace1", dk.key);
rm.deleteRange("Super1", SuperColumns.startOf(scName), SuperColumns.endOf(scName), 1);
rm.apply();
@@ -89,7 +89,7 @@ public class RemoveSubCellTest extends SchemaLoader
Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS);
// remove the column itself
- rm = new RowMutation("Keyspace1", dk.key);
+ rm = new Mutation("Keyspace1", dk.key);
rm.delete("Super1", cname, 2);
rm.apply();
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/db/RowIterationTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/RowIterationTest.java b/test/unit/org/apache/cassandra/db/RowIterationTest.java
index 9ec7bec..fcdd2e1 100644
--- a/test/unit/org/apache/cassandra/db/RowIterationTest.java
+++ b/test/unit/org/apache/cassandra/db/RowIterationTest.java
@@ -31,7 +31,6 @@ import org.junit.Test;
import org.apache.cassandra.SchemaLoader;
import org.apache.cassandra.db.composites.*;
-import org.apache.cassandra.db.marshal.CompositeType;
import org.apache.cassandra.utils.FBUtilities;
import static org.junit.Assert.assertEquals;
import org.apache.cassandra.utils.ByteBufferUtil;
@@ -52,7 +51,7 @@ public class RowIterationTest extends SchemaLoader
Set<DecoratedKey> inserted = new HashSet<DecoratedKey>();
for (int i = 0; i < ROWS_PER_SSTABLE; i++) {
DecoratedKey key = Util.dk(String.valueOf(i));
- RowMutation rm = new RowMutation(KEYSPACE1, key.key);
+ Mutation rm = new Mutation(KEYSPACE1, key.key);
rm.add("Super3", CellNames.compositeDense(ByteBufferUtil.bytes("sc"), ByteBufferUtil.bytes(String.valueOf(i))), ByteBuffer.wrap(new byte[ROWS_PER_SSTABLE * 10 - i * 2]), i);
rm.apply();
inserted.add(key);
@@ -70,7 +69,7 @@ public class RowIterationTest extends SchemaLoader
DecoratedKey key = Util.dk("key");
// Delete row in first sstable
- RowMutation rm = new RowMutation(KEYSPACE1, key.key);
+ Mutation rm = new Mutation(KEYSPACE1, key.key);
rm.delete(CF_NAME, 0);
rm.add(CF_NAME, Util.cellname("c"), ByteBufferUtil.bytes("values"), 0L);
DeletionInfo delInfo1 = rm.getColumnFamilies().iterator().next().deletionInfo();
@@ -78,7 +77,7 @@ public class RowIterationTest extends SchemaLoader
store.forceBlockingFlush();
// Delete row in second sstable with higher timestamp
- rm = new RowMutation(KEYSPACE1, key.key);
+ rm = new Mutation(KEYSPACE1, key.key);
rm.delete(CF_NAME, 1);
rm.add(CF_NAME, Util.cellname("c"), ByteBufferUtil.bytes("values"), 1L);
DeletionInfo delInfo2 = rm.getColumnFamilies().iterator().next().deletionInfo();
@@ -99,7 +98,7 @@ public class RowIterationTest extends SchemaLoader
DecoratedKey key = Util.dk("key");
// Delete a row in first sstable
- RowMutation rm = new RowMutation(KEYSPACE1, key.key);
+ Mutation rm = new Mutation(KEYSPACE1, key.key);
rm.delete(CF_NAME, 0);
rm.apply();
store.forceBlockingFlush();
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/db/ScrubTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/ScrubTest.java b/test/unit/org/apache/cassandra/db/ScrubTest.java
index 614858d..38c8b62 100644
--- a/test/unit/org/apache/cassandra/db/ScrubTest.java
+++ b/test/unit/org/apache/cassandra/db/ScrubTest.java
@@ -85,7 +85,7 @@ public class ScrubTest extends SchemaLoader
ColumnFamily cf = TreeMapBackedSortedColumns.factory.create(KEYSPACE, CF3);
cf.delete(new DeletionInfo(0, 1)); // expired tombstone
- RowMutation rm = new RowMutation(KEYSPACE, ByteBufferUtil.bytes(1), cf);
+ Mutation rm = new Mutation(KEYSPACE, ByteBufferUtil.bytes(1), cf);
rm.applyUnsafe();
cfs.forceBlockingFlush();
@@ -201,7 +201,7 @@ public class ScrubTest extends SchemaLoader
ColumnFamily cf = TreeMapBackedSortedColumns.factory.create(KEYSPACE, CF);
cf.addColumn(column("c1", "1", 1L));
cf.addColumn(column("c2", "2", 1L));
- RowMutation rm = new RowMutation(KEYSPACE, ByteBufferUtil.bytes(key), cf);
+ Mutation rm = new Mutation(KEYSPACE, ByteBufferUtil.bytes(key), cf);
rm.applyUnsafe();
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/db/SerializationsTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/SerializationsTest.java b/test/unit/org/apache/cassandra/db/SerializationsTest.java
index 983a8f7..2bc1493 100644
--- a/test/unit/org/apache/cassandra/db/SerializationsTest.java
+++ b/test/unit/org/apache/cassandra/db/SerializationsTest.java
@@ -210,23 +210,23 @@ public class SerializationsTest extends AbstractSerializationsTester
in.close();
}
- private void testRowMutationWrite() throws IOException
+ private void testMutationWrite() throws IOException
{
- RowMutation standardRowRm = new RowMutation(statics.KS, statics.StandardRow);
- RowMutation superRowRm = new RowMutation(statics.KS, statics.SuperRow);
- RowMutation standardRm = new RowMutation(statics.KS, statics.Key, statics.StandardCf);
- RowMutation superRm = new RowMutation(statics.KS, statics.Key, statics.SuperCf);
+ Mutation standardRowRm = new Mutation(statics.KS, statics.StandardRow);
+ Mutation superRowRm = new Mutation(statics.KS, statics.SuperRow);
+ Mutation standardRm = new Mutation(statics.KS, statics.Key, statics.StandardCf);
+ Mutation superRm = new Mutation(statics.KS, statics.Key, statics.SuperCf);
Map<UUID, ColumnFamily> mods = new HashMap<UUID, ColumnFamily>();
mods.put(statics.StandardCf.metadata().cfId, statics.StandardCf);
mods.put(statics.SuperCf.metadata().cfId, statics.SuperCf);
- RowMutation mixedRm = new RowMutation(statics.KS, statics.Key, mods);
+ Mutation mixedRm = new Mutation(statics.KS, statics.Key, mods);
DataOutputStream out = getOutput("db.RowMutation.bin");
- RowMutation.serializer.serialize(standardRowRm, out, getVersion());
- RowMutation.serializer.serialize(superRowRm, out, getVersion());
- RowMutation.serializer.serialize(standardRm, out, getVersion());
- RowMutation.serializer.serialize(superRm, out, getVersion());
- RowMutation.serializer.serialize(mixedRm, out, getVersion());
+ Mutation.serializer.serialize(standardRowRm, out, getVersion());
+ Mutation.serializer.serialize(superRowRm, out, getVersion());
+ Mutation.serializer.serialize(standardRm, out, getVersion());
+ Mutation.serializer.serialize(superRm, out, getVersion());
+ Mutation.serializer.serialize(mixedRm, out, getVersion());
standardRowRm.createMessage().serialize(out, getVersion());
superRowRm.createMessage().serialize(out, getVersion());
@@ -237,27 +237,27 @@ public class SerializationsTest extends AbstractSerializationsTester
out.close();
// test serializedSize
- testSerializedSize(standardRowRm, RowMutation.serializer);
- testSerializedSize(superRowRm, RowMutation.serializer);
- testSerializedSize(standardRm, RowMutation.serializer);
- testSerializedSize(superRm, RowMutation.serializer);
- testSerializedSize(mixedRm, RowMutation.serializer);
+ testSerializedSize(standardRowRm, Mutation.serializer);
+ testSerializedSize(superRowRm, Mutation.serializer);
+ testSerializedSize(standardRm, Mutation.serializer);
+ testSerializedSize(superRm, Mutation.serializer);
+ testSerializedSize(mixedRm, Mutation.serializer);
}
@Test
- public void testRowMutationRead() throws IOException
+ public void testMutationRead() throws IOException
{
- // row mutation deserialization requires being able to look up the keyspace in the schema,
+ // mutation deserialization requires being able to look up the keyspace in the schema,
// so we need to rewrite this each time. We can go back to testing on-disk data
// once we pull RM.keyspace field out.
- testRowMutationWrite();
+ testMutationWrite();
DataInputStream in = getInput("db.RowMutation.bin");
- assert RowMutation.serializer.deserialize(in, getVersion()) != null;
- assert RowMutation.serializer.deserialize(in, getVersion()) != null;
- assert RowMutation.serializer.deserialize(in, getVersion()) != null;
- assert RowMutation.serializer.deserialize(in, getVersion()) != null;
- assert RowMutation.serializer.deserialize(in, getVersion()) != null;
+ assert Mutation.serializer.deserialize(in, getVersion()) != null;
+ assert Mutation.serializer.deserialize(in, getVersion()) != null;
+ assert Mutation.serializer.deserialize(in, getVersion()) != null;
+ assert Mutation.serializer.deserialize(in, getVersion()) != null;
+ assert Mutation.serializer.deserialize(in, getVersion()) != null;
assert MessageIn.read(in, getVersion(), -1) != null;
assert MessageIn.read(in, getVersion(), -1) != null;
assert MessageIn.read(in, getVersion(), -1) != null;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6bbb13b9/test/unit/org/apache/cassandra/db/TimeSortTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/TimeSortTest.java b/test/unit/org/apache/cassandra/db/TimeSortTest.java
index f8e9dbc..c7a4a57 100644
--- a/test/unit/org/apache/cassandra/db/TimeSortTest.java
+++ b/test/unit/org/apache/cassandra/db/TimeSortTest.java
@@ -42,15 +42,15 @@ public class TimeSortTest extends SchemaLoader
{
Keyspace keyspace = Keyspace.open("Keyspace1");
ColumnFamilyStore cfStore = keyspace.getColumnFamilyStore("StandardLong1");
- RowMutation rm;
+ Mutation rm;
DecoratedKey key = Util.dk("key0");
- rm = new RowMutation("Keyspace1", key.key);
+ rm = new Mutation("Keyspace1", key.key);
rm.add("StandardLong1", cellname(100), ByteBufferUtil.bytes("a"), 100);
rm.apply();
cfStore.forceBlockingFlush();
- rm = new RowMutation("Keyspace1", key.key);
+ rm = new Mutation("Keyspace1", key.key);
rm.add("StandardLong1", cellname(0), ByteBufferUtil.bytes("b"), 0);
rm.apply();
@@ -67,7 +67,7 @@ public class TimeSortTest extends SchemaLoader
for (int i = 900; i < 1000; ++i)
{
- RowMutation rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes(Integer.toString(i)));
+ Mutation rm = new Mutation("Keyspace1", ByteBufferUtil.bytes(Integer.toString(i)));
for (int j = 0; j < 8; ++j)
{
rm.add("StandardLong1", cellname(j * 2), ByteBufferUtil.bytes("a"), j * 2);
@@ -82,14 +82,14 @@ public class TimeSortTest extends SchemaLoader
// interleave some new data to test memtable + sstable
DecoratedKey key = Util.dk("900");
- RowMutation rm = new RowMutation("Keyspace1", key.key);
+ Mutation rm = new Mutation("Keyspace1", key.key);
for (int j = 0; j < 4; ++j)
{
rm.add("StandardLong1", cellname(j * 2 + 1), ByteBufferUtil.bytes("b"), j * 2 + 1);
}
rm.apply();
// and some overwrites
- rm = new RowMutation("Keyspace1", key.key);
+ rm = new Mutation("Keyspace1", key.key);
rm.add("StandardLong1", cellname(0), ByteBufferUtil.bytes("c"), 100);
rm.add("StandardLong1", cellname(10), ByteBufferUtil.bytes("c"), 100);
rm.apply();