cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tylerho...@apache.org
Subject [1/2] Use unsafe mutations where possible in unit tests
Date Wed, 09 Jul 2014 20:42:28 GMT
Repository: cassandra
Updated Branches:
  refs/heads/trunk e2bb7d223 -> b453f0897


http://git-wip-us.apache.org/repos/asf/cassandra/blob/b453f089/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 01ca340..921ccf4 100644
--- a/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java
+++ b/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java
@@ -119,7 +119,7 @@ public class SSTableReaderTest
             ByteBuffer key = ByteBufferUtil.bytes(String.valueOf(j));
             Mutation rm = new Mutation(KEYSPACE1, key);
             rm.add("Standard2", cellname("0"), ByteBufferUtil.EMPTY_BYTE_BUFFER, j);
-            rm.apply();
+            rm.applyUnsafe();
         }
         store.forceBlockingFlush();
         CompactionManager.instance.performMaximal(store);
@@ -160,7 +160,7 @@ public class SSTableReaderTest
             ByteBuffer key = ByteBufferUtil.bytes(String.valueOf(j));
             Mutation rm = new Mutation(KEYSPACE1, key);
             rm.add("Standard1", cellname("0"), ByteBufferUtil.EMPTY_BYTE_BUFFER, j);
-            rm.apply();
+            rm.applyUnsafe();
         }
         store.forceBlockingFlush();
         CompactionManager.instance.performMaximal(store);
@@ -195,7 +195,7 @@ public class SSTableReaderTest
             ByteBuffer key = ByteBufferUtil.bytes(String.valueOf(j));
             Mutation rm = new Mutation(KEYSPACE1, key);
             rm.add("Standard1", cellname("0"), ByteBufferUtil.EMPTY_BYTE_BUFFER, j);
-            rm.apply();
+            rm.applyUnsafe();
         }
         store.forceBlockingFlush();
 
@@ -223,7 +223,7 @@ public class SSTableReaderTest
             ByteBuffer key = ByteBufferUtil.bytes(String.valueOf(j));
             Mutation rm = new Mutation(KEYSPACE1, key);
             rm.add("Standard2", cellname("0"), ByteBufferUtil.EMPTY_BYTE_BUFFER, j);
-            rm.apply();
+            rm.applyUnsafe();
         }
         store.forceBlockingFlush();
         CompactionManager.instance.performMaximal(store);
@@ -252,7 +252,7 @@ public class SSTableReaderTest
         ByteBuffer key = ByteBufferUtil.bytes(String.valueOf("k1"));
         Mutation rm = new Mutation(KEYSPACE1, key);
         rm.add("Indexed1", cellname("birthdate"), ByteBufferUtil.bytes(1L), System.currentTimeMillis());
-        rm.apply();
+        rm.applyUnsafe();
         store.forceBlockingFlush();
 
         // check if opening and querying works
@@ -285,7 +285,7 @@ public class SSTableReaderTest
             Mutation rm = new Mutation(ks, key.getKey());
             rm.add(cf, cellname("col"),
                    ByteBufferUtil.EMPTY_BYTE_BUFFER, timestamp);
-            rm.apply();
+            rm.applyUnsafe();
         }
         store.forceBlockingFlush();
 
@@ -308,7 +308,7 @@ public class SSTableReaderTest
         ByteBuffer key = ByteBufferUtil.bytes(String.valueOf("k1"));
         Mutation rm = new Mutation(KEYSPACE1, key);
         rm.add("Indexed1", cellname("birthdate"), ByteBufferUtil.bytes(1L), System.currentTimeMillis());
-        rm.apply();
+        rm.applyUnsafe();
         store.forceBlockingFlush();
 
         ColumnFamilyStore indexCfs = store.indexManager.getIndexForColumn(ByteBufferUtil.bytes("birthdate")).getIndexCfs();
