merge from 1.0.0

git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-1.0@1170645 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sylvain Lebresne 2011-09-14 14:34:47 +00:00
commit b49050e72d
7 changed files with 26 additions and 6 deletions

View File

@ -33,7 +33,7 @@
* add scheduler JMX metrics (CASSANDRA-2962)
* add block level checksum for compressed data (CASSANDRA-1717)
* make column family backed column map pluggable and introduce unsynchronized
ArrayList backed one to speedup reads (CASSANDRA-2843, 3165)
ArrayList backed one to speedup reads (CASSANDRA-2843, 3165, 3205)
* refactoring of the secondary index api (CASSANDRA-2982)
* make CL > ONE reads wait for digest reconciliation before returning
(CASSANDRA-2494)

View File

@ -82,6 +82,11 @@ public class ArrayBackedSortedColumns extends ArrayList<IColumn> implements ISor
return new ArrayBackedSortedColumns(this, comparator, reversed);
}
public boolean isInsertReversed()
{
return reversed;
}
private int compare(ByteBuffer name1, ByteBuffer name2)
{
if (reversed)

View File

@ -81,9 +81,9 @@ public class ColumnFamily extends AbstractColumnContainer
this.cfm = cfm;
}
public ColumnFamily cloneMeShallow(ISortedColumns.Factory factory)
public ColumnFamily cloneMeShallow(ISortedColumns.Factory factory, boolean reversedInsertOrder)
{
ColumnFamily cf = ColumnFamily.create(cfm, factory);
ColumnFamily cf = ColumnFamily.create(cfm, factory, reversedInsertOrder);
// since deletion info is immutable, aliasing it is fine
cf.deletionInfo.set(deletionInfo.get());
return cf;
@ -91,7 +91,7 @@ public class ColumnFamily extends AbstractColumnContainer
public ColumnFamily cloneMeShallow()
{
return cloneMeShallow(columns.getFactory());
return cloneMeShallow(columns.getFactory(), columns.isInsertReversed());
}
public AbstractType getSubComparator()

View File

@ -1194,7 +1194,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
IColumn sc = cached.getColumn(filter.path.superColumnName);
if (sc == null || sliceFilter.count >= sc.getSubColumns().size())
{
ColumnFamily cf = cached.cloneMeShallow(ArrayBackedSortedColumns.factory());
ColumnFamily cf = cached.cloneMeShallow(ArrayBackedSortedColumns.factory(), filter.filter.isReversed());
if (sc != null)
cf.addColumn(sc, HeapAllocator.instance);
return removeDeleted(cf, gcBefore);
@ -1213,7 +1213,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
}
IColumnIterator ci = filter.getMemtableColumnIterator(cached, null, getComparator());
ColumnFamily cf = ci.getColumnFamily().cloneMeShallow(ArrayBackedSortedColumns.factory());
ColumnFamily cf = ci.getColumnFamily().cloneMeShallow(ArrayBackedSortedColumns.factory(), filter.filter.isReversed());
filter.collateColumns(cf, Collections.singletonList(ci), getComparator(), gcBefore);
// TODO this is necessary because when we collate supercolumns together, we don't check
// their subcolumns for relevance, so we need to do a second prune post facto here.

View File

@ -124,6 +124,11 @@ public interface ISortedColumns extends IIterableColumns
*/
public Iterator<IColumn> reverseIterator();
/**
* Returns if this map only support inserts in reverse order.
*/
public boolean isInsertReversed();
public interface Factory
{
/**

View File

@ -72,6 +72,11 @@ public class ThreadSafeSortedColumns extends ConcurrentSkipListMap<ByteBuffer, I
return new ThreadSafeSortedColumns(this);
}
public boolean isInsertReversed()
{
return false;
}
/*
* If we find an old column that has the same name
* the ask it to resolve itself else add the new column

View File

@ -72,6 +72,11 @@ public class TreeMapBackedSortedColumns extends TreeMap<ByteBuffer, IColumn> imp
return new TreeMapBackedSortedColumns(this);
}
public boolean isInsertReversed()
{
return false;
}
/*
* If we find an old column that has the same name
* the ask it to resolve itself else add the new column