public static RowMark create(CFMetaData metadata, Row row, ProtocolVersion protocolVersion) { ByteBuffer mark; if (protocolVersion.isSmallerOrEqualTo(ProtocolVersion.V3)) { // We need to be backward compatible with 2.1/2.2 nodes paging states. Which means we have to send // the full cellname of the "last" cell in the row we get (since that's how 2.1/2.2 nodes will start after // that last row if they get that paging state). Iterator<Cell> cells = row.cellsInLegacyOrder(metadata, true).iterator(); if (!cells.hasNext()) { // If the last returned row has no cell, this means in 2.1/2.2 terms that we stopped on the row // marker. Note that this shouldn't happen if the table is COMPACT. assert !metadata.isCompactTable(); mark = LegacyLayout.encodeCellName(metadata, row.clustering(), ByteBufferUtil.EMPTY_BYTE_BUFFER, null); } else { Cell cell = cells.next(); mark = LegacyLayout.encodeCellName(metadata, row.clustering(), cell.column().name.bytes, cell.column().isComplex() ? cell.path().get(0) : null); } } else { // We froze the serialization version to 3.0 as we need to make this this doesn't change (that is, it has to be // fix for a given version of the protocol). mark = Clustering.serializer.serialize(row.clustering(), MessagingService.VERSION_30, makeClusteringTypes(metadata)); } return new RowMark(mark, protocolVersion); }
protected ReadCommand nextPageReadCommand(int pageSize) throws RequestExecutionException { DataLimits limits; DataRange fullRange = ((PartitionRangeReadCommand)command).dataRange(); DataRange pageRange; if (lastReturnedKey == null) { pageRange = fullRange; limits = command.limits().forPaging(pageSize); } else { // We want to include the last returned key only if we haven't achieved our per-partition limit, otherwise, don't bother. boolean includeLastKey = remainingInPartition() > 0 && lastReturnedRow != null; AbstractBounds<PartitionPosition> bounds = makeKeyBounds(lastReturnedKey, includeLastKey); if (includeLastKey) { pageRange = fullRange.forPaging(bounds, command.metadata().comparator, lastReturnedRow.clustering(command.metadata()), false); limits = command.limits().forPaging(pageSize, lastReturnedKey.getKey(), remainingInPartition()); } else { pageRange = fullRange.forSubRange(bounds); limits = command.limits().forPaging(pageSize); } } return ((PartitionRangeReadCommand) command).withUpdatedLimitsAndDataRange(limits, pageRange); }
public static RowMark create(CFMetaData metadata, Row row, ProtocolVersion protocolVersion) { ByteBuffer mark; if (protocolVersion.isSmallerOrEqualTo(ProtocolVersion.V3)) { // We need to be backward compatible with 2.1/2.2 nodes paging states. Which means we have to send // the full cellname of the "last" cell in the row we get (since that's how 2.1/2.2 nodes will start after // that last row if they get that paging state). Iterator<Cell> cells = row.cellsInLegacyOrder(metadata, true).iterator(); if (!cells.hasNext()) { // If the last returned row has no cell, this means in 2.1/2.2 terms that we stopped on the row // marker. Note that this shouldn't happen if the table is COMPACT. assert !metadata.isCompactTable(); mark = LegacyLayout.encodeCellName(metadata, row.clustering(), ByteBufferUtil.EMPTY_BYTE_BUFFER, null); } else { Cell cell = cells.next(); mark = LegacyLayout.encodeCellName(metadata, row.clustering(), cell.column().name.bytes, cell.column().isComplex() ? cell.path().get(0) : null); } } else { // We froze the serialization version to 3.0 as we need to make this this doesn't change (that is, it has to be // fix for a given version of the protocol). mark = Clustering.serializer.serialize(row.clustering(), MessagingService.VERSION_30, makeClusteringTypes(metadata)); } return new RowMark(mark, protocolVersion); }
protected ReadCommand nextPageReadCommand(int pageSize) throws RequestExecutionException { DataLimits limits; DataRange fullRange = ((PartitionRangeReadCommand)command).dataRange(); DataRange pageRange; if (lastReturnedKey == null) { pageRange = fullRange; limits = command.limits().forPaging(pageSize); } else { // We want to include the last returned key only if we haven't achieved our per-partition limit, otherwise, don't bother. boolean includeLastKey = remainingInPartition() > 0 && lastReturnedRow != null; AbstractBounds<PartitionPosition> bounds = makeKeyBounds(lastReturnedKey, includeLastKey); if (includeLastKey) { pageRange = fullRange.forPaging(bounds, command.metadata().comparator, lastReturnedRow.clustering(command.metadata()), false); limits = command.limits().forPaging(pageSize, lastReturnedKey.getKey(), remainingInPartition()); } else { pageRange = fullRange.forSubRange(bounds); limits = command.limits().forPaging(pageSize); } } return ((PartitionRangeReadCommand) command).withUpdatedLimitsAndDataRange(limits, pageRange); }
public static RowMark create(CFMetaData metadata, Row row, ProtocolVersion protocolVersion) { ByteBuffer mark; if (protocolVersion.isSmallerOrEqualTo(ProtocolVersion.V3)) { // We need to be backward compatible with 2.1/2.2 nodes paging states. Which means we have to send // the full cellname of the "last" cell in the row we get (since that's how 2.1/2.2 nodes will start after // that last row if they get that paging state). Iterator<Cell> cells = row.cellsInLegacyOrder(metadata, true).iterator(); if (!cells.hasNext()) { // If the last returned row has no cell, this means in 2.1/2.2 terms that we stopped on the row // marker. Note that this shouldn't happen if the table is COMPACT. assert !metadata.isCompactTable(); mark = LegacyLayout.encodeCellName(metadata, row.clustering(), ByteBufferUtil.EMPTY_BYTE_BUFFER, null); } else { Cell cell = cells.next(); mark = LegacyLayout.encodeCellName(metadata, row.clustering(), cell.column().name.bytes, cell.column().isComplex() ? cell.path().get(0) : null); } } else { // We froze the serialization version to 3.0 as we need to make this this doesn't change (that is, it has to be // fix for a given version of the protocol). mark = Clustering.serializer.serialize(row.clustering(), MessagingService.VERSION_30, makeClusteringTypes(metadata)); } return new RowMark(mark, protocolVersion); }
protected ReadCommand nextPageReadCommand(int pageSize) throws RequestExecutionException { DataLimits limits; DataRange fullRange = ((PartitionRangeReadCommand)command).dataRange(); DataRange pageRange; if (lastReturnedKey == null) { pageRange = fullRange; limits = command.limits().forPaging(pageSize); } else { // We want to include the last returned key only if we haven't achieved our per-partition limit, otherwise, don't bother. boolean includeLastKey = remainingInPartition() > 0 && lastReturnedRow != null; AbstractBounds<PartitionPosition> bounds = makeKeyBounds(lastReturnedKey, includeLastKey); if (includeLastKey) { pageRange = fullRange.forPaging(bounds, command.metadata().comparator, lastReturnedRow.clustering(command.metadata()), false); limits = command.limits().forPaging(pageSize, lastReturnedKey.getKey(), remainingInPartition()); } else { pageRange = fullRange.forSubRange(bounds); limits = command.limits().forPaging(pageSize); } } return ((PartitionRangeReadCommand) command).withUpdatedLimitsAndDataRange(limits, pageRange); }
public static RowMark create(CFMetaData metadata, Row row, ProtocolVersion protocolVersion) { ByteBuffer mark; if (protocolVersion.isSmallerOrEqualTo(ProtocolVersion.V3)) { // We need to be backward compatible with 2.1/2.2 nodes paging states. Which means we have to send // the full cellname of the "last" cell in the row we get (since that's how 2.1/2.2 nodes will start after // that last row if they get that paging state). Iterator<Cell> cells = row.cellsInLegacyOrder(metadata, true).iterator(); if (!cells.hasNext()) { // If the last returned row has no cell, this means in 2.1/2.2 terms that we stopped on the row // marker. Note that this shouldn't happen if the table is COMPACT. assert !metadata.isCompactTable(); mark = LegacyLayout.encodeCellName(metadata, row.clustering(), ByteBufferUtil.EMPTY_BYTE_BUFFER, null); } else { Cell cell = cells.next(); mark = LegacyLayout.encodeCellName(metadata, row.clustering(), cell.column().name.bytes, cell.column().isComplex() ? cell.path().get(0) : null); } } else { // We froze the serialization version to 3.0 as we need to make this this doesn't change (that is, it has to be // fix for a given version of the protocol). mark = Clustering.serializer.serialize(row.clustering(), MessagingService.VERSION_30, makeClusteringTypes(metadata)); } return new RowMark(mark, protocolVersion); }
protected ReadCommand nextPageReadCommand(int pageSize) { Clustering clustering = lastReturned == null ? null : lastReturned.clustering(command.metadata()); DataLimits limits = (lastReturned == null || command.isForThrift()) ? limits().forPaging(pageSize) : limits().forPaging(pageSize, key(), remainingInPartition()); return command.forPaging(clustering, limits); }
protected ReadCommand nextPageReadCommand(int pageSize) { Clustering clustering = lastReturned == null ? null : lastReturned.clustering(command.metadata()); DataLimits limits = (lastReturned == null || command.isForThrift()) ? limits().forPaging(pageSize) : limits().forPaging(pageSize, key(), remainingInPartition()); return command.forPaging(clustering, limits); }
protected void recordLast(DecoratedKey key, Row last) { if (last != null) { lastReturnedKey = key; if (last.clustering() != Clustering.STATIC_CLUSTERING) lastReturnedRow = PagingState.RowMark.create(command.metadata(), last, protocolVersion); } }
protected void recordLast(DecoratedKey key, Row last) { if (last != null && last.clustering() != Clustering.STATIC_CLUSTERING) lastReturned = PagingState.RowMark.create(command.metadata(), last, protocolVersion); }
protected void recordLast(DecoratedKey key, Row last) { if (last != null) { lastReturnedKey = key; if (last.clustering() != Clustering.STATIC_CLUSTERING) lastReturnedRow = PagingState.RowMark.create(command.metadata(), last, protocolVersion); } }
protected void recordLast(DecoratedKey key, Row last) { if (last != null && last.clustering() != Clustering.STATIC_CLUSTERING) lastReturned = PagingState.RowMark.create(command.metadata(), last, protocolVersion); }
public Clustering clustering(CFMetaData metadata) { if (mark == null) return null; return protocolVersion.isSmallerOrEqualTo(ProtocolVersion.V3) ? LegacyLayout.decodeClustering(metadata, mark) : Clustering.serializer.deserialize(mark, MessagingService.VERSION_30, makeClusteringTypes(metadata)); }
public Clustering clustering(CFMetaData metadata) { if (mark == null) return null; return protocolVersion.isSmallerOrEqualTo(ProtocolVersion.V3) ? LegacyLayout.decodeClustering(metadata, mark) : Clustering.serializer.deserialize(mark, MessagingService.VERSION_30, makeClusteringTypes(metadata)); }
protected void recordLast(DecoratedKey key, Row last) { if (last != null && last.clustering() != Clustering.STATIC_CLUSTERING) lastReturned = PagingState.RowMark.create(command.metadata(), last, protocolVersion); }