cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brandonwilli...@apache.org
Subject svn commit: r1097668 - in /cassandra/branches/cassandra-0.7/contrib/stress/src/org/apache/cassandra/contrib/stress/operations: IndexedRangeSlicer.java Inserter.java
Date Fri, 29 Apr 2011 01:38:40 GMT
Author: brandonwilliams
Date: Fri Apr 29 01:38:40 2011
New Revision: 1097668

URL: http://svn.apache.org/viewvc?rev=1097668&view=rev
Log:
cache generateValues in Inserter/IndexedRangeSlicer.
Patch by Pavel Yaskevich, reviewed by brandonwilliams for CASSANDRA-2578

Modified:
    cassandra/branches/cassandra-0.7/contrib/stress/src/org/apache/cassandra/contrib/stress/operations/IndexedRangeSlicer.java
    cassandra/branches/cassandra-0.7/contrib/stress/src/org/apache/cassandra/contrib/stress/operations/Inserter.java

Modified: cassandra/branches/cassandra-0.7/contrib/stress/src/org/apache/cassandra/contrib/stress/operations/IndexedRangeSlicer.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/contrib/stress/src/org/apache/cassandra/contrib/stress/operations/IndexedRangeSlicer.java?rev=1097668&r1=1097667&r2=1097668&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/contrib/stress/src/org/apache/cassandra/contrib/stress/operations/IndexedRangeSlicer.java
(original)
+++ cassandra/branches/cassandra-0.7/contrib/stress/src/org/apache/cassandra/contrib/stress/operations/IndexedRangeSlicer.java
Fri Apr 29 01:38:40 2011
@@ -28,6 +28,8 @@ import java.util.List;
 
 public class IndexedRangeSlicer extends Operation
 {
+    private static List<ByteBuffer> values = null;
+
     public IndexedRangeSlicer(int index)
     {
         super(index);
@@ -35,12 +37,14 @@ public class IndexedRangeSlicer extends 
 
     public void run(Cassandra.Client client) throws IOException
     {
+        if (values == null)
+            values = generateValues();
+
         String format = "%0" + session.getTotalKeysLength() + "d";
         SlicePredicate predicate = new SlicePredicate().setSlice_range(new SliceRange(ByteBufferUtil.EMPTY_BYTE_BUFFER,
                                                                                       ByteBufferUtil.EMPTY_BYTE_BUFFER,
                                                                                       false,
session.getColumnsPerKey()));
 
-        List<ByteBuffer> values = super.generateValues();
         ColumnParent parent = new ColumnParent("Standard1");
         int expectedPerValue = session.getNumKeys() / values.size();
 

Modified: cassandra/branches/cassandra-0.7/contrib/stress/src/org/apache/cassandra/contrib/stress/operations/Inserter.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/contrib/stress/src/org/apache/cassandra/contrib/stress/operations/Inserter.java?rev=1097668&r1=1097667&r2=1097668&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/contrib/stress/src/org/apache/cassandra/contrib/stress/operations/Inserter.java
(original)
+++ cassandra/branches/cassandra-0.7/contrib/stress/src/org/apache/cassandra/contrib/stress/operations/Inserter.java
Fri Apr 29 01:38:40 2011
@@ -31,6 +31,7 @@ import java.util.Map;
 
 public class Inserter extends Operation
 {
+    private static List<ByteBuffer> values = null;
 
     public Inserter(int index)
     {
@@ -39,7 +40,9 @@ public class Inserter extends Operation
 
     public void run(Cassandra.Client client) throws IOException
     {
-        List<ByteBuffer> values = generateValues();
+        if (values == null)
+            values = generateValues();
+
         List<Column> columns = new ArrayList<Column>();
         List<SuperColumn> superColumns = new ArrayList<SuperColumn>();
 



Mime
View raw message