/** * Creates an {@code ArrayBackedCachedPartition} holding all the data of the provided iterator. * * Warning: Note that this method does not close the provided iterator and it is * up to the caller to do so. * * @param iterator the iterator got gather in memory. * @param nowInSec the time of the creation in seconds. This is the time at which {@link #cachedLiveRows} applies. * @return the created partition. */ public static CachedBTreePartition create(UnfilteredRowIterator iterator, int nowInSec) { return create(iterator, 16, nowInSec); }
public long serializedSize(CachedPartition partition) { int version = MessagingService.current_version; assert partition instanceof CachedBTreePartition; CachedBTreePartition p = (CachedBTreePartition)partition; try (UnfilteredRowIterator iter = p.unfilteredIterator()) { return TypeSizes.sizeof(p.createdAtInSec) + TypeSizes.sizeof(p.cachedLiveRows) + TypeSizes.sizeof(p.rowsWithNonExpiringCells) + TypeSizes.sizeof(p.nonTombstoneCellCount) + TypeSizes.sizeof(p.nonExpiringLiveCells) + CFMetaData.serializer.serializedSize(partition.metadata(), version) + UnfilteredRowIteratorSerializer.serializer.serializedSize(iter, null, MessagingService.current_version, p.rowCount()); } } }
return new CachedBTreePartition(metadata, header.key, holder,
public long serializedSize(CachedPartition partition) { int version = MessagingService.current_version; assert partition instanceof CachedBTreePartition; CachedBTreePartition p = (CachedBTreePartition)partition; try (UnfilteredRowIterator iter = p.unfilteredIterator()) { return TypeSizes.sizeof(p.createdAtInSec) + TypeSizes.sizeof(p.cachedLiveRows) + TypeSizes.sizeof(p.rowsWithNonExpiringCells) + TypeSizes.sizeof(p.nonTombstoneCellCount) + TypeSizes.sizeof(p.nonExpiringLiveCells) + CFMetaData.serializer.serializedSize(partition.metadata(), version) + UnfilteredRowIteratorSerializer.serializer.serializedSize(iter, null, MessagingService.current_version, p.rowCount()); } } }
return new CachedBTreePartition(metadata, header.key, holder,
public void serialize(CachedPartition partition, DataOutputPlus out) throws IOException { int version = MessagingService.current_version; assert partition instanceof CachedBTreePartition; CachedBTreePartition p = (CachedBTreePartition)partition; out.writeInt(p.createdAtInSec); out.writeInt(p.cachedLiveRows); out.writeInt(p.rowsWithNonExpiringCells); out.writeInt(p.nonTombstoneCellCount); out.writeInt(p.nonExpiringLiveCells); CFMetaData.serializer.serialize(partition.metadata(), out, version); try (UnfilteredRowIterator iter = p.unfilteredIterator()) { UnfilteredRowIteratorSerializer.serializer.serialize(iter, null, out, version, p.rowCount()); } }
return new CachedBTreePartition(metadata, header.key, holder,
/** * Creates an {@code ArrayBackedCachedPartition} holding all the data of the provided iterator. * * Warning: Note that this method does not close the provided iterator and it is * up to the caller to do so. * * @param iterator the iterator got gather in memory. * @param nowInSec the time of the creation in seconds. This is the time at which {@link #cachedLiveRows} applies. * @return the created partition. */ public static CachedBTreePartition create(UnfilteredRowIterator iterator, int nowInSec) { return create(iterator, 16, nowInSec); }
public void serialize(CachedPartition partition, DataOutputPlus out) throws IOException { int version = MessagingService.current_version; assert partition instanceof CachedBTreePartition; CachedBTreePartition p = (CachedBTreePartition)partition; out.writeInt(p.createdAtInSec); out.writeInt(p.cachedLiveRows); out.writeInt(p.rowsWithNonExpiringCells); out.writeInt(p.nonTombstoneCellCount); out.writeInt(p.nonExpiringLiveCells); CFMetaData.serializer.serialize(partition.metadata(), out, version); try (UnfilteredRowIterator iter = p.unfilteredIterator()) { UnfilteredRowIteratorSerializer.serializer.serialize(iter, null, out, version, p.rowCount()); } }
return new CachedBTreePartition(metadata, header.key, holder,
/** * Creates an {@code ArrayBackedCachedPartition} holding all the data of the provided iterator. * * Warning: Note that this method does not close the provided iterator and it is * up to the caller to do so. * * @param iterator the iterator got gather in memory. * @param nowInSec the time of the creation in seconds. This is the time at which {@link #cachedLiveRows} applies. * @return the created partition. */ public static CachedBTreePartition create(UnfilteredRowIterator iterator, int nowInSec) { return create(iterator, 16, nowInSec); }
public long serializedSize(CachedPartition partition) { int version = MessagingService.current_version; assert partition instanceof CachedBTreePartition; CachedBTreePartition p = (CachedBTreePartition)partition; try (UnfilteredRowIterator iter = p.unfilteredIterator()) { return TypeSizes.sizeof(p.createdAtInSec) + TypeSizes.sizeof(p.cachedLiveRows) + TypeSizes.sizeof(p.rowsWithNonExpiringCells) + TypeSizes.sizeof(p.nonTombstoneCellCount) + TypeSizes.sizeof(p.nonExpiringLiveCells) + CFMetaData.serializer.serializedSize(partition.metadata(), version) + UnfilteredRowIteratorSerializer.serializer.serializedSize(iter, null, MessagingService.current_version, p.rowCount()); } } }
return new CachedBTreePartition(iterator.metadata(), iterator.partitionKey(), holder,
public Pair<RowCacheKey, IRowCacheEntry> call() throws Exception { DecoratedKey key = cfs.decorateKey(buffer); int nowInSec = FBUtilities.nowInSeconds(); SinglePartitionReadCommand cmd = SinglePartitionReadCommand.fullPartitionRead(cfs.metadata, nowInSec, key); try (ReadExecutionController controller = cmd.executionController(); UnfilteredRowIterator iter = cmd.queryMemtableAndDisk(cfs, controller)) { CachedPartition toCache = CachedBTreePartition.create(DataLimits.cqlLimits(rowsToCache).filter(iter, nowInSec, true), nowInSec); return Pair.create(new RowCacheKey(cfs.metadata.ksAndCFName, key), (IRowCacheEntry)toCache); } } });
public void serialize(CachedPartition partition, DataOutputPlus out) throws IOException { int version = MessagingService.current_version; assert partition instanceof CachedBTreePartition; CachedBTreePartition p = (CachedBTreePartition)partition; out.writeInt(p.createdAtInSec); out.writeInt(p.cachedLiveRows); out.writeInt(p.rowsWithNonExpiringCells); out.writeInt(p.nonTombstoneCellCount); out.writeInt(p.nonExpiringLiveCells); CFMetaData.serializer.serialize(partition.metadata(), out, version); try (UnfilteredRowIterator iter = p.unfilteredIterator()) { UnfilteredRowIteratorSerializer.serializer.serialize(iter, null, out, version, p.rowCount()); } }
return new CachedBTreePartition(iterator.metadata(), iterator.partitionKey(), holder,
public Pair<RowCacheKey, IRowCacheEntry> call() throws Exception { DecoratedKey key = cfs.decorateKey(buffer); int nowInSec = FBUtilities.nowInSeconds(); SinglePartitionReadCommand cmd = SinglePartitionReadCommand.fullPartitionRead(cfs.metadata, nowInSec, key); try (ReadExecutionController controller = cmd.executionController(); UnfilteredRowIterator iter = cmd.queryMemtableAndDisk(cfs, controller)) { CachedPartition toCache = CachedBTreePartition.create(DataLimits.cqlLimits(rowsToCache).filter(iter, nowInSec, true), nowInSec); return Pair.create(new RowCacheKey(cfs.metadata.ksAndCFName, key), (IRowCacheEntry)toCache); } } });
public void serialize(CachedPartition partition, DataOutputPlus out) throws IOException { int version = MessagingService.current_version; assert partition instanceof CachedBTreePartition; CachedBTreePartition p = (CachedBTreePartition)partition; out.writeInt(p.createdAtInSec); out.writeInt(p.cachedLiveRows); out.writeInt(p.rowsWithNonExpiringCells); out.writeInt(p.nonTombstoneCellCount); out.writeInt(p.nonExpiringLiveCells); CFMetaData.serializer.serialize(partition.metadata(), out, version); try (UnfilteredRowIterator iter = p.unfilteredIterator()) { UnfilteredRowIteratorSerializer.serializer.serialize(iter, null, out, version, p.rowCount()); } }
return new CachedBTreePartition(iterator.metadata(), iterator.partitionKey(), holder,
public Pair<RowCacheKey, IRowCacheEntry> call() throws Exception { DecoratedKey key = cfs.decorateKey(buffer); int nowInSec = FBUtilities.nowInSeconds(); SinglePartitionReadCommand cmd = SinglePartitionReadCommand.fullPartitionRead(cfs.metadata, nowInSec, key); try (ReadExecutionController controller = cmd.executionController(); UnfilteredRowIterator iter = cmd.queryMemtableAndDisk(cfs, controller)) { CachedPartition toCache = CachedBTreePartition.create(DataLimits.cqlLimits(rowsToCache).filter(iter, nowInSec, true), nowInSec); return Pair.create(new RowCacheKey(cfs.metadata.ksAndCFName, key), (IRowCacheEntry)toCache); } } });