mirror of https://github.com/apache/cassandra
simplify de-tombstoning of columns for pre-collated results
This commit is contained in:
parent
b397187850
commit
42a39b5d64
|
|
@ -156,7 +156,7 @@ public class CollationController
|
|||
// do a final collate. toCollate is boilerplate required to provide a CloseableIterator
|
||||
ColumnFamily returnCF = container.cloneMeShallow();
|
||||
Tracing.trace("Collating all results");
|
||||
filter.collateOnDiskAtom(returnCF, Collections.singletonList(container.iterator()), gcBefore);
|
||||
filter.collateOnDiskAtom(returnCF, container.iterator(), gcBefore);
|
||||
|
||||
// "hoist up" the requested data into a more recent sstable
|
||||
if (sstablesIterated > cfs.getMinimumCompactionThreshold()
|
||||
|
|
|
|||
|
|
@ -1322,7 +1322,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
{
|
||||
ColumnFamily cf = cached.cloneMeShallow(ArrayBackedSortedColumns.factory, filter.filter.isReversed());
|
||||
OnDiskAtomIterator ci = filter.getMemtableColumnIterator(cached, null);
|
||||
filter.collateOnDiskAtom(cf, Collections.singletonList(ci), gcBefore);
|
||||
filter.collateOnDiskAtom(cf, ci, gcBefore);
|
||||
return removeDeletedCF(cf, gcBefore);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -75,6 +75,15 @@ public class QueryFilter
|
|||
collateColumns(returnCF, filteredIterators, gcBefore);
|
||||
}
|
||||
|
||||
/**
|
||||
* When there is only a single source of atoms, we can skip the collate step
|
||||
*/
|
||||
public void collateOnDiskAtom(ColumnFamily returnCF, Iterator<? extends OnDiskAtom> toCollate, int gcBefore)
|
||||
{
|
||||
Iterator<Column> columns = gatherTombstones(returnCF, toCollate);
|
||||
filter.collectReducedColumns(returnCF, columns, gcBefore);
|
||||
}
|
||||
|
||||
public void collateColumns(final ColumnFamily returnCF, List<? extends Iterator<Column>> toCollate, final int gcBefore)
|
||||
{
|
||||
Comparator<Column> fcomp = filter.getColumnComparator(returnCF.getComparator());
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -204,7 +204,7 @@ public class SSTableExportTest extends SchemaLoader
|
|||
reader = SSTableReader.open(Descriptor.fromFilename(tempSS2.getPath()));
|
||||
QueryFilter qf = QueryFilter.getNamesFilter(Util.dk("rowA"), "Standard1", ByteBufferUtil.bytes("name"));
|
||||
ColumnFamily cf = qf.getSSTableColumnIterator(reader).getColumnFamily();
|
||||
qf.collateOnDiskAtom(cf, Collections.singletonList(qf.getSSTableColumnIterator(reader)), Integer.MIN_VALUE);
|
||||
qf.collateOnDiskAtom(cf, qf.getSSTableColumnIterator(reader), Integer.MIN_VALUE);
|
||||
assertTrue(cf != null);
|
||||
assertTrue(cf.getColumn(ByteBufferUtil.bytes("name")).value().equals(hexToBytes("76616c")));
|
||||
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ public class SSTableImportTest extends SchemaLoader
|
|||
SSTableReader reader = SSTableReader.open(Descriptor.fromFilename(tempSS.getPath()));
|
||||
QueryFilter qf = QueryFilter.getIdentityFilter(Util.dk("rowA"), "Super4");
|
||||
ColumnFamily cf = cloneForAdditions(qf.getSSTableColumnIterator(reader));
|
||||
qf.collateOnDiskAtom(cf, Collections.singletonList(qf.getSSTableColumnIterator(reader)), Integer.MIN_VALUE);
|
||||
qf.collateOnDiskAtom(cf, qf.getSSTableColumnIterator(reader), Integer.MIN_VALUE);
|
||||
|
||||
DeletionTime delTime = cf.deletionInfo().rangeCovering(CompositeType.build(ByteBufferUtil.bytes("superA"))).iterator().next();
|
||||
assertEquals("supercolumn deletion time did not match the expected time", new DeletionInfo(0, 0), new DeletionInfo(delTime));
|
||||
|
|
|
|||
Loading…
Reference in New Issue