@@ -335,7 +335,7 @@ public class SSTableReaderTest
         ByteBuffer key = ByteBufferUtil.bytes(String.valueOf("k1"));
         Mutation rm = new Mutation(KEYSPACE1, key);
         rm.add("Standard1", cellname("xyz"), ByteBufferUtil.bytes("abc"), 0);
-        rm.apply();
+        rm.applyUnsafe();
         store.forceBlockingFlush();
         boolean foundScanner = false;
         for (SSTableReader s : store.getSSTables())
@@ -362,7 +362,7 @@ public class SSTableReaderTest
             ByteBuffer key = ByteBufferUtil.bytes(String.valueOf(j));
             Mutation rm = new Mutation(KEYSPACE1, key);
             rm.add("Standard2", cellname("0"), ByteBufferUtil.EMPTY_BYTE_BUFFER, j);
-            rm.apply();
+            rm.applyUnsafe();
         }
         store.forceBlockingFlush();
         CompactionManager.instance.performMaximal(store);
@@ -396,7 +396,7 @@ public class SSTableReaderTest
             ByteBuffer key = ByteBufferUtil.bytes(String.format("%3d", j));
             Mutation rm = new Mutation(KEYSPACE1, key);
             rm.add("StandardLowIndexInterval", Util.cellname("0"), ByteBufferUtil.bytes(String.format("%3d",
j)), j);
-            rm.apply();
+            rm.applyUnsafe();
         }
         store.forceBlockingFlush();
         CompactionManager.instance.performMaximal(store);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/b453f089/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 681efb69..d044947 100644
--- a/test/unit/org/apache/cassandra/io/sstable/SSTableScannerTest.java
+++ b/test/unit/org/apache/cassandra/io/sstable/SSTableScannerTest.java
@@ -86,7 +86,7 @@ public class SSTableScannerTest
         DecoratedKey decoratedKey = Util.dk(toKey(key));
         Mutation rm = new Mutation(KEYSPACE, decoratedKey.getKey());
         rm.add(TABLE, Util.cellname("col"), ByteBufferUtil.EMPTY_BYTE_BUFFER, timestamp,
1000);
-        rm.apply();
+        rm.applyUnsafe();
     }
 
     private static void assertScanMatches(SSTableReader sstable, int scanStart, int scanEnd,
int expectedStart, int expectedEnd)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/b453f089/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 52b2236..d7e5f45 100644
--- a/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java
+++ b/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java
@@ -264,7 +264,7 @@ public class StreamingTransferTest
                 cf.addColumn(new BufferCell(cellname("birthdate"), ByteBufferUtil.bytes(val),
timestamp));
                 Mutation rm = new Mutation(KEYSPACE1, ByteBufferUtil.bytes(key), cf);
                 logger.debug("Applying row to transfer {}", rm);
-                rm.apply();
+                rm.applyUnsafe();
             }
         }, transferSSTables);
 
@@ -304,7 +304,7 @@ public class StreamingTransferTest
         // add RangeTombstones
         cf.delete(new DeletionInfo(cellname(2), cellname(3), cf.getComparator(), 1, (int)
(System.currentTimeMillis() / 1000)));
         cf.delete(new DeletionInfo(cellname(5), cellname(7), cf.getComparator(), 1, (int)
(System.currentTimeMillis() / 1000)));
-        rm.apply();
+        rm.applyUnsafe();
         cfs.forceBlockingFlush();
 
         SSTableReader sstable = cfs.getSSTables().iterator().next();
@@ -488,7 +488,7 @@ public class StreamingTransferTest
                 cf.addColumn(new BufferCell(cellname("birthdate"), ByteBufferUtil.bytes(new
Date(timestamp).toString()), timestamp));
                 Mutation rm = new Mutation(KEYSPACE1, ByteBufferUtil.bytes(key), cf);
                 logger.debug("Applying row to transfer {}", rm);
-                rm.apply();
+                rm.applyUnsafe();
             }
         };
         // write a lot more data so the data is spread in more than 1 chunk.


Mime
View raw message