mirror of https://github.com/apache/cassandra
rename, clean up collectColumns methods
patch by jbellis; reviewed by Evan Weaver for CASSANDRA-356 git-svn-id: https://svn.apache.org/repos/asf/incubator/cassandra/trunk@802826 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
15354b4906
commit
cee37599f6
|
|
@ -33,7 +33,6 @@ import org.apache.log4j.Logger;
|
|||
|
||||
import org.apache.cassandra.config.DatabaseDescriptor;
|
||||
import org.apache.cassandra.dht.Range;
|
||||
import org.apache.cassandra.dht.IPartitioner;
|
||||
import org.apache.cassandra.io.*;
|
||||
import org.apache.cassandra.net.EndPoint;
|
||||
import org.apache.cassandra.service.StorageService;
|
||||
|
|
@ -1437,7 +1436,7 @@ public final class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
if (!collated.hasNext())
|
||||
return null;
|
||||
|
||||
filter.collectColumns(returnCF, collated, gcBefore);
|
||||
filter.collectCollatedColumns(returnCF, collated, gcBefore);
|
||||
|
||||
return removeDeleted(returnCF, gcBefore); // collect does a first pass but doesn't try to recognize e.g. the entire CF being tombstoned
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
package org.apache.cassandra.db.filter;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.SortedSet;
|
||||
import java.util.Arrays;
|
||||
import java.util.TreeSet;
|
||||
import java.util.Comparator;
|
||||
import java.util.*;
|
||||
|
||||
import org.apache.cassandra.io.SSTableReader;
|
||||
import org.apache.cassandra.utils.ReducingIterator;
|
||||
|
|
@ -64,10 +61,11 @@ public class NamesQueryFilter extends QueryFilter
|
|||
}
|
||||
}
|
||||
|
||||
public void collectColumns(ColumnFamily returnCF, ReducingIterator<IColumn> reducedColumns, int gcBefore)
|
||||
public void collectReducedColumns(ColumnFamily returnCF, Iterator<IColumn> reducedColumns, int gcBefore)
|
||||
{
|
||||
for (IColumn column : reducedColumns)
|
||||
while (reducedColumns.hasNext())
|
||||
{
|
||||
IColumn column = reducedColumns.next();
|
||||
if (!column.isMarkedForDelete() || column.getLocalDeletionTime() > gcBefore)
|
||||
returnCF.addColumn(column);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public abstract class QueryFilter
|
|||
* by the filter code, which should have some limit on the number of columns
|
||||
* to avoid running out of memory on large rows.
|
||||
*/
|
||||
public abstract void collectColumns(ColumnFamily returnCF, ReducingIterator<IColumn> reducedColumns, int gcBefore);
|
||||
public abstract void collectReducedColumns(ColumnFamily returnCF, Iterator<IColumn> reducedColumns, int gcBefore);
|
||||
|
||||
/**
|
||||
* subcolumns of a supercolumn are unindexed, so to pick out parts of those we operate in-memory.
|
||||
|
|
@ -57,7 +57,7 @@ public abstract class QueryFilter
|
|||
};
|
||||
}
|
||||
|
||||
public void collectColumns(final ColumnFamily returnCF, Iterator collatedColumns, int gcBefore)
|
||||
public void collectCollatedColumns(final ColumnFamily returnCF, Iterator<IColumn> collatedColumns, int gcBefore)
|
||||
{
|
||||
// define a 'reduced' iterator that merges columns w/ the same name, which
|
||||
// greatly simplifies computing liveColumns in the presence of tombstones.
|
||||
|
|
@ -83,7 +83,7 @@ public abstract class QueryFilter
|
|||
}
|
||||
};
|
||||
|
||||
collectColumns(returnCF, reduced, gcBefore);
|
||||
collectReducedColumns(returnCF, reduced, gcBefore);
|
||||
}
|
||||
|
||||
public String getColumnFamilyName()
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package org.apache.cassandra.db.filter;
|
|||
import java.io.IOException;
|
||||
import java.util.Comparator;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.apache.commons.collections.comparators.ReverseComparator;
|
||||
|
||||
|
|
@ -66,13 +67,14 @@ public class SliceQueryFilter extends QueryFilter
|
|||
return isAscending ? super.getColumnComparator(comparator) : new ReverseComparator(super.getColumnComparator(comparator));
|
||||
}
|
||||
|
||||
public void collectColumns(ColumnFamily returnCF, ReducingIterator<IColumn> reducedColumns, int gcBefore)
|
||||
public void collectReducedColumns(ColumnFamily returnCF, Iterator<IColumn> reducedColumns, int gcBefore)
|
||||
{
|
||||
int liveColumns = 0;
|
||||
AbstractType comparator = returnCF.getComparator();
|
||||
|
||||
for (IColumn column : reducedColumns)
|
||||
while (reducedColumns.hasNext())
|
||||
{
|
||||
IColumn column = reducedColumns.next();
|
||||
if (liveColumns >= count)
|
||||
break;
|
||||
if (finish.length > 0
|
||||
|
|
|
|||
Loading…
Reference in New Issue