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

git-svn-id: https://svn.apache.org/repos/asf/incubator/cassandra/trunk@783078 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Ellis 2009-06-09 17:46:47 +00:00
parent 72e6eea9e4
commit 16306e02de
1 changed files with 6 additions and 8 deletions

View File

@ -38,14 +38,13 @@ public class TimeSortTest extends CleanupHelper
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 @@ public class TimeSortTest extends CleanupHelper
// 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();