You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2009/06/09 19:46:47 UTC

svn commit: r783078 - /incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/TimeSortTest.java

Author: jbellis
Date: Tue Jun  9 17:46:47 2009
New Revision: 783078

URL: http://svn.apache.org/viewvc?rev=783078&view=rev
Log:
apply rows atomically, rather than one-column-at-a-time.  this avoids exposing the bug in time-sorted
columns discussed in #223.
patch by jbellis; reviewed by Jun Rao for CASSANDRA-208

Modified:
    incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/TimeSortTest.java

Modified: incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/TimeSortTest.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/TimeSortTest.java?rev=783078&r1=783077&r2=783078&view=diff
==============================================================================
--- incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/TimeSortTest.java (original)
+++ incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/TimeSortTest.java Tue Jun  9 17:46:47 2009
@@ -38,14 +38,13 @@
         for (int i = 900; i < 1000; ++i)
         {
             String key = Integer.toString(i);
-            RowMutation rm;
+            RowMutation rm = new RowMutation("Table1", key);
             for (int j = 0; j < 8; ++j)
             {
                 byte[] bytes = j % 2 == 0 ? "a".getBytes() : "b".getBytes();
-                rm = new RowMutation("Table1", key);
                 rm.add("StandardByTime1:" + "Column-" + j, bytes, j * 2);
-                rm.apply();
             }
+            rm.apply();
         }
 
         validateTimeSort(table);
@@ -55,20 +54,19 @@
 
         // interleave some new data to test memtable + sstable
         String key = "900";
-        RowMutation rm;
+        RowMutation rm = new RowMutation("Table1", key);
         for (int j = 0; j < 4; ++j)
         {
-            rm = new RowMutation("Table1", key);
             rm.add("StandardByTime1:" + "Column+" + j, ArrayUtils.EMPTY_BYTE_ARRAY, j * 2 + 1);
-            rm.apply();
         }
+        rm.apply();
         // and some overwrites
+        rm = new RowMutation("Table1", key);
         for (int j = 4; j < 8; ++j)
         {
-            rm = new RowMutation("Table1", key);
             rm.add("StandardByTime1:" + "Column-" + j, ArrayUtils.EMPTY_BYTE_ARRAY, j * 3);
-            rm.apply();
         }
+        rm.apply();
         // verify
         ColumnFamily cf = table.getRow(key, "StandardByTime1", 0).getColumnFamilies().iterator().next();
         SortedSet<IColumn> columns = cf.getAllColumns();